newspeoplefor developersdocumentationdownloads

nNpkFileServer Class Reference
[NPK File Management]

#include <nnpkfileserver.h>

Inheritance diagram for nNpkFileServer:

nFileServer2 nRoot nObject nNode nReferenced nSignalEmitter List of all members.

Detailed Description

Implement reading from npk files.

See also nNpkFileServer Script Interface

npk file format:

    # header
    block HEADER {
        uint32 'NPK0'       // magic number
        uint32 blockLen     // number of following bytes in block
        uint32 dataOffset   // byte offset of data block from beginning of file
    }

    # table of contents, sequence of blocks of 3 types:
    block DIR {
        uint32 'DIR_'               // magic number of directory block
        uint32 blockLen             // number of following bytes in block
        uint16 dirNameLength        // length of the following name
        char[] dirName              // name of directory
    }

    block FILE {
        uint32 'FILE'               // magic number of file block
        uint32 blockLen             // number of following bytes in block
        uint32 fileOffset           // start of file data inside data block
        uint32 fileLength           // length of file data in bytes
        uint16 fileNameLength       // length of the following name
        char[] fileName             // name of file
    }

    block ENDOFDIR {
        uint32 'DEND'               // magic number of end of dir block
        uint32 blockLen             // number of following bytes in block (0)
    }

    # the data block
    block DATA {
        uint32 'DATA'               // magic number of data block
        uint32 blockLen             // number of following bytes in block
        char[] data                 // the data
    }
    

(C) 2002 RadonLabs GmbH

Definition at line 58 of file nnpkfileserver.h.


Public Member Functions

 nNpkFileServer ()
 constructor
virtual ~nNpkFileServer ()
 destructor
virtual nFileNewFileObject () const
 create new nNpkFile object
virtual nDirectoryNewDirectoryObject () const
 create new nNpkDirectory object
virtual bool ParseNpkFile (const nString &path)
 parse one npk file
virtual int ParseDirectory (const nString &dirName, const nString &extension)
 parse the given directory for npk files
virtual void ReleaseNpkFiles (const nString &pattern)
 release npk file wrappers matching pattern
virtual bool Pack (const nString &rootPath, const nString &dirName, const nString &npkName, bool noTopLevelName)
 pack a directory into a new NPK file

Friends

class nNpkFile
class nNpkDirectory

Constructor & Destructor Documentation

nNpkFileServer::nNpkFileServer  ) 
 

constructor

Definition at line 18 of file nnpkfileserver_main.cc.

nNpkFileServer::~nNpkFileServer  )  [virtual]
 

destructor

Definition at line 26 of file nnpkfileserver_main.cc.


Member Function Documentation

nFile * nNpkFileServer::NewFileObject  )  const [virtual]
 

create new nNpkFile object

Reimplemented from nFileServer2.

Definition at line 40 of file nnpkfileserver_main.cc.

nDirectory * nNpkFileServer::NewDirectoryObject  )  const [virtual]
 

create new nNpkDirectory object

Reimplemented from nFileServer2.

Definition at line 51 of file nnpkfileserver_main.cc.

bool nNpkFileServer::ParseNpkFile const nString path  )  [virtual]
 

parse one npk file

Parses a single npk file and adds it to the list of npk files.

Definition at line 63 of file nnpkfileserver_main.cc.

int nNpkFileServer::ParseDirectory const nString dirName,
const nString extension
[virtual]
 

parse the given directory for npk files

Scan through a directory for npk files and create a nNpkFileWrapper object for each npk file found, and open the npk files. Returns the number of npk files found.

Definition at line 86 of file nnpkfileserver_main.cc.

void nNpkFileServer::ReleaseNpkFiles const nString pattern  )  [virtual]
 

release npk file wrappers matching pattern

This releases all NPK file wrappers whose filename matches a given pattern.

Definition at line 212 of file nnpkfileserver_main.cc.

bool nNpkFileServer::Pack const nString rootPath,
const nString dirName,
const nString npkName,
bool  noTopLevelName
[virtual]
 

pack a directory into a new NPK file

Pack a directory into new NPK file. The directory will *NOT* be removed after the operation. NOTE: if the "noRootName" argument is set, there will be no directory name stored in the npk file for the toplevel directory, instead, the current filename of the npk file (without extension) will be used for the toplevel directory's name when reading from the npk file. Use with care, the default should be false.

Parameters:
rootPath path to directory where src directory is located
dirName single-component-directory name inside root dir
npkName filename of npk file
noTopLevelName do not fill out the toplevel directory name when packing

Definition at line 200 of file nnpkfileserver_main.cc.


Friends And Related Function Documentation

friend class nNpkFile [friend]
 

Definition at line 60 of file nnpkfileserver.h.

friend class nNpkDirectory [friend]
 

Definition at line 61 of file nnpkfileserver.h.


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

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.