Public Types | Public Member Functions
Tonido::Util::VirtualFS Class Reference

Treats a Zip File as a simple file system. More...

List of all members.

Public Types

typedef boost::shared_ptr
< VirtualFS
SharedPtr

Public Member Functions

 VirtualFS ()
 Default contructor.
 ~VirtualFS ()
 Default Dtor.
void setArchive (const std::string &aZipFileName)
 Set the archive to use.
const std::string & getArchive () const
 Get the Archive in use.
void getArchiveMembers (std::vector< std::string > &a_arcMembers, const std::string &a_filter)
 Get Archive Elements.
void readFile (const std::string &aFileName, std::ostringstream &a_out, uint32_bt &a_FileDataLen)
 Read a file from the archive.
void readFileGZ (const std::string &aFileName, std::ostringstream &a_out, uint32_bt &a_FileDataLen)

Detailed Description

Treats a Zip File as a simple file system.

    VirtualFS archive;

    try
    {
        archive.setArchive("resource.zip");

        std::ostringstream data;
        uint32_bt len = 0;
        archive.readFile("test.css", data, len);
        m_cssData = data.str();    
    }
    catch(Poco::Exception& exc)
    {
                Poco::Logger::get(_LOGSUBSYSTEM_).error(exc.what()); 
    }
    catch(...)
    {
        Poco::Logger::get(_LOGSUBSYSTEM_).error("Unknown Exception loading CSS"); 
    }

Constructor & Destructor Documentation

Tonido::Util::VirtualFS::VirtualFS ( )

Default contructor.

Just create object with no data


Member Function Documentation

void Tonido::Util::VirtualFS::getArchiveMembers ( std::vector< std::string > &  a_arcMembers,
const std::string &  a_filter 
)

Get Archive Elements.

Get the member names in archive. If the file is present, then data will be stored in the list. Throws Exception on failure

Parameters:
a_arcMembers - OUTPUT PARAM: members list in the archive
Returns:
: true if the function succeeds, false otherwise
void Tonido::Util::VirtualFS::readFile ( const std::string &  aFileName,
std::ostringstream &  a_out,
uint32_bt &  a_FileDataLen 
)

Read a file from the archive.

Read a file from the archive. If the file is present, then data will be stored in the FileData array and the FileDataLen will be updated to the size of the array Throws Exception on failure

Parameters:
aFileName - Name of file to read from the archive
a_out - OUTPUT PARAM: File data returned to user
a_FileDataLen - OUTPUT PARAM: Length of the File
Returns:
: true if the function succeeds, false otherwise

Generated on Wed Oct 12 2011 21:46:54. © CodeLathe LLC 2007-2011. All Rights Reserved.