Back to index

enigmail  1.4.3
Public Member Functions | Public Attributes | Static Public Attributes
xpidl.Attribute Class Reference

List of all members.

Public Member Functions

def __init__
def resolve
def toIDL
def isScriptable
def __str__
def count

Public Attributes

 type
 name
 attlist
 location
 doccomments
 iface
 realtype

Static Public Attributes

string kind = 'attribute'
 noscript = False
 notxpcom = False
 readonly = False
 implicit_jscontext = False
 nostdcall = False
 binaryname = None
 null = None
 undefined = None
 deprecated = False
 nullable = False
 defvalue = None

Detailed Description

Definition at line 732 of file xpidl.py.


Constructor & Destructor Documentation

def xpidl.Attribute.__init__ (   self,
  type,
  name,
  attlist,
  readonly,
  nullable,
  defvalue,
  location,
  doccomments 
)

Definition at line 746 of file xpidl.py.

00746 
00747     def __init__(self, type, name, attlist, readonly, nullable, defvalue, location, doccomments):
00748         self.type = type
00749         self.name = name
00750         self.attlist = attlist
00751         self.readonly = readonly
00752         self.nullable = nullable
00753         self.defvalue = defvalue
00754         self.location = location
00755         self.doccomments = doccomments
00756 
00757         for name, value, aloc in attlist:
00758             if name == 'binaryname':
00759                 if value is None:
00760                     raise IDLError("binaryname attribute requires a value",
00761                                    aloc)
00762 
00763                 self.binaryname = value
00764                 continue
00765 
00766             if name == 'Null':
00767                 if value is None:
00768                     raise IDLError("'Null' attribute requires a value", aloc)
00769                 if readonly:
00770                     raise IDLError("'Null' attribute only makes sense for setters",
00771                                    aloc);
00772                 if value not in ('Empty', 'Null', 'Stringify'):
00773                     raise IDLError("'Null' attribute value must be 'Empty', 'Null' or 'Stringify'",
00774                                    aloc);
00775                 self.null = value
00776             elif name == 'Undefined':
00777                 if value is None:
00778                     raise IDLError("'Undefined' attribute requires a value", aloc)
00779                 if readonly:
00780                     raise IDLError("'Undefined' attribute only makes sense for setters",
00781                                    aloc);
00782                 if value not in ('Empty', 'Null'):
00783                     raise IDLError("'Undefined' attribute value must be 'Empty' or 'Null'",
00784                                    aloc);
00785                 self.undefined = value
00786             else:
00787                 if value is not None:
00788                     raise IDLError("Unexpected attribute value", aloc)
00789 
00790                 if name == 'noscript':
00791                     self.noscript = True
00792                 elif name == 'notxpcom':
00793                     self.notxpcom = True
00794                 elif name == 'implicit_jscontext':
00795                     self.implicit_jscontext = True
00796                 elif name == 'deprecated':
00797                     self.deprecated = True
00798                 elif name == 'nostdcall':
00799                     self.nostdcall = True
00800                 else:
00801                     raise IDLError("Unexpected attribute '%s'" % name, aloc)


Member Function Documentation

def xpidl.Attribute.__str__ (   self)

Definition at line 827 of file xpidl.py.

00827 
00828     def __str__(self):
00829         return "\t%sattribute %s %s\n" % (self.readonly and 'readonly ' or '',
00830                                           self.type, self.name)

def xpidl.Attribute.count (   self)

Definition at line 831 of file xpidl.py.

00831 
00832     def count(self):
00833         return self.readonly and 1 or 2

Definition at line 823 of file xpidl.py.

00823 
00824     def isScriptable(self):
00825         if not self.iface.attributes.scriptable: return False
00826         return not (self.noscript or self.notxpcom)

def xpidl.Attribute.resolve (   self,
  iface 
)

Definition at line 802 of file xpidl.py.

00802 
00803     def resolve(self, iface):
00804         self.iface = iface
00805         self.realtype = iface.idl.getName(self.type, self.location)
00806         if (self.null is not None and
00807             getBuiltinOrNativeTypeName(self.realtype) != '[domstring]'):
00808             raise IDLError("'Null' attribute can only be used on DOMString",
00809                            self.location)
00810         if (self.undefined is not None and
00811             getBuiltinOrNativeTypeName(self.realtype) != '[domstring]'):
00812             raise IDLError("'Undefined' attribute can only be used on DOMString",
00813                            self.location)
00814         if (self.nullable and
00815             getBuiltinOrNativeTypeName(self.realtype) != '[domstring]'):
00816             raise IDLError("Nullable types (T?) is supported only for DOMString",
00817                            self.location)

def xpidl.Attribute.toIDL (   self)

Definition at line 818 of file xpidl.py.

00818 
00819     def toIDL(self):
00820         attribs = attlistToIDL(self.attlist)
00821         readonly = self.readonly and 'readonly ' or ''
00822         return "%s%sattribute %s %s;" % (attribs, readonly, self.type, self.name)
        

Here is the call graph for this function:


Member Data Documentation

Definition at line 749 of file xpidl.py.

xpidl.Attribute.binaryname = None [static]

Definition at line 739 of file xpidl.py.

xpidl.Attribute.defvalue = None [static]

Definition at line 744 of file xpidl.py.

Definition at line 742 of file xpidl.py.

Definition at line 754 of file xpidl.py.

Definition at line 803 of file xpidl.py.

Definition at line 737 of file xpidl.py.

string xpidl.Attribute.kind = 'attribute' [static]

Definition at line 733 of file xpidl.py.

Definition at line 753 of file xpidl.py.

Definition at line 748 of file xpidl.py.

Definition at line 734 of file xpidl.py.

Definition at line 738 of file xpidl.py.

Definition at line 735 of file xpidl.py.

xpidl.Attribute.null = None [static]

Definition at line 740 of file xpidl.py.

Definition at line 743 of file xpidl.py.

Definition at line 736 of file xpidl.py.

Definition at line 804 of file xpidl.py.

Definition at line 747 of file xpidl.py.

xpidl.Attribute.undefined = None [static]

Definition at line 741 of file xpidl.py.


The documentation for this class was generated from the following file: