From: Ian Campbell Subject: Re: [PATCH v4 08/27] libxl: idl: add Enumeration.value_namespace property Date: Mon, 11 Nov 2013 14:31:05 +0000 Message-ID: <1384180265.19117.33.camel@kazak.uk.xensource.com> References: <1383760205-20397-1-git-send-email-rob.hoes@citrix.com> <1383760205-20397-9-git-send-email-rob.hoes@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383760205-20397-9-git-send-email-rob.hoes@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Rob Hoes Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2013-11-06 at 17:49 +0000, Rob Hoes wrote: > 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 Acked-by: Ian Campbell > --- > 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.