Public Member Functions | Protected Attributes

cygnal::SOL Class Reference

#include <sol.h>

Inheritance diagram for cygnal::SOL:
cygnal::ServerSO cygnal::ServerSO

List of all members.

Public Member Functions

 SOL ()
 ~SOL ()
size_t size () const
 Get the number of Elements in this class.
size_t fileSize () const
bool extractHeader (const std::vector< boost::uint8_t > &data)
 Extract the header from the file.
bool extractHeader (const std::string &filespec)
 Extract the header from the file.
bool formatHeader (const std::vector< boost::uint8_t > &data)
 Create the file header.
bool formatHeader (const std::string &name)
 Create the file header.
bool formatHeader (const std::string &name, int filesize)
 Create the file header.
bool writeFile ()
 Write the data to disk as a .sol file.
bool writeFile (const std::string &filespec, const std::string &objname)
 Write the data to disk as a .sol file.
bool readFile (const std::string &filespec)
 Read a .sol file from disk.
std::vector< boost::uint8_t > getHeader ()
 Get the stored copy of the header.
void addObj (boost::shared_ptr< Element > el)
 Add the AMF objects that are the data of the file.
std::vector< boost::shared_ptr
< cygnal::Element > > & 
getElements ()
 Return a reference to the elements in this object.
boost::shared_ptr< ElementgetElement (size_t size)
 Get an element referenced by index in the array.
void setFilespec (const std::string &filespec)
 Set the filespec for the .sol file. Set's the full path and file name to the .sol file to be read or written.
const std::string & getFilespec () const
 Get the filespec of the .sol file.
void setObjectName (const std::string &objname)
 Set the name of the SharedObject.
const std::string & getObjectName () const
 Get the filespec of the .sol file.
bool updateSO (boost::shared_ptr< cygnal::Element > &el)
bool updateSO (int index, boost::shared_ptr< cygnal::Element > &el)
void dump ()
 Dump the internal data of this class in a human readable form.
 SOL ()
 ~SOL ()
size_t size () const
 Get the number of Elements in this class.
size_t fileSize () const
bool extractHeader (const std::vector< boost::uint8_t > &data)
 Extract the header from the file.
bool extractHeader (const std::string &filespec)
 Extract the header from the file.
bool formatHeader (const std::vector< boost::uint8_t > &data)
 Create the file header.
bool formatHeader (const std::string &name)
 Create the file header.
bool formatHeader (const std::string &name, int filesize)
 Create the file header.
bool writeFile ()
 Write the data to disk as a .sol file.
bool writeFile (const std::string &filespec, const std::string &objname)
 Write the data to disk as a .sol file.
bool readFile (const std::string &filespec)
 Read a .sol file from disk.
std::vector< boost::uint8_t > getHeader ()
 Get the stored copy of the header.
void addObj (boost::shared_ptr< Element > el)
 Add the AMF objects that are the data of the file.
std::vector< boost::shared_ptr
< cygnal::Element > > & 
getElements ()
 Return a reference to the elements in this object.
boost::shared_ptr< ElementgetElement (size_t size)
 Get an element referenced by index in the array.
void setFilespec (const std::string &filespec)
 Set the filespec for the .sol file. Set's the full path and file name to the .sol file to be read or written.
const std::string & getFilespec () const
 Get the filespec of the .sol file.
void setObjectName (const std::string &objname)
 Set the name of the SharedObject.
const std::string & getObjectName () const
 Get the filespec of the .sol file.
bool updateSO (boost::shared_ptr< cygnal::Element > &el)
bool updateSO (int index, boost::shared_ptr< cygnal::Element > &el)
void dump ()
 Dump the internal data of this class in a human readable form.

Protected Attributes

std::vector< boost::shared_ptr
< Element > > 
_amfobjs

Detailed Description

This class is for accessing the data in SharedObject files, also called "Flash cookies". These .sol files are just a collection of AMF0 data, with a simple file header.


Constructor & Destructor Documentation

cygnal::SOL::SOL (  ) 
cygnal::SOL::~SOL (  ) 
cygnal::SOL::SOL (  ) 
cygnal::SOL::~SOL (  ) 

Member Function Documentation

void cygnal::SOL::addObj ( boost::shared_ptr< Element el  ) 

Add the AMF objects that are the data of the file.

Parameters:
el A smart pointer to the Element to add to the .sol file.
Returns:
nothing.
void cygnal::SOL::addObj ( boost::shared_ptr< Element el  ) 

Add the AMF objects that are the data of the file.

Parameters:
el A smart pointer to the Element to add to the .sol file.
Returns:
nothing.
void cygnal::SOL::dump (  ) 

Dump the internal data of this class in a human readable form.

Remarks:
This should only be used for debugging purposes.

References _amfobjs, and cygnal::swapBytes().

Referenced by main().

void cygnal::SOL::dump (  ) 

Dump the internal data of this class in a human readable form.

Remarks:
This should only be used for debugging purposes.
bool cygnal::SOL::extractHeader ( const std::string &  filespec  ) 

Extract the header from the file.

Parameters:
filespec The name and path of the .sol file to parse.
Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::extractHeader ( const std::vector< boost::uint8_t > &  data  ) 

Extract the header from the file.

Parameters:
data a reference to a vector of bytes that contains the .sol file data.
Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::extractHeader ( const std::vector< boost::uint8_t > &  data  ) 

Extract the header from the file.

Parameters:
data a reference to a vector of bytes that contains the .sol file data.
Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::extractHeader ( const std::string &  filespec  ) 

Extract the header from the file.

Parameters:
filespec The name and path of the .sol file to parse.
Returns:
true if this succeeded. false if it doesn't.
size_t cygnal::SOL::fileSize (  )  const [inline]
size_t cygnal::SOL::fileSize (  )  const [inline]
bool cygnal::SOL::formatHeader ( const std::vector< boost::uint8_t > &  data  ) 

Create the file header.

Parameters:
data a reference to a vector of bytes that contains the .sol file data.
Returns:
true if this succeeded. false if it doesn't.

Referenced by formatHeader(), and writeFile().

bool cygnal::SOL::formatHeader ( const std::string &  name  ) 

Create the file header.

Parameters:
name The name of the SharedObject for this file.
Returns:
true if this succeeded. false if it doesn't.

References formatHeader().

bool cygnal::SOL::formatHeader ( const std::vector< boost::uint8_t > &  data  ) 

Create the file header.

Parameters:
data a reference to a vector of bytes that contains the .sol file data.
Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::formatHeader ( const std::string &  name  ) 

Create the file header.

Parameters:
name The name of the SharedObject for this file.
Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::formatHeader ( const std::string &  name,
int  filesize 
)

Create the file header.

Parameters:
name The name of the SharedObject for this file.
filesize The size of the file.
Returns:
true if this succeeded. false if it doesn't.

References _, __FUNCTION__, gnash::hexify(), SOL_BLOCK_MARK, and SOL_MAGIC.

bool cygnal::SOL::formatHeader ( const std::string &  name,
int  filesize 
)

Create the file header.

Parameters:
name The name of the SharedObject for this file.
filesize The size of the file.
Returns:
true if this succeeded. false if it doesn't.
boost::shared_ptr<Element> cygnal::SOL::getElement ( size_t  size  )  [inline]

Get an element referenced by index in the array.

Parameters:
size The index of the property to retrieve.
Returns:
A smart pointer to the element at the specified location.
boost::shared_ptr<Element> cygnal::SOL::getElement ( size_t  size  )  [inline]

Get an element referenced by index in the array.

Parameters:
size The index of the property to retrieve.
Returns:
A smart pointer to the element at the specified location.
std::vector<boost::shared_ptr<cygnal::Element> >& cygnal::SOL::getElements (  )  [inline]

Return a reference to the elements in this object.

Returns:
A smart pointer to the array of properities for this .sol file.
std::vector<boost::shared_ptr<cygnal::Element> >& cygnal::SOL::getElements (  )  [inline]

Return a reference to the elements in this object.

Returns:
A smart pointer to the array of properities for this .sol file.
const std::string& cygnal::SOL::getFilespec (  )  const [inline]

Get the filespec of the .sol file.

Returns:
A string which contains the full path and name of the .sol file.
const std::string& cygnal::SOL::getFilespec (  )  const [inline]

Get the filespec of the .sol file.

Returns:
A string which contains the full path and name of the .sol file.
std::vector<boost::uint8_t> cygnal::SOL::getHeader (  )  [inline]

Get the stored copy of the header.

Returns:
A vector of raw bytes that is a binary form of the header.
std::vector<boost::uint8_t> cygnal::SOL::getHeader (  )  [inline]

Get the stored copy of the header.

Returns:
A vector of raw bytes that is a binary form of the header.
const std::string& cygnal::SOL::getObjectName (  )  const [inline]

Get the filespec of the .sol file.

Returns:
A string which contains the name of the SharedObject in the .sol file.
const std::string& cygnal::SOL::getObjectName (  )  const [inline]

Get the filespec of the .sol file.

Returns:
A string which contains the name of the SharedObject in the .sol file.
bool cygnal::SOL::readFile ( const std::string &  filespec  ) 

Read a .sol file from disk.

Parameters:
filespec The name and path of the .sol file to parse.
Returns:
true if this succeeded. false if it doesn't.

References _amfobjs, gnash::key::e, ENSUREBYTES, cygnal::AMF::extractProperty(), length, and cygnal::AMF::totalsize().

Referenced by main().

bool cygnal::SOL::readFile ( const std::string &  filespec  ) 

Read a .sol file from disk.

Parameters:
filespec The name and path of the .sol file to parse.
Returns:
true if this succeeded. false if it doesn't.
void cygnal::SOL::setFilespec ( const std::string &  filespec  )  [inline]

Set the filespec for the .sol file. Set's the full path and file name to the .sol file to be read or written.

Parameters:
filespec The name and path of the .sol file to parse.
Returns:
nothing.
void cygnal::SOL::setFilespec ( const std::string &  filespec  )  [inline]

Set the filespec for the .sol file. Set's the full path and file name to the .sol file to be read or written.

Parameters:
filespec The name and path of the .sol file to parse.
Returns:
nothing.
void cygnal::SOL::setObjectName ( const std::string &  objname  )  [inline]

Set the name of the SharedObject.

Parameters:
objname The name of the SharedObject in the .sol file.
Returns:
nothing.
void cygnal::SOL::setObjectName ( const std::string &  objname  )  [inline]

Set the name of the SharedObject.

Parameters:
objname The name of the SharedObject in the .sol file.
Returns:
nothing.
size_t cygnal::SOL::size (  )  const [inline]

Get the number of Elements in this class.

Returns:
The count of Elements.

Referenced by writeFile().

size_t cygnal::SOL::size (  )  const [inline]

Get the number of Elements in this class.

Returns:
The count of Elements.
bool cygnal::SOL::updateSO ( boost::shared_ptr< cygnal::Element > &  el  ) 
bool cygnal::SOL::updateSO ( int  index,
boost::shared_ptr< cygnal::Element > &  el 
)
bool cygnal::SOL::updateSO ( boost::shared_ptr< cygnal::Element > &  el  ) 

References _amfobjs.

bool cygnal::SOL::updateSO ( int  index,
boost::shared_ptr< cygnal::Element > &  el 
)

References _amfobjs.

bool cygnal::SOL::writeFile ( const std::string &  filespec,
const std::string &  objname 
)

Write the data to disk as a .sol file.

Parameters:
filespec The name and path of the .sol file to parse.
objname The name of the SharedObject for this file.
Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::writeFile (  ) 

Write the data to disk as a .sol file.

Returns:
true if this succeeded. false if it doesn't.
bool cygnal::SOL::writeFile ( const std::string &  filespec,
const std::string &  name 
)

Write the data to disk as a .sol file.

Parameters:
filespec The name and path of the .sol file to parse.
objname The name of the SharedObject for this file.
Returns:
true if this succeeded. false if it doesn't.
Parameters:
filespec The name and path of the .sol file to parse.
name The name of the SharedObject for this file.
Returns:
true if this succeeded. false if it doesn't.

References _amfobjs, cygnal::AMF0_NUMBER_SIZE, cygnal::Element::BOOLEAN_AMF0, cygnal::AMF::encodeProperty(), fail(), formatHeader(), cygnal::Element::NUMBER_AMF0, cygnal::Element::OBJECT_AMF0, size(), and cygnal::Element::STRING_AMF0.

bool cygnal::SOL::writeFile (  ) 

Write the data to disk as a .sol file.

Returns:
true if this succeeded. false if it doesn't.

Member Data Documentation

std::vector< boost::shared_ptr< Element > > cygnal::SOL::_amfobjs [protected]

The array of elements in this SharedObject.

Referenced by dump(), readFile(), updateSO(), and writeFile().


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