Back to index

enigmail  1.4.3
Public Member Functions
optimizejars.MyStruct Class Reference

List of all members.

Public Member Functions

def __init__
def addMember
def __getattr__
def __setattr__
def pack

Detailed Description

Definition at line 106 of file optimizejars.py.


Constructor & Destructor Documentation

def optimizejars.MyStruct.__init__ (   self,
  format,
  string_fields 
)

Definition at line 107 of file optimizejars.py.

00107 
00108     def __init__(self, format, string_fields):
00109         self.__dict__["struct_members"] = {}
00110         self.__dict__["format"] = format
00111         self.__dict__["string_fields"] = string_fields


Member Function Documentation

def optimizejars.MyStruct.__getattr__ (   self,
  item 
)

Definition at line 115 of file optimizejars.py.

00115 
00116     def __getattr__(self, item):
00117         try:
00118             return self.__dict__["struct_members"][item]
00119         except:
00120             pass
00121         print("no %s" %item)
00122         print(self.__dict__["struct_members"])
00123         raise AttributeError

def optimizejars.MyStruct.__setattr__ (   self,
  item,
  value 
)

Definition at line 124 of file optimizejars.py.

00124 
00125     def __setattr__(self, item, value):
00126         if item in self.__dict__["struct_members"]:
00127             self.__dict__["struct_members"][item] = value
00128         else:
00129             raise AttributeError

def optimizejars.MyStruct.addMember (   self,
  name,
  value 
)

Definition at line 112 of file optimizejars.py.

00112 
00113     def addMember(self, name, value):
00114         self.__dict__["struct_members"][name] = value

Definition at line 130 of file optimizejars.py.

00130 
00131     def pack(self):
00132         extra_data = ""
00133         values = []
00134         string_fields = self.__dict__["string_fields"]
00135         struct_members = self.__dict__["struct_members"]
00136         format = self.__dict__["format"]
00137         for (name,_) in format:
00138             if name in string_fields:
00139                 extra_data = extra_data + struct_members[name]
00140             else:
00141                 values.append(struct_members[name]);
        return struct.pack(format_struct(format)[0], *values) + extra_data

Here is the call graph for this function:


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