Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
SoftwareAndServices::Library::iCalendar::binary Class Reference
+ Inheritance diagram for SoftwareAndServices::Library::iCalendar::binary:
+ Collaboration diagram for SoftwareAndServices::Library::iCalendar::binary:

Public Types

enum  BinaryEncodingType { UnknownEncoding_t = UnknownToken_t, Base64Encoding_t = BASE64, EightBitEncoding_t = EIGHT_BIT }
 The type of binary encoding. More...
 
enum  quote_errors { NO_END_QUOTE_e = 1, NO_DATA_PROVIDED_e, UNKNOWN_BACKSLASH_ESCAPE_e, NO_TERM_FOUND_e }
 These are C++ objects that can be thrown as errors. More...
 

Public Member Functions

 binary (unsigned char *data=NULL, const size_t octetCount=0)
 binary Constructor - Initialization is optional. More...
 
virtual ~binary ()
 binary Destructor. More...
 
virtual InstanceCount_t decInstance () const
 Decrement the instance. More...
 
bool decode (const char *buffer, BinaryEncodingType encoding=Base64Encoding_t)
 Decode the data, if not already decoded. More...
 
bool encode (BinaryEncodingType desiredType)
 Encode the data, if not already encoded. More...
 
void * get (size_t *size) const
 Get a pointer to the blob of data. More...
 
const valuegetData () const
 Get the pointer to the data being stored. More...
 
virtual InstanceCount_t getInstance () const
 
Tokens_t getType () const
 Get the type of data being stored. More...
 
const char * getXValueType () const
 Get the type of data being stored. More...
 
virtual InstanceCount_t incInstance () const
 Increment the instance. More...
 
void operator delete (void *data)
 This class uses instance counting, this entry point overloads the default delete() operator in order to correctly track the instance. More...
 
bool operator!= (const binary &Other)
 binary != compare operator. More...
 
bool operator!= (const binary *Other)
 binary != compare operator. More...
 
bool operator== (const binary &Other)
 binary == compare operator. More...
 
bool operator== (const binary *Other)
 binary == compare operator. More...
 
bool parse (Parse &in, BinaryEncodingType encoding, component *errors)
 Parse a RFC-iCalendar object that contains a BINARY value. More...
 
void setData (void *DataPtr)
 Set the data to the data being stored. More...
 
void setType (Tokens_t Token)
 Set the type of data being stored. More...
 
void setXValueType (const char *xValType)
 Set the type of data being stored - non-standard types only. More...
 
virtual bool sprint (String *Results) const
 Print the object in RFC-iCalendar format. More...
 

Static Public Member Functions

static char * addQuotes (const char *text)
 Add quotes to the value. More...
 
static char * escape (const char *text)
 Escape a value and return an RFC-iCalendar value encoded. More...
 
static char * removeQuotes (const char *text)
 Remove quotes from a user supplied value so that the raw data can be stored. More...
 
static bool sprintTokensAsText (String *Results, Tokens_t token)
 Called by text2token() to get the token name as a String. More...
 
static char * unescape (const char *text, const char *term)
 Un-escape a value and return what a user originally entered. More...
 

Static Public Attributes

static const char ** tokenStrings
 A list of strings for the names of tokens. More...
 

Protected Attributes

unsigned char * _blob
 The blob of data. More...
 
BinaryEncodingType _encoding
 The encoding of this data. More...
 
size_t _size
 The size of data that _blob points to. More...
 

Detailed Description

Definition at line 78 of file binary.hpp.

Member Enumeration Documentation

◆ BinaryEncodingType

The type of binary encoding.

Definition at line 88 of file binary.hpp.

◆ quote_errors

These are C++ objects that can be thrown as errors.

Definition at line 204 of file BaseValueType.hpp.

Constructor & Destructor Documentation

◆ binary()

SoftwareAndServices::Library::iCalendar::binary::binary ( unsigned char *  data = NULL,
const size_t  octetCount = 0 
)

binary Constructor - Initialization is optional.

If data is supplied then octetCount must be supplied.

Parameters
dataA pointer to the BINARY data.
octetCountThe number of bytes pointed to by data. If data is provided, octetCount must be provided.

◆ ~binary()

virtual SoftwareAndServices::Library::iCalendar::binary::~binary ( )
virtual

binary Destructor.

Member Function Documentation

◆ addQuotes()

static char* SoftwareAndServices::Library::iCalendar::BaseValueType::addQuotes ( const char *  text)
staticinherited

Add quotes to the value.

Caller MUST free results.

Parameters
textThe text to be de-quoted.
Returns
The de-quoted data.

◆ decInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< BaseValueType >::decInstance ( ) const
inlinevirtualinherited

Decrement the instance.

Returns
The instance count, after decrementing it.

Reimplemented in SoftwareAndServices::Library::iCalendar::date_time.

Definition at line 129 of file instance.hpp.

◆ decode()

bool SoftwareAndServices::Library::iCalendar::binary::decode ( const char *  buffer,
BinaryEncodingType  encoding = Base64Encoding_t 
)

Decode the data, if not already decoded.

A NO-OP if already decoded.

Parameters
bufferA blob of data to be decoded.
theencoding type to use.
Returns
TRUE if decoded.

◆ encode()

bool SoftwareAndServices::Library::iCalendar::binary::encode ( BinaryEncodingType  desiredType)

Encode the data, if not already encoded.

A NO-OP if already encoded.

Parameters
desiredTypeis one of Base64Encoding_t or EightBitEncoding_t.
Returns
TRUE if the data was encoded correctly.

◆ escape()

static char* SoftwareAndServices::Library::iCalendar::BaseValueType::escape ( const char *  text)
staticinherited

Escape a value and return an RFC-iCalendar value encoded.

Caller MUST free results.

Parameters
textthe text to escape.
Returns
The escaped string.

◆ get()

void* SoftwareAndServices::Library::iCalendar::binary::get ( size_t *  size) const

Get a pointer to the blob of data.

Parameters
sizeA pointer to a location that will be update with the size of the data blob that is returned. it will be set to zero if there is no data.
Returns
A pointer to the data blob for this object. NULL if not set.

◆ getData()

const value* SoftwareAndServices::Library::iCalendar::BaseValueType::getData ( ) const
inherited

Get the pointer to the data being stored.

Returns
Pointer to the data being stored.

◆ getInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< BaseValueType >::getInstance ( ) const
inlinevirtualinherited
Returns
The current instance count.

Definition at line 118 of file instance.hpp.

◆ getType()

Tokens_t SoftwareAndServices::Library::iCalendar::BaseValueType::getType ( ) const
inherited

Get the type of data being stored.

If it returns Unknown_t, call getXType()

Returns
The type of data being stored.
See also
getXValueType()

◆ getXValueType()

const char* SoftwareAndServices::Library::iCalendar::BaseValueType::getXValueType ( ) const
inherited

Get the type of data being stored.

If it returns NULL, call getType()

Returns
The type of data being stored as a string.
See also
geXValueType()

◆ incInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< BaseValueType >::incInstance ( ) const
inlinevirtualinherited

Increment the instance.

Returns
The instance value, after incrementing it.

Reimplemented in SoftwareAndServices::Library::iCalendar::date_time.

Definition at line 109 of file instance.hpp.

◆ operator delete()

void SoftwareAndServices::Library::iCalendar::BaseValueType::operator delete ( void *  data)
inherited

This class uses instance counting, this entry point overloads the default delete() operator in order to correctly track the instance.

◆ operator!=() [1/2]

bool SoftwareAndServices::Library::iCalendar::binary::operator!= ( const binary Other)

binary != compare operator.

Parameters
OtherThe other binary object to compare to.
Returns
TRUE when they are NOT equal.

◆ operator!=() [2/2]

bool SoftwareAndServices::Library::iCalendar::binary::operator!= ( const binary Other)

binary != compare operator.

Parameters
OtherThe other binary object to compare to.
Returns
TRUE when they are NOT equal.

◆ operator==() [1/2]

bool SoftwareAndServices::Library::iCalendar::binary::operator== ( const binary Other)

binary == compare operator.

Parameters
OtherThe other binary object to compare to.
Returns
TRUE when they are equal.

◆ operator==() [2/2]

bool SoftwareAndServices::Library::iCalendar::binary::operator== ( const binary Other)

binary == compare operator.

Parameters
OtherThe other binary object to compare to.
Returns
TRUE when they are equal.

◆ parse()

bool SoftwareAndServices::Library::iCalendar::binary::parse ( Parse in,
BinaryEncodingType  encoding,
component errors 
)

Parse a RFC-iCalendar object that contains a BINARY value.

Parameters
inAn initialized object that contains an RFC-iCalendar BINARY data.
encodingThe encoding type to use.
errorsA pointer to an object that will have any RFC-iCalendar errors.
Returns
TRUE if it parsed correctly. If FALSE, then errors will be updated to include any errors.

◆ removeQuotes()

static char* SoftwareAndServices::Library::iCalendar::BaseValueType::removeQuotes ( const char *  text)
staticinherited

Remove quotes from a user supplied value so that the raw data can be stored.

Caller MUST free results.

Parameters
textThe text to be de-quoted. No harm if it does not already contain quotes.
Returns
The de-quoted data.

◆ setData()

void SoftwareAndServices::Library::iCalendar::BaseValueType::setData ( void *  DataPtr)
inherited

Set the data to the data being stored.

Parameters
DataPtrPointer to the data.

◆ setType()

void SoftwareAndServices::Library::iCalendar::BaseValueType::setType ( Tokens_t  Token)
inherited

Set the type of data being stored.

If the type is not a predefined one, call setXValueType()

Parameters
TokenThe type of data being stored.
See also
setXValueType()

◆ setXValueType()

void SoftwareAndServices::Library::iCalendar::BaseValueType::setXValueType ( const char *  xValType)
inherited

Set the type of data being stored - non-standard types only.

If the type is a predefined one, call setValueType()

Parameters
xValTypeThe type of data being stored as a string.
See also
setValueType()

◆ sprint()

virtual bool SoftwareAndServices::Library::iCalendar::binary::sprint ( String Results) const
virtual

Print the object in RFC-iCalendar format.

Parameters
ResultsAppend the results to Results.
Returns
TRUE when data was appended.

Implements SoftwareAndServices::Library::iCalendar::BaseValueType.

◆ sprintTokensAsText()

static bool SoftwareAndServices::Library::iCalendar::BaseValueType::sprintTokensAsText ( String Results,
Tokens_t  token 
)
staticinherited

Called by text2token() to get the token name as a String.

Parameters
ResultsThe token name as a String.
tokenThe token to convert to a string.
Returns
TRUE when something appended to Results.

◆ unescape()

static char* SoftwareAndServices::Library::iCalendar::BaseValueType::unescape ( const char *  text,
const char *  term 
)
staticinherited

Un-escape a value and return what a user originally entered.

Caller MUST delete results when done. The string would have been encoded as an RFC-iCalendar value encoding.

Parameters
textthe text to un-escape.
termA string to be used as the data separator. This value is passed to strpbrk().
Returns
The un-escaped string.

Member Data Documentation

◆ _blob

unsigned char* SoftwareAndServices::Library::iCalendar::binary::_blob
protected

The blob of data.

Definition at line 214 of file binary.hpp.

◆ _encoding

BinaryEncodingType SoftwareAndServices::Library::iCalendar::binary::_encoding
protected

The encoding of this data.

Definition at line 209 of file binary.hpp.

◆ _size

size_t SoftwareAndServices::Library::iCalendar::binary::_size
protected

The size of data that _blob points to.

Definition at line 219 of file binary.hpp.

◆ tokenStrings

const char** SoftwareAndServices::Library::iCalendar::BaseValueType::tokenStrings
staticinherited

A list of strings for the names of tokens.

The token value used as an offset into this array is the name of the token as a string.

The strings "X_COMP", "X_PROP", and "XPARAM" ARE included. Strings matching X_COMP, X_PROP, and XPARAM values are not included.

Definition at line 144 of file BaseValueType.hpp.


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