Back to index

enigmail  1.4.3
Public Member Functions | Private Attributes
xpidl.NameMap Class Reference

List of all members.

Public Member Functions

def __init__
def __getitem__
def __iter__
def __contains__
def set
def get

Private Attributes

 _d

Detailed Description

Map of name -> object. Each object must have a .name and .location property.
Setting the same name twice throws an error.

Definition at line 214 of file xpidl.py.


Constructor & Destructor Documentation

def xpidl.NameMap.__init__ (   self)

Definition at line 217 of file xpidl.py.

00217 
00218     def __init__(self):
00219         self._d = {}


Member Function Documentation

def xpidl.NameMap.__contains__ (   self,
  key 
)

Definition at line 228 of file xpidl.py.

00228 
00229     def __contains__(self, key):
00230         return key in builtinMap or key in self._d

def xpidl.NameMap.__getitem__ (   self,
  key 
)

Definition at line 220 of file xpidl.py.

00220 
00221     def __getitem__(self, key):
00222         if key in builtinMap:
00223             return builtinMap[key]
00224         return self._d[key]

def xpidl.NameMap.__iter__ (   self)

Definition at line 225 of file xpidl.py.

00225 
00226     def __iter__(self):
00227         return self._d.itervalues()

def xpidl.NameMap.get (   self,
  id,
  location 
)

Definition at line 246 of file xpidl.py.

00246 
00247     def get(self, id, location):
00248         try:
00249             return self[id]
00250         except KeyError:
00251             raise IDLError("Name '%s' not found", location)

def xpidl.NameMap.set (   self,
  object 
)

Definition at line 231 of file xpidl.py.

00231 
00232     def set(self, object):
00233         if object.name in builtinMap:
00234             raise IDLError("name '%s' is a builtin and cannot be redeclared" % (object.name), object.location)
00235         if object.name in self._d:
00236             old = self._d[object.name]
00237             if old == object: return
00238             if isinstance(old, Forward) and isinstance(object, Interface):
00239                 self._d[object.name] = object
00240             elif isinstance(old, Interface) and isinstance(object, Forward):
00241                 pass
00242             else:
00243                 raise IDLError("name '%s' specified twice. Previous location: %s" % (object.name, self._d[object.name].location), object.location)
00244         else:
00245             self._d[object.name] = object


Member Data Documentation

xpidl.NameMap._d [private]

Definition at line 218 of file xpidl.py.


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