Public Member Functions | Static Public Member Functions | Private Attributes

nitro::BinaryData Class Reference

Class allowes to store binary data. More...

#include <utilities/binary_data.h>

Collaboration diagram for nitro::BinaryData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BinaryData (void)
 BinaryData (const char &Ch)
 BinaryData (const char *Buffer)
 BinaryData (const char *Buffer, const std::size_t &Length)
 BinaryData (const BinaryData &Data)
 operator const char * () const
BinaryData operator= (const BinaryData &Data)
void AppendData (const char &Ch)
void AppendData (const char *Buffer)
void AppendData (const std::string &Buffer)
void AppendData (const char *Buffer, const std::size_t &Length)
std::size_t GetBufferLength (void) const
const char * GetBuffer (void) const
void SetByte (std::size_t BytePos, char ByteValue)
void Release (void)
void Reserve (const std::size_t &theLength)
virtual ~BinaryData ()

Static Public Member Functions

static int GetFirstOccurance (const char *OriginalBuffer, const std::size_t OriginalBufferLength, const char *Buffer, const std::size_t BufferLength, const std::size_t StartFrom=0)
static int GetFirstOccurance (const BinaryData &c, const char *Buffer, const std::size_t BufferLength, const std::size_t StartFrom=0)
static int GetOccuranceCount (const char *OriginalBuffer, const std::size_t OriginalBufferLength, const char *Buffer, const std::size_t BufferLength)
static int GetOccuranceCount (const BinaryData &c, const char *Buffer, const std::size_t BufferLength)
static void ReplaceBuffer (BinaryData &c, const std::size_t StartPos, const std::size_t ReplaceLength, const char *Buffer, const std::size_t BufferLength)
static void ReplaceBuffer (BinaryData &c, const char *NeedleBuffer, const std::size_t NeedleBufferLength, const char *Buffer, const std::size_t BufferLength)

Private Attributes

std::vector< char > Data

Detailed Description

Class allowes to store binary data.

Author:
Dodonov A.A.

Definition at line 56 of file binary_data.h.


Constructor & Destructor Documentation

nitro::BinaryData::BinaryData ( void   ) 

Default constructor.

Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 11 of file binary_data.cpp.

                                     : Data()
        {
        }

nitro::BinaryData::BinaryData ( const char &  Ch  ) 

Constructor loads data.

Parameters:
Ch - Additing data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 15 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

        {
                try
                {
                        Data.push_back( Ch );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const char & Ch )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const char & Ch )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

nitro::BinaryData::BinaryData ( const char *  Buffer  ) 

Constructor loads binary data from NULL-terminated string.

Parameters:
Buffer - Additing data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 31 of file binary_data.cpp.

References AppendData(), nitro::exception::code(), and nitro::exception::what().

        {
                try
                {
                        // копируем без нуль символа!!!
                        AppendData( Buffer , strlen( Buffer ) + 1 );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const char * Buffer )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const char * Buffer )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

nitro::BinaryData::BinaryData ( const char *  Buffer,
const std::size_t &  Length 
)

Constructor accepts custom binary data

Parameters:
Buffer - Добавляемые данные.
Length - Длина добавляемого буффера.
Exceptions:
nitro::exception Кидает исключение с описанием ошибки.
Author:
Додонов А.А.

Definition at line 48 of file binary_data.cpp.

References AppendData(), nitro::exception::code(), and nitro::exception::what().

        {
                try
                {
                        AppendData( Buffer , Length );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const char * Buffer , const std::size_t & Length )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const char * Buffer , const std::size_t & Length )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

nitro::BinaryData::BinaryData ( const BinaryData Data  ) 

Copy-constructor.

Parameters:
Data - Initializing data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 64 of file binary_data.cpp.

References AppendData(), nitro::exception::code(), GetBuffer(), GetBufferLength(), Release(), and nitro::exception::what().

        {
                try
                {
                        Release();

                        AppendData( Data.GetBuffer() , Data.GetBufferLength() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const BinaryData & Data )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::BinaryData( const BinaryData & Data )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

nitro::BinaryData::~BinaryData (  )  [virtual]

Destructor (virtual).

Dodonov A.A.

Definition at line 269 of file binary_data.cpp.

References Release().

        {
                try
                {
                        Release();
                }
                catch( ... )
                {
                }
        }

Here is the call graph for this function:


Member Function Documentation

void nitro::BinaryData::AppendData ( const char &  Ch  ) 

Function appends data in the existing buffer.

Parameters:
Ch - Appending NULL-terminated data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 118 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

Referenced by AppendData(), nitro::CSVFile::AppendRecord(), BinaryData(), nitro::File::LoadBinDataFromFile(), nitro::INIFile::LoadINIFile(), operator=(), nitro::CSVFile::ReadRecord(), and nitro::INIFile::SaveINIFile().

        {
                try
                {
                        Data.push_back( Ch );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char & Ch )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char & Ch )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::AppendData ( const char *  Buffer  ) 

Function appends NULL-terminated data in the existing buffer.

Parameters:
Buffer - Appending NULL-terminated data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 134 of file binary_data.cpp.

References AppendData(), nitro::exception::code(), and nitro::exception::what().

        {
                try
                {
                        AppendData( Buffer , strlen( Buffer ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char * Buffer )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char * Buffer )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::AppendData ( const std::string &  Buffer  ) 

Function appends data in the existing buffer.

Parameters:
Buffer - Appending NULL-terminated data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 150 of file binary_data.cpp.

References AppendData(), nitro::exception::code(), and nitro::exception::what().

        {
                try
                {
                        AppendData( Buffer.c_str() , Buffer.size() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char * Buffer )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char * Buffer )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::AppendData ( const char *  Buffer,
const std::size_t &  Length 
)

Function appends data to an existing one.

Parameters:
Buffer - Appending data.
Length - Length of the appending data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 166 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

        {
                try
                {
                        std::size_t                             OldSize( Data.size() );
                        Data.resize( OldSize + theLength );
                        memcpy( &( Data[ OldSize ] ) , Buffer , theLength );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char * Buffer , const std::size_t & theLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::AppendData( const char * Buffer , const std::size_t & theLength )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

const char * nitro::BinaryData::GetBuffer ( void   )  const

Function provides access to stored data.

Returns:
Stored data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 200 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

Referenced by nitro::ZIPAbstraction::AddFile(), nitro::CSVFile::AppendRecord(), BinaryData(), GetFirstOccurance(), GetOccuranceCount(), nitro::INIFile::LoadINIFile(), nitro::XMLFile::LoadXML(), operator const char *(), operator=(), nitro::CSVFile::ReadRecord(), and nitro::File::SaveBinDataToFile().

        {
                try
                {
                        return( &( Data[ 0 ] ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetBuffer( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetBuffer( void )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

std::size_t nitro::BinaryData::GetBufferLength ( void   )  const

Function provides access to stored buffer's length.

Returns:
Длина хранимого буффера.
Exceptions:
nitro::exception Кидает исключение с описанием ошибки.
Author:
Додонов А.А. Function provides access to stored buffer's length.
Returns:
Length ofthe stored buffer.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 184 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

Referenced by nitro::ZIPAbstraction::AddFile(), nitro::CSVFile::AppendRecord(), BinaryData(), GetFirstOccurance(), GetOccuranceCount(), nitro::XMLFile::LoadXML(), operator=(), nitro::CSVFile::ReadRecord(), and nitro::File::SaveBinDataToFile().

        {
                try
                {
                        return( Data.size() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetBufferLength( void ) const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetBufferLength( void ) const::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

int nitro::BinaryData::GetFirstOccurance ( const BinaryData c,
const char *  Buffer,
const std::size_t  BufferLength,
const std::size_t  StartFrom = 0 
) [static]

Function validates container "c" for existance of chain of bites.

Parameters:
c - Container with data.
Buffer - Chane of bytes to test.
BufferLength - Length of the searched buffer.
StartFrom - First starting simbol in c.
Returns:

Definition at line 308 of file binary_data.cpp.

References nitro::exception::code(), GetBuffer(), GetBufferLength(), GetFirstOccurance(), and nitro::exception::what().

        {
                try
                {
                        return( GetFirstOccurance( c.GetBuffer() , c.GetBufferLength() , Buffer , BufferLength ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "GetFirstOccurance( const BinaryData & c , const char * Buffer , const std::size_t BufferLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "GetFirstOccurance( const BinaryData & c , const char * Buffer , const std::size_t BufferLength )::An error occured while executing template< class container , class raw >int GetFirstOccurance( const container & c , const raw & r )" ) , 0 ) );
                }
        }

Here is the call graph for this function:

int nitro::BinaryData::GetFirstOccurance ( const char *  OriginalBuffer,
const std::size_t  OriginalBufferLength,
const char *  Buffer,
const std::size_t  BufferLength,
const std::size_t  StartFrom = 0 
) [static]

Function validates container "c" for existance of chain of bites.

Parameters:
OriginalBuffer - Buffer with data.
OriginalBufferLength - Buffer's length.
Buffer - Chane of bytes to test.
BufferLength - Length of the searched buffer.
StartFrom - First starting simbol in c.
Returns:
Cursor of furst occurence of chain. -1 if the occurance was not found.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 280 of file binary_data.cpp.

References nitro::exception::code(), and nitro::exception::what().

Referenced by GetFirstOccurance(), GetOccuranceCount(), ReplaceBuffer(), and nitro::TemplateEngine::SetVariable().

        {
                try
                {
                        for( std::size_t i( StartFrom ) ; i < OriginalBufferLength ; i++ )
                        {
                                std::size_t             j( 0 );

                                for( ; j < BufferLength && i + j < OriginalBufferLength && OriginalBuffer[ i + j ] == Buffer[ j ] ; j++ );

                                if( j == BufferLength )
                                {
                                        return( ( int )i );
                                }
                        }

                        return( -1 );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetFirstOccurance( const char * OriginalBuffer , const std::size_t OriginalBufferLength , const char * Buffer , const std::size_t BufferLength , const std::size_t StartFrom /* = 0 */ )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetFirstOccurance( const char * OriginalBuffer , const std::size_t OriginalBufferLength , const char * Buffer , const std::size_t BufferLength , const std::size_t StartFrom /* = 0 */ )::An error occured while executing template< class container , class raw >int GetFirstOccurance( const container & c , const raw & r )" ) , 0 ) );
                }
        }

Here is the call graph for this function:

int nitro::BinaryData::GetOccuranceCount ( const char *  OriginalBuffer,
const std::size_t  OriginalBufferLength,
const char *  Buffer,
const std::size_t  BufferLength 
) [static]

Function counts all occurances of buffer Buffer.

Parameters:
OriginalBuffer - Buffer with data.
OriginalBufferLength - Buffer's length.
Buffer - Chane of bytes to test.
BufferLength - Length of the searched buffer.
Returns:
Count of occurances.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 324 of file binary_data.cpp.

References nitro::exception::code(), GetFirstOccurance(), and nitro::exception::what().

Referenced by nitro::CSVFile::AppendRecord(), and GetOccuranceCount().

        {
                try
                {
                        std::size_t                             Counter( 0 );
                        int                                             Tmp;
                        for( int i( 0 ) ; i < ( int )OriginalBufferLength ; i++ )
                        {
                                Tmp = GetFirstOccurance( OriginalBuffer , OriginalBufferLength , Buffer , BufferLength , i );

                                if( Tmp != -1 )
                                {
                                        Counter++;
                                        i = ( int )( Tmp + BufferLength - 1 );
                                }
                        }

                        return( ( int )Counter );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetOccuranceCount( const char * OriginalBuffer , const std::size_t OriginalBufferLength , const char * Buffer , const std::size_t BufferLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetOccuranceCount( const char * OriginalBuffer , const std::size_t OriginalBufferLength , const char * Buffer , const std::size_t BufferLength )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

int nitro::BinaryData::GetOccuranceCount ( const BinaryData c,
const char *  Buffer,
const std::size_t  BufferLength 
) [static]

Function counts all occurances of buffer Buffer.

Parameters:
c - Container with data.
Buffer - Chane of bytes to test.
BufferLength - Length of the searched buffer.
Returns:
Count of occurances.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 353 of file binary_data.cpp.

References nitro::exception::code(), GetBuffer(), GetBufferLength(), GetOccuranceCount(), and nitro::exception::what().

        {
                try
                {
                        return( GetOccuranceCount( c.GetBuffer() , c.GetBufferLength() , Buffer , BufferLength ) );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetOccuranceCount( const BinaryData & c , const char * Buffer , const std::size_t BufferLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::GetOccuranceCount( const BinaryData & c , const char * Buffer , const std::size_t BufferLength )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

nitro::BinaryData::operator const char * (  )  const

Function converts data into string.

Returns:
Data as a string.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 82 of file binary_data.cpp.

References nitro::exception::code(), GetBuffer(), and nitro::exception::what().

        {
                try
                {
                        return( GetBuffer() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::operator const char * () const::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::operator const char * () const::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

BinaryData nitro::BinaryData::operator= ( const BinaryData Data  ) 

Assignment operator.

Parameters:
Data - Initializing data.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 98 of file binary_data.cpp.

References AppendData(), nitro::exception::code(), GetBuffer(), GetBufferLength(), Release(), and nitro::exception::what().

        {
                try
                {
                        Release();

                        AppendData( Data.GetBuffer() , Data.GetBufferLength() );

                        return( *this );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::operator=( const BinaryData & Data )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::operator=( const BinaryData & Data )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::Release ( void   ) 

Function releases buffer with stored data.

Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 232 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

Referenced by BinaryData(), operator=(), and ~BinaryData().

        {
                try
                {
                        Data.clear();
                        Data.resize( 0 );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::Release( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::Release( void )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::ReplaceBuffer ( BinaryData c,
const char *  NeedleBuffer,
const std::size_t  NeedleBufferLength,
const char *  Buffer,
const std::size_t  BufferLength 
) [static]

Function replaces part of the buffer.

Parameters:
c - Binary data.
NeedleBuffer - Buffer to be replaced.
NeedleBufferLength - Length of the replacing buffer.
Buffer - New buffer.
BufferLength - New buffer's length.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 392 of file binary_data.cpp.

References nitro::exception::code(), GetFirstOccurance(), ReplaceBuffer(), and nitro::exception::what().

        {
                try
                {
                        int                     Cursor( 0 );
                        int                     StartFrom( 0 );

                        for( ; ( Cursor = GetFirstOccurance( c , NeedleBuffer , NeedleBufferLength , StartFrom ) ) != -1 ; )
                        {
                                ReplaceBuffer( c , Cursor , NeedleBufferLength , Buffer , BufferLength );
                                StartFrom = ( int )( Cursor + BufferLength );
                        }
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::ReplaceBuffer( BinaryData & c , const char * NeedleBuffer , const std::size_t NeedleBufferLength , const char * Buffer , const std::size_t BufferLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::ReplaceBuffer( BinaryData & c , const char * NeedleBuffer , const std::size_t NeedleBufferLength , const char * Buffer , const std::size_t BufferLength )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::ReplaceBuffer ( BinaryData c,
const std::size_t  StartPos,
const std::size_t  ReplaceLength,
const char *  Buffer,
const std::size_t  BufferLength 
) [static]

Function replaces part of the buffer.

Parameters:
c - Binary data.
StartPos - Position of the replacing part's beginning.
ReplaceLength - Length of the replacing part.
Buffer - New buffer.
BufferLength - New buffer's length.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 369 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

Referenced by nitro::INIFile::LoadINIFile(), nitro::CSVFile::ReadRecord(), ReplaceBuffer(), and nitro::TemplateEngine::SetVariable().

        {
                try
                {
                        c.Data.erase( c.Data.begin() + StartPos , c.Data.begin() + StartPos + ReplaceLength );

                        std::insert_iterator< std::vector< char > >             InsertIterator( c.Data , c.Data.begin() + StartPos );

                        for( std::size_t i( 0 ) ; i < BufferLength ; i++ )
                        {
                                *InsertIterator = Buffer[ i ];
                        }
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "ReplaceBuffer( BinaryData & c , std::size_t StartPos , std::size_t ReplaceLength , const char * Buffer , const std::size_t BufferLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "ReplaceBuffer( BinaryData & c , std::size_t StartPos , std::size_t ReplaceLength , const char * Buffer , const std::size_t BufferLength )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::Reserve ( const std::size_t &  theLength  ) 

Function reserves data.

Parameters:
theLength - Amount of data to reserve.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 249 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

Referenced by nitro::CSVFile::AppendRecord().

        {
                try
                {
                        if( Data.size() < theLength )
                        {
                                Data.reserve( theLength );
                        }
                        Data.resize( 0 );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::Reserve( const std::size_t & theLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::Reserve( const std::size_t & theLength )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:

void nitro::BinaryData::SetByte ( std::size_t  BytePos,
char  ByteValue 
)

Function sets byte in buffer.

Parameters:
BytePos - Position of the setting byte.
ByteValue - Value of the setting byte.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 216 of file binary_data.cpp.

References nitro::exception::code(), Data, and nitro::exception::what().

        {
                try
                {
                        Data[ BytePos ] = ByteValue;
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "BinaryData::SetByte( std::size_t BytePos , char ByteValue )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "BinaryData::SetByte( std::size_t BytePos , char ByteValue )::An error occured" ) , 0 ) );
                }
        }

Here is the call graph for this function:


Member Data Documentation

std::vector< char > nitro::BinaryData::Data [private]

Buffer for stored data.

Author:
Dodonov A.A.

Definition at line 628 of file binary_data.h.

Referenced by AppendData(), BinaryData(), GetBuffer(), GetBufferLength(), Release(), ReplaceBuffer(), Reserve(), and SetByte().


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

Generated by  doxygen 1.6.1