Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
xpcom.xpt.Interface Class Reference

List of all members.

Public Member Functions

def __init__
def __getattr__
def GetParent
def Describe_Python
def Describe

Public Attributes

 interface_info
 namespace
 methods
 constants

Detailed Description

Definition at line 76 of file xpt.py.


Constructor & Destructor Documentation

def xpcom.xpt.Interface.__init__ (   self,
  iid 
)

Definition at line 77 of file xpt.py.

00077 
00078     def __init__(self, iid):
00079         iim = xpcom._xpcom.XPTI_GetInterfaceInfoManager()
00080         try:
00081             if hasattr(iid, "upper"): # Is it a stringy thing.
00082                 item = iim.GetInfoForName(iid)
00083             else:
00084                 item = iim.GetInfoForIID(iid)
00085         except xpcom.COMException:
00086             name = getattr(iid, "name", str(iid))
00087             print "Failed to get info for IID '%s'" % (name,)
00088             raise
00089         self.interface_info = item
00090         self.namespace = "" # where does this come from?
00091         self.methods = Methods(item)
00092         self.constants = Constants(item)


Member Function Documentation

def xpcom.xpt.Interface.__getattr__ (   self,
  attr 
)

Definition at line 94 of file xpt.py.

00094 
00095     def __getattr__(self, attr):
00096         return getattr(self.interface_info, attr)

Definition at line 124 of file xpt.py.

00124 
00125     def Describe(self):
00126         # Make the IID look like xtp_dump - "(" instead of "{"
00127         iid_use = "(" + str(self.GetIID())[1:-1] + ")"
00128         s = '   - '+self.namespace+'::'+ self.GetName() + ' ' + iid_use + ':\n'
00129 
00130         parent = self.GetParent()
00131         if parent is not None:
00132             s = s + '      Parent: ' + parent.namespace + '::' + parent.GetName() + '\n'
00133         s = s + '      Flags:\n'
00134         if self.IsScriptable(): word = 'TRUE'
00135         else: word = 'FALSE'
00136         s = s + '         Scriptable: ' + word + '\n'
00137         s = s + '      Methods:\n'
00138         methods = filter(lambda m: not m.IsNotXPCOM(), self.methods)
00139         if len(methods):
00140             for m in methods:
00141                 s = s + '   ' + m.Describe() + '\n'
00142         else:
00143             s = s + '         No Methods\n'
00144         s = s + '      Constants:\n'
00145         if self.constants:
00146             for c in self.constants:
00147                 s = s + '         ' + c.Describe() + '\n'
00148         else:
00149             s = s + '         No Constants\n'
00150 
00151         return s
00152 
# A class that allows caching and iterating of methods.

Definition at line 110 of file xpt.py.

00110 
00111     def Describe_Python(self):
00112         method_reprs = []
00113         methods = filter(lambda m: not m.IsNotXPCOM(), self.methods)
00114         for m in methods:
00115             method_reprs.append(m.Describe_Python())
00116         method_joiner = "\n"
00117         methods_repr = method_joiner.join(method_reprs)
00118         return \
00119 """class %s:
00120     _com_interfaces_ = xpcom.components.interfaces.%s
00121     # If this object needs to be registered, the following 2 are also needed.
00122     # _reg_clsid_ = "{a new clsid generated for this object}"
00123     # _reg_contractid_ = "The.Object.Name"\n%s""" % (self.GetName(), self.GetIID().name, methods_repr)

Definition at line 97 of file xpt.py.

00097 
00098     def GetParent(self):
00099         try:
00100             raw_parent = self.interface_info.GetParent()
00101             if raw_parent is None:
00102                 return None
00103             return Interface(raw_parent.GetIID())
00104         except xpcom.Exception:
00105             # Parent interface is probably not scriptable - assume nsISupports.
00106             if xpcom.verbose:
00107                 # The user may be confused as to why this is happening!
00108                 print "The parent interface of IID '%s' can not be located - assuming nsISupports"
00109             return Interface(xpcom._xpcom.IID_nsISupports)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 91 of file xpt.py.

Definition at line 88 of file xpt.py.

Definition at line 90 of file xpt.py.

Definition at line 89 of file xpt.py.


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