Back to index

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

List of all members.

Public Member Functions

def __init__
def write
def __str__
def encodeflags

Static Public Member Functions

def read
def decodeflags
def read

Public Attributes

 param_index
 tag
 pointer
 reference

Static Public Attributes

tuple Tags

Static Private Attributes

tuple _descriptor = struct.Struct(">B")
dictionary _cache = {}

Detailed Description

A type representing an interface described by one of the other
arguments to the method. (InterfaceIsTypeDescriptor from the
typelib specification.)

Definition at line 310 of file xpt.py.


Constructor & Destructor Documentation

def xpt.InterfaceIsType.__init__ (   self,
  param_index,
  pointer = True,
  kwargs 
)

Definition at line 320 of file xpt.py.

00320 
00321     def __init__(self, param_index, pointer=True, **kwargs):
00322         if not pointer:
00323             raise DataError, "InterfaceIsType is not valid with pointer=False"
00324         Type.__init__(self, pointer=pointer, **kwargs)
00325         self.param_index = param_index
00326         self.tag = Type.Tags.InterfaceIs


Member Function Documentation

Definition at line 356 of file xpt.py.

00356 
00357     def __str__(self):
00358         return "InterfaceIs *"

def xpt.Type.decodeflags (   byte) [static, inherited]
Given |byte|, an unsigned uint8 containing flag bits,
decode the flag bits as described in
http://www.mozilla.org/scriptable/typelib_file.html#TypeDescriptor
and return a dict of flagname: (True|False) suitable
for passing to Type.__init__ as **kwargs.

Definition at line 151 of file xpt.py.

00151 
00152     def decodeflags(byte):
00153         """
00154         Given |byte|, an unsigned uint8 containing flag bits,
00155         decode the flag bits as described in
00156         http://www.mozilla.org/scriptable/typelib_file.html#TypeDescriptor
00157         and return a dict of flagname: (True|False) suitable
00158         for passing to Type.__init__ as **kwargs.
00159         
00160         """
00161         return {'pointer': bool(byte & 0x80),
00162                 'reference': bool(byte & 0x20),
00163                 }

def xpt.Type.encodeflags (   self) [inherited]
Encode the flag bits of this Type object. Returns a byte.

Definition at line 164 of file xpt.py.

00164 
00165     def encodeflags(self):
00166         """
00167         Encode the flag bits of this Type object. Returns a byte.
00168 
00169         """
00170         flags = 0
00171         if self.pointer:
00172             flags |= 0x80
00173         if self.reference:
00174             flags |= 0x20
00175         return flags

Here is the caller graph for this function:

def xpt.Type.read (   typelib,
  map,
  data_pool,
  offset 
) [static, inherited]
Read a TypeDescriptor at |offset| from the mmaped file |map| with
data pool offset |data_pool|. Returns (Type, next offset),
where |next offset| is an offset suitable for reading the data
following this TypeDescriptor.

Definition at line 177 of file xpt.py.

00177 
00178     def read(typelib, map, data_pool, offset):
00179         """
00180         Read a TypeDescriptor at |offset| from the mmaped file |map| with
00181         data pool offset |data_pool|. Returns (Type, next offset),
00182         where |next offset| is an offset suitable for reading the data
00183         following this TypeDescriptor.
00184         
00185         """
00186         start = data_pool + offset - 1
00187         (data,) = Type._prefixdescriptor.unpack(map[start:start + Type._prefixdescriptor.size])
00188         # first three bits are the flags
00189         flags = data & 0xE0
00190         flags = Type.decodeflags(flags)
00191         # last five bits is the tag
00192         tag = data & 0x1F
00193         offset += Type._prefixdescriptor.size
00194         t = None
00195         if tag <= Type.Tags.wchar_t_ptr or tag >= Type.Tags.UTF8String:
00196             t = SimpleType.get(data, tag, flags)
00197         elif tag == Type.Tags.Interface:
00198             t, offset = InterfaceType.read(typelib, map, data_pool, offset, flags)
00199         elif tag == Type.Tags.InterfaceIs:
00200             t, offset = InterfaceIsType.read(typelib, map, data_pool, offset, flags)
00201         elif tag == Type.Tags.Array:
00202             t, offset = ArrayType.read(typelib, map, data_pool, offset, flags)
00203         elif tag == Type.Tags.StringWithSize:
00204             t, offset = StringWithSizeType.read(typelib, map, data_pool, offset, flags)
00205         elif tag == Type.Tags.WideStringWithSize:
00206             t, offset = WideStringWithSizeType.read(typelib, map, data_pool, offset, flags)
00207         return t, offset

def xpt.InterfaceIsType.read (   typelib,
  map,
  data_pool,
  offset,
  flags 
) [static]
Read an InterfaceIsTypeDescriptor at |offset| from the mmaped
file |map| with data pool offset |data_pool|.
Returns (InterfaceIsType, next offset),
where |next offset| is an offset suitable for reading the data
following this InterfaceIsTypeDescriptor.
May return a cached value.

Definition at line 328 of file xpt.py.

00328 
00329     def read(typelib, map, data_pool, offset, flags):
00330         """
00331         Read an InterfaceIsTypeDescriptor at |offset| from the mmaped
00332         file |map| with data pool offset |data_pool|.
00333         Returns (InterfaceIsType, next offset),
00334         where |next offset| is an offset suitable for reading the data
00335         following this InterfaceIsTypeDescriptor.
00336         May return a cached value.
00337         
00338         """
00339         if not flags['pointer']:
00340             return None, offset
00341         start = data_pool + offset - 1
00342         (param_index,) = InterfaceIsType._descriptor.unpack(map[start:start + InterfaceIsType._descriptor.size])
00343         offset += InterfaceIsType._descriptor.size
00344         if param_index not in InterfaceIsType._cache:
00345             InterfaceIsType._cache[param_index] = InterfaceIsType(param_index, **flags)
00346         return InterfaceIsType._cache[param_index], offset

def xpt.InterfaceIsType.write (   self,
  typelib,
  file 
)
Write an InterfaceIsTypeDescriptor to |file|, which is assumed
to be seeked to the proper position.

Reimplemented from xpt.Type.

Definition at line 347 of file xpt.py.

00347 
00348     def write(self, typelib, file):
00349         """
00350         Write an InterfaceIsTypeDescriptor to |file|, which is assumed
00351         to be seeked to the proper position.
00352 
00353         """
00354         Type.write(self, typelib, file)
00355         file.write(InterfaceIsType._descriptor.pack(self.param_index))


Member Data Documentation

dictionary xpt.InterfaceIsType._cache = {} [static, private]

Definition at line 318 of file xpt.py.

tuple xpt.InterfaceIsType._descriptor = struct.Struct(">B") [static, private]

Definition at line 317 of file xpt.py.

Definition at line 324 of file xpt.py.

xpt.Type.pointer [inherited]

Definition at line 145 of file xpt.py.

xpt.Type.reference [inherited]

Definition at line 146 of file xpt.py.

Definition at line 325 of file xpt.py.

tuple xpt.Type.Tags [static, inherited]

Definition at line 105 of file xpt.py.


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