Back to index

enigmail  1.4.3
Public Member Functions | Public Attributes | Static Public Attributes
xpidl.Dictionary Class Reference
Inheritance diagram for xpidl.Dictionary:
Inheritance graph
[legend]
Collaboration diagram for xpidl.Dictionary:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __eq__
def resolve
def isScriptable
def nativeType
def __str__
def getConst
def needsJSTypes
def countEntries

Public Attributes

 name
 attributes
 base
 members
 location
 namemap
 doccomments
 nativename
 ops
 idl

Static Public Attributes

string kind = 'dictionary'

Detailed Description

Definition at line 630 of file xpidl.py.


Constructor & Destructor Documentation

def xpidl.Dictionary.__init__ (   self,
  name,
  attlist,
  base,
  members,
  location,
  doccomments 
)

Reimplemented from xpidl.BaseInterface.

Definition at line 633 of file xpidl.py.

00633 
00634     def __init__(self, name, attlist, base, members, location, doccomments):
00635         BaseInterface.__init__(self, name, attlist, base, members, location, doccomments)


Member Function Documentation

def xpidl.BaseInterface.__eq__ (   self,
  other 
) [inherited]

Definition at line 517 of file xpidl.py.

00517 
00518     def __eq__(self, other):
00519         return self.name == other.name and self.location == other.location

def xpidl.BaseInterface.__str__ (   self) [inherited]

Definition at line 580 of file xpidl.py.

00580 
00581     def __str__(self):
00582         l = ["interface %s\n" % self.name]
00583         if self.base is not None:
00584             l.append("\tbase %s\n" % self.base)
00585         l.append(str(self.attributes))
00586         if self.members is None:
00587             l.append("\tincomplete type\n")
00588         else:
00589             for m in self.members:
00590                 l.append(str(m))
00591         return "".join(l)

def xpidl.BaseInterface.countEntries (   self) [inherited]
Returns the number of entries in the vtable for this interface. 

Definition at line 613 of file xpidl.py.

00613 
00614     def countEntries(self):
00615         ''' Returns the number of entries in the vtable for this interface. '''
00616         total = sum(member.count() for member in self.members)
00617         if self.base is not None:
00618             realbase = self.idl.getName(self.base, self.location)
00619             total += realbase.countEntries()
00620         return total

def xpidl.BaseInterface.getConst (   self,
  name,
  location 
) [inherited]

Definition at line 592 of file xpidl.py.

00592 
00593     def getConst(self, name, location):
00594         # The constant may be in a base class
00595         iface = self
00596         while name not in iface.namemap and iface is not None:
00597             iface = self.idl.getName(self.base, self.location)
00598         if iface is None:
00599             raise IDLError("cannot find symbol '%s'" % name, c.location)
00600         c = iface.namemap.get(name, location)
00601         if c.kind != 'const':
00602             raise IDLError("symbol '%s' is not a constant", c.location)
00603 
00604         return c.getValue()

def xpidl.BaseInterface.isScriptable (   self) [inherited]

Definition at line 569 of file xpidl.py.

00569 
00570     def isScriptable(self):
00571         # NOTE: this is not whether *this* interface is scriptable... it's
00572         # whether, when used as a type, it's scriptable, which is true of all
00573         # interfaces.
00574         return True

def xpidl.BaseInterface.nativeType (   self,
  calltype,
  const = False 
) [inherited]

Definition at line 575 of file xpidl.py.

00575 
00576     def nativeType(self, calltype, const=False):
00577         return "%s%s %s" % (const and 'const ' or '',
00578                             self.name,
00579                             calltype != 'in' and '* *' or '*')

def xpidl.BaseInterface.needsJSTypes (   self) [inherited]

Definition at line 605 of file xpidl.py.

00605 
00606     def needsJSTypes(self):
00607         for m in self.members:
00608             if m.kind == "attribute" and m.type == "jsval":
00609                 return True
00610             if m.kind == "method" and m.needsJSTypes():
00611                 return True
00612         return False

def xpidl.BaseInterface.resolve (   self,
  parent 
) [inherited]

Definition at line 520 of file xpidl.py.

00520 
00521     def resolve(self, parent):
00522         self.idl = parent
00523 
00524         # Hack alert: if an identifier is already present, libIDL assigns
00525         # doc comments incorrectly. This is quirks-mode extraordinaire!
00526         if parent.hasName(self.name):
00527             for member in self.members:
00528                 if hasattr(member, 'doccomments'):
00529                     member.doccomments[0:0] = self.doccomments
00530                     break
00531             self.doccomments = parent.getName(self.name, None).doccomments
00532 
00533         if self.attributes.function:
00534             has_method = False
00535             for member in self.members:
00536                 if member.kind is 'method':
00537                     if has_method:
00538                         raise IDLError("interface '%s' has multiple methods, but marked 'function'" % self.name, self.location)
00539                     else:
00540                         has_method = True
00541 
00542         parent.setName(self)
00543         if self.base is not None:
00544             realbase = parent.getName(self.base, self.location)
00545             if realbase.kind != self.kind:
00546                 raise IDLError("%s '%s' inherits from non-%s type '%s'" % (self.kind, self.name, self.kind, self.base), self.location)
00547 
00548             if self.attributes.scriptable and not realbase.attributes.scriptable:
00549                 print >>sys.stderr, IDLError("interface '%s' is scriptable but derives from non-scriptable '%s'" % (self.name, self.base), self.location, warning=True)
00550 
00551         forwardedMembers = set()
00552         for member in self.members:
00553             member.resolve(self)
00554             if member.kind is 'method' and member.forward:
00555                 forwardedMembers.add(member.forward)
00556         for member in self.members:
00557             if member.kind is 'method' and member.name in forwardedMembers:
00558                 forwardedMembers.remove(member.name)
00559         for member in forwardedMembers:
00560             raise IDLError("member '%s' on interface '%s' forwards to '%s' which is not on the interface itself" % (member.name, self.name, member.forward), self.location)
00561 
00562         # The number 250 is NOT arbitrary; this number is the maximum number of
00563         # stub entries defined in xpcom/reflect/xptcall/public/genstubs.pl
00564         # Do not increase this value without increasing the number in that
00565         # location, or you WILL cause otherwise unknown problems!
00566         if self.countEntries() > 250 and not self.attributes.builtinclass:
00567             raise IDLError("interface '%s' has too many entries" % self.name,
00568                 self.location)


Member Data Documentation

Definition at line 491 of file xpidl.py.

Definition at line 492 of file xpidl.py.

Definition at line 496 of file xpidl.py.

Definition at line 521 of file xpidl.py.

string xpidl.Dictionary.kind = 'dictionary' [static]

Definition at line 631 of file xpidl.py.

Definition at line 494 of file xpidl.py.

Definition at line 493 of file xpidl.py.

Definition at line 490 of file xpidl.py.

Definition at line 495 of file xpidl.py.

Definition at line 497 of file xpidl.py.

Definition at line 503 of file xpidl.py.


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