[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 08/27] libxl: idl: add Enumeration.value_namespace property



This allows setting the namespace for values of an Enumeration to be different
from the namespace of the Enumeration itself.

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
---
 tools/libxl/idl.py  |    5 ++++-
 tools/libxl/idl.txt |    7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/idl.py b/tools/libxl/idl.py
index f4908dd..e4dc79b 100644
--- a/tools/libxl/idl.py
+++ b/tools/libxl/idl.py
@@ -136,7 +136,7 @@ class EnumerationValue(object):
 
         self.valuename = str.upper(name)
         self.rawname = str.upper(enum.rawname) + "_" + self.valuename
-        self.name = str.upper(enum.namespace) + self.rawname
+        self.name = str.upper(enum.value_namespace) + self.rawname
         self.value = value
 
 class Enumeration(Type):
@@ -144,6 +144,9 @@ class Enumeration(Type):
         kwargs.setdefault('dispose_fn', None)
         Type.__init__(self, typename, **kwargs)
 
+        self.value_namespace = kwargs.setdefault('value_namespace',
+            self.namespace)
+
         self.values = []
         for v in values:
             # (value, name)
diff --git a/tools/libxl/idl.txt b/tools/libxl/idl.txt
index 019acbe..439aede 100644
--- a/tools/libxl/idl.txt
+++ b/tools/libxl/idl.txt
@@ -90,6 +90,13 @@ Complex type-Classes
 idl.Enumeration
 
   A class representing an enumeration (named integer values).
+  This class has one property besides the ones defined for the Type
+  class:
+
+  Enumeration.value_namespace: (default: namespace)
+
+    The namespace in which the values of the Enumeration (see below) reside.
+    This prefix is prepended to the name of the value.
 
   The values are available in the list Enumeration.values. Each
   element in the list is of type idl.EnumerationValue.
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.