Panda3D
Public Member Functions | Public Attributes | Static Public Attributes

CArchive Class Reference

Inheritance diagram for CArchive:
Archive

List of all members.

Public Member Functions

def __init__
def add
def build
 Building.
def checkmagic
def contents
def extract
def get_code
 This is what is called by FuncImporter ####### Since an Archive is flat, we ignore parent and modname.
def loadtoc
def openEmbedded
def save_toc
def save_trailer
def update_headers

Public Attributes

 len
 lib
 path
 pkgstart
 pymagic
 start
 toc
 toclen
 tocpos

Static Public Attributes

int HDRLEN = 0
int LEVEL = 9
string MAGIC = 'MEI\014\013\012\013\015'
 os = None
int TOCPOS = 8
 TOCTMPLT = CTOC
int TRLLEN = 20
string TRLSTRUCT = '8siii'

Detailed Description

An Archive subclass that an hold arbitrary data.

   Easily handled from C or from Python.

Constructor & Destructor Documentation

def __init__ (   self,
  path = None,
  start = 0,
  len = 0 
)
Constructor.

   PATH is path name of file (create an empty CArchive if path is None).
   START is the seekposition within PATH.
   LEN is the length of the CArchive (if 0, then read till EOF). 

Member Function Documentation

def add (   self,
  entry 
)
Add an ENTRY to the CArchive.

   ENTRY must have:
 entry[0] is name (under which it will be saved).
 entry[1] is fullpathname of the file.
 entry[2] is a flag for it's storage format (0==uncompressed,
 1==compressed, 2==Python source format)
 entry[3] is the entry's type code.

Reimplemented from Archive.

def build (   self,
  path,
  lTOC 
) [inherited]

Building.

Top level method - shouldn't need overriding #######

Create an archive file of name PATH from LTOC.

   lTOC is a 'logical TOC' - a list of (name, path, ...)
   where name is the internal (import) name,
   and path is a file to get the object from, eg './a.pyc'.
def checkmagic (   self)
Verify that self is a valid CArchive.

Magic signature is at end of the archive.

Reimplemented from Archive.

def contents (   self)
Return the names of the entries

Reimplemented from Archive.

def extract (   self,
  name 
)
Get the contents of an entry.

   NAME is an entry name.
   Return the tuple (ispkg, contents).
   For non-Python resoures, ispkg is meaningless (and 0).
   Used by the import mechanism.

Reimplemented from Archive.

def get_code (   self,
  parent,
  modname,
  fqname 
) [inherited]

This is what is called by FuncImporter ####### Since an Archive is flat, we ignore parent and modname.

The import hook.

   Called by imputil.FunctionImporter.
   Override extract to tune getting code from the Archive.
def loadtoc (   self)
Load the table of contents into memory.

Reimplemented from Archive.

def openEmbedded (   self,
  name 
)
Open a CArchive of name NAME embedded within this CArchive.
def save_toc (   self,
  tocpos 
)
Save the table of contents to disk.

Reimplemented from Archive.

def save_trailer (   self,
  tocpos 
)
Save the trailer to disk.

   CArchives can be opened from the end - the trailer points
   back to the start. 

Reimplemented from Archive.

def update_headers (   self,
  tocpos 
) [inherited]
Update any header data.

   Default header is  MAGIC + Python's magic + tocpos

Member Data Documentation

int HDRLEN = 0 [static]

Reimplemented from Archive.

len
int LEVEL = 9 [static]
lib [inherited]
string MAGIC = 'MEI\014\013\012\013\015' [static]

Reimplemented from Archive.

os = None [static, inherited]

Reimplemented in ZlibArchive.

path [inherited]
pymagic [inherited]
start [inherited]
toc

Reimplemented from Archive.

int TOCPOS = 8 [static, inherited]

Reimplemented in ZlibArchive.

TOCTMPLT = CTOC [static]

Reimplemented from Archive.

int TRLLEN = 20 [static]

Reimplemented from Archive.

string TRLSTRUCT = '8siii' [static]
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties