Base class from which all file struct types are derived.
The StructBase class implements the basic struct interface:
it will initialize all attributes using the class interface
using the _attrs class variable, represent them as strings, and so on.
The class variable _attrs must be declared every derived class
interface.
Each item in the class _attrs list stores the information about
the attribute as stored for instance in the xml file, and the
_<name>_value_ instance variable stores the actual attribute
instance.
Direct access to the attributes is implemented using a <name>
property which invokes the get_attribute and set_attribute
functions, as demonstrated below.
See the pyffi.XmlHandler class for a more advanced example.
|
__init__(self,
template=None,
argument=None,
parent=None)
The constructor takes a tempate: any attribute whose type,
or template type, is type(None) - which corresponds to
TEMPLATE in the xml description - will be replaced by this
type. |
source code
|
|
|
deepcopy(self,
block)
Copy attributes from a given block (one block class must be a
subclass of the other). |
source code
|
|
|
|
|
read(self,
stream,
data)
Read structure from stream. |
source code
|
|
|
write(self,
stream,
data)
Write structure to stream. |
source code
|
|
|
fix_links(self,
data)
Fix links in the structure. |
source code
|
|
|
get_links(self,
data=None)
Get list of all links in the structure. |
source code
|
|
|
get_strings(self,
data)
Get list of all strings in the structure. |
source code
|
|
|
|
|
get_size(self,
data=None)
Calculate the structure size in bytes. |
source code
|
|
|
get_hash(self,
data=None)
Calculate a hash for the structure, as a tuple. |
source code
|
|
|
|
|
_get_filtered_attribute_list(self,
data=None)
Generator for listing all 'active' attributes, that is,
attributes whose condition evaluates True, whose version
interval contains C{version}, and whose user version is
C{user_version}. |
source code
|
|
|
get_attribute(self,
name)
Get a (non-basic) attribute. |
source code
|
|
|
set_attribute(self,
value,
name)
Set a (non-basic) attribute. |
source code
|
|
|
get_basic_attribute(self,
name)
Get a basic attribute. |
source code
|
|
|
set_basic_attribute(self,
value,
name)
Set the value of a basic attribute. |
source code
|
|
|
get_template_attribute(self,
name)
Get a template attribute. |
source code
|
|
|
set_template_attribute(self,
value,
name)
Set the value of a template attribute. |
source code
|
|
|
tree(self)
A generator for parsing all blocks in the tree (starting from and
including C{self}). |
source code
|
|
generator yielding DetailNodes
|
|
generator yielding strs
|
|
|
|
|
get_global_child_nodes(self,
edge_filter=(True, True))
Generator which yields all children of this item in the
global view, of given edge type (default is edges of type 0). |
source code
|
|
Inherited from utils.graph.GlobalNode :
get_global_child_edge_types ,
get_global_iterator
Inherited from utils.graph.DetailNode :
get_detail_child_edge_types ,
get_detail_display ,
get_detail_iterator
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|