ADi-FontEngine  1.0
PDF Optimized FontEngine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FontEngine::TCode< t_bufSize > Struct Template Reference

template class to keep small memory objects More...

#include <FontEngineTCode.h>

Public Types

typedef std::pair< const
unsigned char *, unsigned int > 
TCodeData
 
typedef unsigned short TUNiValue
 
typedef std::vector< TUNiValueTUNiData
 
typedef TCodeUInt64 TLiteral64
 
typedef TCodeInt64 TDiff
 
typedef std::basic_string
< unsigned char > 
TTempBuf
 
typedef unsigned int size_type
 

Public Member Functions

 TCode ()
 default ctor More...
 
 TCode (const TCode &tvc)
 copy ctor More...
 
 TCode (const unsigned char *data, unsigned int len)
 ctor to create an object from unsigned char buffer More...
 
 TCode (const std::string &data)
 ctor to create an object from std::string More...
 
 TCode (TUNiValue us, bool is_byte=false)
 ctor to create an object from TUNiValue (should be used to keep Unicodes) Unicodes are often used as two byte objects, like U+0041 More...
 
 TCode (unsigned int num_short, const TUNiValue *us)
 ctor to create an object from pointer of TUNiValue More...
 
 TCode (TLiteral64 lit, unsigned int len)
 ctor to create an object from 64 bit integer More...
 
 ~TCode ()
 dtor More...
 
TCodeoperator= (const TCode &tvc)
 assignmment operator More...
 
void set (const std::string &data)
 function to set the object buffer from std::string More...
 
void set (const unsigned char *data, unsigned int len)
 function to set the object buffer from unsigned char buffer More...
 
void set (unsigned int num_short, const TUNiValue *us)
 function to set the object from pointer of TUNiValue More...
 
void clear ()
 reset this and clear the buffer More...
 
bool empty () const
 return the empty buffer state More...
 
size_type size () const
 return the size of buffer in byte More...
 
size_type sizeUNi () const
 return the size of buffer in unsigned short More...
 
 operator TCodeData () const
 typecast function return the buffer as TCodeData More...
 
 operator std::string () const
 typecast function return the buffer as std::string copy More...
 
TUNiValue getUShort () const
 function return a single unicode (2 bytes), size() shall return be 1 or 2 More...
 
 operator TUNiData () const
 typecast function return the buffer as unicode vector More...
 
TDiff operator- (const TCode &tvc) const
 calculate the difference between this and another object. The code size must be smaller than 8 byte (64 bit) More...
 
TCode operator+ (TDiff diff) const
 add 8 byte (64 bit) number literal to this. More...
 
const TCodeoperator++ ()
 prefix increment operator, increment 1 to this More...
 
bool operator< (const TCode &tc) const
 lesser operator More...
 
bool operator== (const TCode &tc) const
 equal operator More...
 
bool operator!= (const TCode &tc) const
 unequal operator More...
 
bool operator<= (const TCode &tc) const
 lesser equal operator More...
 
bool operator>= (const TCode &tc) const
 greater equal operator More...
 
bool operator> (const TCode &tc) const
 greater operator More...
 
TLiteral64 getliteral () const
 convert internal buffer into 64 bit number More...
 

Detailed Description

template<int t_bufSize = sizeof( unsigned char*)>
struct FontEngine::TCode< t_bufSize >

template class to keep small memory objects

Parameters
t_bufSizethe minimal byte size of internal byte buffer

Member Typedef Documentation

template<int t_bufSize = sizeof( unsigned char*)>
typedef unsigned int FontEngine::TCode< t_bufSize >::size_type
template<int t_bufSize = sizeof( unsigned char*)>
typedef std::pair< const unsigned char*, unsigned int > FontEngine::TCode< t_bufSize >::TCodeData
template<int t_bufSize = sizeof( unsigned char*)>
typedef TCodeInt64 FontEngine::TCode< t_bufSize >::TDiff
template<int t_bufSize = sizeof( unsigned char*)>
typedef TCodeUInt64 FontEngine::TCode< t_bufSize >::TLiteral64
template<int t_bufSize = sizeof( unsigned char*)>
typedef std::basic_string<unsigned char> FontEngine::TCode< t_bufSize >::TTempBuf
template<int t_bufSize = sizeof( unsigned char*)>
typedef std::vector< TUNiValue > FontEngine::TCode< t_bufSize >::TUNiData
template<int t_bufSize = sizeof( unsigned char*)>
typedef unsigned short FontEngine::TCode< t_bufSize >::TUNiValue

Constructor & Destructor Documentation

template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( )
inline

default ctor

template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( const TCode< t_bufSize > &  tvc)
inline

copy ctor

Parameters
tvcobj to copy
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( const unsigned char *  data,
unsigned int  len 
)
inline

ctor to create an object from unsigned char buffer

Parameters
datathe memory buffer to copy
lenlength of the buffer in byte
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( const std::string &  data)
inlineexplicit

ctor to create an object from std::string

Parameters
datathe std::string buffer
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( TUNiValue  us,
bool  is_byte = false 
)
inlineexplicit

ctor to create an object from TUNiValue (should be used to keep Unicodes) Unicodes are often used as two byte objects, like U+0041

Parameters
usthe TUNiValue
is_byteif this is true this object has byte size of 1, the default create a TCode object with byte size of 2
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( unsigned int  num_short,
const TUNiValue us 
)
inline

ctor to create an object from pointer of TUNiValue

Parameters
num_shortthe number of TUNiValue values or size of us array
usthe TUNiValue buffer
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::TCode ( TLiteral64  lit,
unsigned int  len 
)
inline

ctor to create an object from 64 bit integer

Parameters
litthe 64 bit integer
lenthe number of bytes used as byte size
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::~TCode ( )
inline

dtor

Member Function Documentation

template<int t_bufSize = sizeof( unsigned char*)>
void FontEngine::TCode< t_bufSize >::clear ( )
inline

reset this and clear the buffer

template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::empty ( ) const
inline

return the empty buffer state

Returns
true if the buffer is empty
template<int t_bufSize = sizeof( unsigned char*)>
TLiteral64 FontEngine::TCode< t_bufSize >::getliteral ( ) const
inline

convert internal buffer into 64 bit number

Returns
64 bit number from this
template<int t_bufSize = sizeof( unsigned char*)>
TUNiValue FontEngine::TCode< t_bufSize >::getUShort ( ) const
inline

function return a single unicode (2 bytes), size() shall return be 1 or 2

Returns
single unicode (2 bytes) from buffer
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::operator std::string ( ) const
inline

typecast function return the buffer as std::string copy

Returns
a std::string from buffer
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::operator TCodeData ( ) const
inline

typecast function return the buffer as TCodeData

Returns
a TCodeData from buffer
template<int t_bufSize = sizeof( unsigned char*)>
FontEngine::TCode< t_bufSize >::operator TUNiData ( ) const
inline

typecast function return the buffer as unicode vector

Returns
the buffer as unicode vector
template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::operator!= ( const TCode< t_bufSize > &  tc) const
inline

unequal operator

Parameters
tcthe comparison object
Returns
true if this is unequal to tc
template<int t_bufSize = sizeof( unsigned char*)>
TCode FontEngine::TCode< t_bufSize >::operator+ ( TDiff  diff) const
inline

add 8 byte (64 bit) number literal to this.

Parameters
diffobject to add to this
Returns
the sum of this and parameter diff
template<int t_bufSize = sizeof( unsigned char*)>
const TCode& FontEngine::TCode< t_bufSize >::operator++ ( )
inline

prefix increment operator, increment 1 to this

Returns
const this
template<int t_bufSize = sizeof( unsigned char*)>
TDiff FontEngine::TCode< t_bufSize >::operator- ( const TCode< t_bufSize > &  tvc) const
inline

calculate the difference between this and another object. The code size must be smaller than 8 byte (64 bit)

Parameters
tvcobject to subtraction from this
Returns
the difference
template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::operator< ( const TCode< t_bufSize > &  tc) const
inline

lesser operator

Parameters
tcthe comparison object
Returns
true if this is lesser than tc
template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::operator<= ( const TCode< t_bufSize > &  tc) const
inline

lesser equal operator

Parameters
tcthe comparison object
Returns
true if this is lesser than or equal tc
template<int t_bufSize = sizeof( unsigned char*)>
TCode& FontEngine::TCode< t_bufSize >::operator= ( const TCode< t_bufSize > &  tvc)
inline

assignmment operator

Parameters
tvcobj to copy
Returns
this
template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::operator== ( const TCode< t_bufSize > &  tc) const
inline

equal operator

Parameters
tcthe comparison object
Returns
true if this is equal to tc
template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::operator> ( const TCode< t_bufSize > &  tc) const
inline

greater operator

Parameters
tcthe comparison object
Returns
true if this is greater than or tc
template<int t_bufSize = sizeof( unsigned char*)>
bool FontEngine::TCode< t_bufSize >::operator>= ( const TCode< t_bufSize > &  tc) const
inline

greater equal operator

Parameters
tcthe comparison object
Returns
true if this is greater than or equal tc
template<int t_bufSize = sizeof( unsigned char*)>
void FontEngine::TCode< t_bufSize >::set ( const std::string &  data)
inline

function to set the object buffer from std::string

Parameters
datathe std::string buffer
template<int t_bufSize = sizeof( unsigned char*)>
void FontEngine::TCode< t_bufSize >::set ( const unsigned char *  data,
unsigned int  len 
)
inline

function to set the object buffer from unsigned char buffer

Parameters
datathe memory buffer to copy
lenlength of the buffer in byte
template<int t_bufSize = sizeof( unsigned char*)>
void FontEngine::TCode< t_bufSize >::set ( unsigned int  num_short,
const TUNiValue us 
)
inline

function to set the object from pointer of TUNiValue

Parameters
num_shortthe number of TUNiValue values or size of us array
usthe TUNiValue buffer
template<int t_bufSize = sizeof( unsigned char*)>
size_type FontEngine::TCode< t_bufSize >::size ( ) const
inline

return the size of buffer in byte

Returns
the buffer byte size
template<int t_bufSize = sizeof( unsigned char*)>
size_type FontEngine::TCode< t_bufSize >::sizeUNi ( ) const
inline

return the size of buffer in unsigned short

Returns
the buffer unsigned short size

Member Data Documentation

template<int t_bufSize = sizeof( unsigned char*)>
unsigned char* FontEngine::TCode< t_bufSize >::_hbuf

keep heap buffer if size is greater than t_bufSize

template<int t_bufSize = sizeof( unsigned char*)>
unsigned char FontEngine::TCode< t_bufSize >::_lbuf[t_bufSize]

keep local buffer if size is lesser or equal to t_bufSize


The documentation for this struct was generated from the following file:
InsideFont and ADI-FontEngine : Andreas Dippe, © 2013
http://www.insidefont.de