Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
SoftwareAndServices::Library::iCalendar::iCalError Class Reference

This class contains, processes, and formats iCalendar errors. More...

#include </home/doug/src/SoftwareAndServices/libSaSiCalendar/iCalError.hpp>

+ Inheritance diagram for SoftwareAndServices::Library::iCalendar::iCalError:
+ Collaboration diagram for SoftwareAndServices::Library::iCalendar::iCalError:

Public Types

typedef const Tree_t< Error > * const_Tree
 A const_Tree is a (const Tree_t<T>*) More...
 
enum  LocalErrno { ACCESS_DENIED = 1045, UNKNOWN_HOST = 2005 }
 Status of error message. More...
 
typedef Tree_t< Error > * Tree
 A Tree is a (Tree_t<T>*) More...
 
typedef void(* TreeAction_fn_t) (const Tree_t< Error > **, VISIT Leaf, int Depth)
 Perform action on Tree_t<T> More...
 
typedef int(* TreeCompare_fn_t) (const Error *One, const Error *Two)
 Tree compare function. More...
 
typedef void(* TreeFree_fn_t) (Tree_t< Error > *TreeToFree)
 Free Tree_t. More...
 

Public Member Functions

 iCalError (const char *errorCode)
 Constructor. More...
 
virtual ~iCalError ()
 Destructor. More...
 
void addCompName (Tokens_t comp)
 Notify this class that comp is the component being reported as relevant to this error. More...
 
void addErrorCode (unsigned int err)
 Add an additional error code. More...
 
void addParamName (Tokens_t param)
 Notify this class that param is the parameter being reported as relevant to this error. More...
 
void addPropName (Tokens_t prop)
 Notify this class that prop is the property being reported as relevant to this error. More...
 
void addText (const char *newText)
 Add RFC-iTIP 'additional' text to this error. More...
 
void addXCompName (const char *xname, size_t Length=0)
 Notify this class that xname is the component being reported as relevant to this error where the component name is a string unknown to this implementation. More...
 
void addXParamName (const char *xname, size_t Length=0)
 Notify this class that xname is the parameter being reported as relevant to this error where the parameter name is a string unknown to this implementation. More...
 
void addXPropName (const char *xname, size_t Length=0)
 Notify this class that xname is the property being reported as relevant to this error where the property name is a string unknown to this implementation. More...
 
virtual InstanceCount_t decInstance () const
 Decrement the instance. More...
 
virtual InstanceCount_t decInstance () const
 Decrement the instance. More...
 
Tree_t< Error > * Find (Tree_t< Error > *Rootp, const Tree_t< Error > *ToFind, TreeCompare_fn_t Cmp)
 Tree find, for locating cached messages. More...
 
int GetCharOffset () const
 
const char * GetCombinedGuid ()
 
Tokens_t getCompName () const
 Get the name of the component associated with this error. More...
 
const DateTimeGetDateTime () const
 
int GetErrno (unsigned int MsgNum, const char *DefaultMsg, const char *Locale=nullptr)
 Get the error ID in the default message database. More...
 
int GetErrno () const
 Get this objcet error number. More...
 
std::vector< int > * getErrorCodes () const
 Get an array of error codes. More...
 
const char * getErrorMessage () const
 Get the human readable error message. More...
 
const char * GetGuid ()
 
virtual InstanceCount_t getInstance () const
 
virtual InstanceCount_t getInstance () const
 
int GetLineNumber () const
 
const char * GetLocale () const
 
const char * GetMsg (unsigned int MsgNum, const char *DefaultMsg, const char *Locale=nullptr)
 Get the message in the default message database. More...
 
const char * GetMsg (const char *Guid, unsigned int MsgNum, const char *DefaultMsg, const char *Locale=nullptr)
 Get the message in the guid message database. More...
 
const char * GetMsg () const
 
Tokens_t getParamName () const
 Get the name of the parameter associated with this error. More...
 
const char * GetProductGuid ()
 
Tokens_t getPropName () const
 Get the name of the property associated with this error. More...
 
const char * getText () const
 Get the RFC-iCalendar 'additional' text of this error message. More...
 
const char * getXCompName () const
 Get the name of the component associated with this error. More...
 
const char * getXParamName () const
 Get the name of the parameter associated with this error. More...
 
const char * getXPropName () const
 Get the name of the property associated with this error. More...
 
virtual InstanceCount_t incInstance () const
 Increment the instance. More...
 
virtual InstanceCount_t incInstance () const
 Increment the instance. More...
 
bool Insert (Tree_t< Error > **Rootp, const Tree_t< Error > *ToInsert, TreeCompare_fn_t Cmp)
 Insert a new node into the tree. 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 Remove (Tree_t< Error > **Rootp, const Tree_t< Error > *ToRemove, TreeCompare_fn_t Cmp)
 Insert a new node into the tree. More...
 
void SetGuid (const char *newGuid)
 
void SetMsg (const char *Guid, unsigned int MsgNum, const char *Msg, const char *Locale)
 Add an new message to the database. More...
 
void SetMsg (const char *Guid, unsigned int MsgNum, const char *Msg)
 Add an new message to the database. More...
 
void SetPosition (int Line, int CharOffset=-1)
 Set the line number and column offset of the error. More...
 
void SetProductGuid (const char *Guid)
 Set the product GUID. More...
 
void Walk (const Tree_t< Error > *Root, TreeAction_fn_t Walk)
 Walk the tree, calling walk for each node found. More...
 

Static Public Member Functions

static Error ** Delete (const void *Key, Tree_t< Error > **VRootP, TreeCompare_fn_t CompareFunction)
 
static Error ** Find (const Error *Key, Tree_t< Error > *const *VRootP, TreeCompare_fn_t CompareFunction)
 
static int GetErrno (void *Guid, unsigned int MsgNum, const char *DefaultMsg, const char *Locale=nullptr)
 Get the message ID from a message number in the guid message database. More...
 
static const ErrorGetError (unsigned int MsgNum, const char *DefaultMsg, const char *Locale=nullptr)
 Get the error from a message number in the default message database. More...
 
static const ErrorGetError (const char *Guid, unsigned int MsgNum, const char *DefaultMsg, const char *Locale=nullptr)
 Get the error from a message number in the guid message database. More...
 
static Error ** Search (const Error *Key, Tree_t< Error > *const *VRootP, TreeCompare_fn_t CompareFunction)
 

Public Attributes

const void * key
 
struct node_tleft
 
unsigned int red
 
struct node_tright
 

Protected Attributes

int _CharOffset
 For line oriented message, the character offset in the line. More...
 
const char * _CombinedGuid
 Combined GUID - calculated. More...
 
DateTime _Dt
 Our errno. More...
 
int _Errno
 The errono - our errno, not the systems. More...
 
const char * _Guid
 The current application GUID. More...
 
int _LineNumber
 For line oriented message, the line number. More...
 
const char * _Locale
 The locale for the message. More...
 
const char * _Msg
 The message - per locale tree. More...
 
const char * _ProductGuid
 The current product GUID. More...
 

Detailed Description

This class contains, processes, and formats iCalendar errors.

When error messages are generated they can use sprintf() like strings that will be replaced as follows:

  • c = component name.
  • p = property name.
  • a = parameter name.
  • v = value.

Definition at line 90 of file iCalError.hpp.

Member Typedef Documentation

◆ const_Tree

A const_Tree is a (const Tree_t<T>*)

Definition at line 75 of file TreeSearch.hpp.

◆ Tree

A Tree is a (Tree_t<T>*)

Definition at line 70 of file TreeSearch.hpp.

◆ TreeAction_fn_t

typedef void(* SoftwareAndServices::Library::Common::Tree_t< Error >::TreeAction_fn_t) (const Tree_t< Error > **, VISIT Leaf, int Depth)
inherited

Perform action on Tree_t<T>

Parameters
RootThe root node to work with.
Leafa VISIT value.
LevelA depth.

Definition at line 99 of file TreeSearch.hpp.

◆ TreeCompare_fn_t

typedef int(* SoftwareAndServices::Library::Common::Tree_t< Error >::TreeCompare_fn_t) (const Error *One, const Error *Two)
inherited

Tree compare function.

Parameters
OneThe first T to compare.
TwoThe second T to compare.
Returns
(-1) when One < Two. (0) When One == Two. (1) When One > Two.

Definition at line 88 of file TreeSearch.hpp.

◆ TreeFree_fn_t

typedef void(* SoftwareAndServices::Library::Common::Tree_t< Error >::TreeFree_fn_t) (Tree_t< Error > *TreeToFree)
inherited

Free Tree_t.

Parameters
TreeToFreeThe node to free.

Definition at line 108 of file TreeSearch.hpp.

Member Enumeration Documentation

◆ LocalErrno

Status of error message.

Definition at line 323 of file Error.hpp.

Constructor & Destructor Documentation

◆ iCalError()

SoftwareAndServices::Library::iCalendar::iCalError::iCalError ( const char *  errorCode)

Constructor.

iCalendar errors can be of the form x.y.z, so an integer or float will not work.

Parameters
errorCodeThe error code that it will initially contain.

◆ ~iCalError()

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

Destructor.

Member Function Documentation

◆ addCompName()

void SoftwareAndServices::Library::iCalendar::iCalError::addCompName ( Tokens_t  comp)

Notify this class that comp is the component being reported as relevant to this error.

If comp is X_COMP then call addXCompName() and add the real name.

Parameters
compThe component associated with this error.
See also
addXCompName()

◆ addErrorCode()

void SoftwareAndServices::Library::iCalendar::iCalError::addErrorCode ( unsigned int  err)

Add an additional error code.

Parameters
errThe new error code.

◆ addParamName()

void SoftwareAndServices::Library::iCalendar::iCalError::addParamName ( Tokens_t  param)

Notify this class that param is the parameter being reported as relevant to this error.

If param is XPARAM then call addXParamName() and add the real name.

Parameters
paramThe parameter associated with this error.
See also
addXParamName()

◆ addPropName()

void SoftwareAndServices::Library::iCalendar::iCalError::addPropName ( Tokens_t  prop)

Notify this class that prop is the property being reported as relevant to this error.

If prop is X_PROP then call addXPropName() and add the real name.

Parameters
propThe property associated with this error.
See also
addXPropName()

◆ addText()

void SoftwareAndServices::Library::iCalendar::iCalError::addText ( const char *  newText)

Add RFC-iTIP 'additional' text to this error.

Parameters
newTextThe new RFC-iCalendar 'additional' text to add.

◆ addXCompName()

void SoftwareAndServices::Library::iCalendar::iCalError::addXCompName ( const char *  xname,
size_t  Length = 0 
)

Notify this class that xname is the component being reported as relevant to this error where the component name is a string unknown to this implementation.

(X-vendor-foo) for example.

Parameters
xnameThe component name associated with this error.
LengthIf greater than zero, only Length characters in xname will be considered the component name.
See also
addCompName()

◆ addXParamName()

void SoftwareAndServices::Library::iCalendar::iCalError::addXParamName ( const char *  xname,
size_t  Length = 0 
)

Notify this class that xname is the parameter being reported as relevant to this error where the parameter name is a string unknown to this implementation.

(X-vendor-foo) for example.

Parameters
xnameThe parameter name associated with this error.
LengthIf greater than zero, Length len characters in xname will be considered the parameter name.
See also
addParamName()

◆ addXPropName()

void SoftwareAndServices::Library::iCalendar::iCalError::addXPropName ( const char *  xname,
size_t  Length = 0 
)

Notify this class that xname is the property being reported as relevant to this error where the property name is a string unknown to this implementation.

(X-vendor-foo) for example.

Parameters
xnameThe property name associated with this error.
LengthIf greater than zero, only Length characters in xname will be considered the property name.
See also
addPropName()

◆ decInstance() [1/2]

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

Decrement the instance.

Returns
The instance count, after decrementing it.

Definition at line 129 of file instance.hpp.

◆ decInstance() [2/2]

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

Decrement the instance.

Returns
The instance count, after decrementing it.

Definition at line 129 of file instance.hpp.

◆ Find()

Tree_t<Error>* SoftwareAndServices::Library::Common::Error::Find ( Tree_t< Error > *  Rootp,
const Tree_t< Error > *  ToFind,
TreeCompare_fn_t  Cmp 
)
inherited

Tree find, for locating cached messages.

Parameters
RootpThe root of the tree.
ToFindThe object to find.
CmpThe compare method to call to compare toFind with each node found.
Returns
The tree object that matched, or nullptr if none.

◆ GetCharOffset()

int SoftwareAndServices::Library::Common::Error::GetCharOffset ( ) const
inherited
Returns
The column number of the error, or -1 if not known.

◆ GetCombinedGuid()

const char* SoftwareAndServices::Library::Common::Error::GetCombinedGuid ( )
inherited
Returns
The company and product guid.

◆ getCompName()

Tokens_t SoftwareAndServices::Library::iCalendar::iCalError::getCompName ( ) const

Get the name of the component associated with this error.

If it returns X_COMP, then call getXCompName() to get the real component name.

Returns
The component type ID.
See also
getXCompName()

◆ GetDateTime()

const DateTime* SoftwareAndServices::Library::Common::Error::GetDateTime ( ) const
inherited
Returns
The date-time the error was generated.

◆ GetErrno() [1/3]

int SoftwareAndServices::Library::Common::Error::GetErrno ( unsigned int  MsgNum,
const char *  DefaultMsg,
const char *  Locale = nullptr 
)
inherited

Get the error ID in the default message database.

Parameters
MsgNumThe error message number to get.
DefaultMsgIf the L10N database can not be opened, the use this default message.
LocaleWhat locale to use, nullptr means default.
Returns
The error code.

◆ GetErrno() [2/3]

static int SoftwareAndServices::Library::Common::Error::GetErrno ( void *  Guid,
unsigned int  MsgNum,
const char *  DefaultMsg,
const char *  Locale = nullptr 
)
staticinherited

Get the message ID from a message number in the guid message database.

Parameters
GuidThe GUID database to use.
MsgNumThe error message number to get.
DefaultMsgIf the L10N database can not be opened, the use this default message.
LocaleWhat locale to use, nullptr means default.
Returns
The error code.

◆ GetErrno() [3/3]

int SoftwareAndServices::Library::Common::Error::GetErrno ( ) const
inherited

Get this objcet error number.

Returns
The error number.

◆ GetError() [1/2]

static const Error* SoftwareAndServices::Library::Common::Error::GetError ( unsigned int  MsgNum,
const char *  DefaultMsg,
const char *  Locale = nullptr 
)
staticinherited

Get the error from a message number in the default message database.

Parameters
MsgNumThe error message number to get.
DefaultMsgIf the L10N database can not be opened, the use this default message.
LocaleWhat locale to use, nullptr means default.
Returns
A new error object, to be deleted by the caller when no longer needed.

◆ GetError() [2/2]

static const Error* SoftwareAndServices::Library::Common::Error::GetError ( const char *  Guid,
unsigned int  MsgNum,
const char *  DefaultMsg,
const char *  Locale = nullptr 
)
staticinherited

Get the error from a message number in the guid message database.

Parameters
GuidThe GUID database to use.
MsgNumThe error message number to get.
DefaultMsgIf the L10N database can not be opened, the use this default message.
LocaleWhat locale to use, nullptr means default.
Returns
A new error object, to be deleted by the caller when no longer needed.

◆ getErrorCodes()

std::vector<int>* SoftwareAndServices::Library::iCalendar::iCalError::getErrorCodes ( ) const

Get an array of error codes.

Returns
, each element of the array is a (char*).

◆ getErrorMessage()

const char* SoftwareAndServices::Library::iCalendar::iCalError::getErrorMessage ( ) const

Get the human readable error message.

Returns
Get the human readable error message.

◆ GetGuid()

const char* SoftwareAndServices::Library::Common::Error::GetGuid ( )
inherited
Returns
The GUID of the current application running.

◆ getInstance() [1/2]

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

Definition at line 118 of file instance.hpp.

◆ getInstance() [2/2]

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

Definition at line 118 of file instance.hpp.

◆ GetLineNumber()

int SoftwareAndServices::Library::Common::Error::GetLineNumber ( ) const
inherited
Returns
The line number of the error, or -1 if not known.

◆ GetLocale()

const char* SoftwareAndServices::Library::Common::Error::GetLocale ( ) const
inherited
Returns
The current locale.

◆ GetMsg() [1/3]

const char* SoftwareAndServices::Library::Common::Error::GetMsg ( unsigned int  MsgNum,
const char *  DefaultMsg,
const char *  Locale = nullptr 
)
inherited

Get the message in the default message database.

Parameters
MsgNumThe error message number to get.
DefaultMsgIf the L10N database can not be opened, the use this default message.
LocaleWhat locale to use, nullptr means default.
Returns
A pointer to a string message. The string is stored in StringCache

◆ GetMsg() [2/3]

const char* SoftwareAndServices::Library::Common::Error::GetMsg ( const char *  Guid,
unsigned int  MsgNum,
const char *  DefaultMsg,
const char *  Locale = nullptr 
)
inherited

Get the message in the guid message database.

Parameters
GuidThe GUID database to use.
MsgNumThe error message number to get.
DefaultMsgIf the L10N database can not be opened, the use this default message.
LocaleWhat locale to use, nullptr means default.
Returns
A pointer to a string message. The string is stored in StringCache

◆ GetMsg() [3/3]

const char* SoftwareAndServices::Library::Common::Error::GetMsg ( ) const
inherited
Returns
The error message.

◆ getParamName()

Tokens_t SoftwareAndServices::Library::iCalendar::iCalError::getParamName ( ) const

Get the name of the parameter associated with this error.

If it returns XPARM, then call getXParamName() to get the real parameter name.

Returns
The parameter type ID.
See also
getXParameterName()

◆ GetProductGuid()

const char* SoftwareAndServices::Library::Common::Error::GetProductGuid ( )
inherited
Returns
The product GUID.

◆ getPropName()

Tokens_t SoftwareAndServices::Library::iCalendar::iCalError::getPropName ( ) const

Get the name of the property associated with this error.

If it returns X_PROP, then call getXPropName() to get the real property name.

Returns
The property type ID.
See also
getXPropName()

◆ getText()

const char* SoftwareAndServices::Library::iCalendar::iCalError::getText ( ) const

Get the RFC-iCalendar 'additional' text of this error message.

Returns
The RFC-iCalendar 'additional' text of this error message.

◆ getXCompName()

const char* SoftwareAndServices::Library::iCalendar::iCalError::getXCompName ( ) const

Get the name of the component associated with this error.

Returns
The component name.
See also
getXCompName()

◆ getXParamName()

const char* SoftwareAndServices::Library::iCalendar::iCalError::getXParamName ( ) const

Get the name of the parameter associated with this error.

Returns
The parameter name.
See also
getXParameterName()

◆ getXPropName()

const char* SoftwareAndServices::Library::iCalendar::iCalError::getXPropName ( ) const

Get the name of the property associated with this error.

Returns
The property name.
See also
getXPropName()

◆ incInstance() [1/2]

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

Increment the instance.

Returns
The instance value, after incrementing it.

Definition at line 109 of file instance.hpp.

◆ incInstance() [2/2]

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

Increment the instance.

Returns
The instance value, after incrementing it.

Definition at line 109 of file instance.hpp.

◆ Insert()

bool SoftwareAndServices::Library::Common::Error::Insert ( Tree_t< Error > **  Rootp,
const Tree_t< Error > *  ToInsert,
TreeCompare_fn_t  Cmp 
)
inherited

Insert a new node into the tree.

Parameters
RootpThe root of the node.
ToInsertThe object to insert.
CmpThe compare method to call to compare toFind with each node.
Returns
TRUE if inserted.

◆ operator delete()

void SoftwareAndServices::Library::iCalendar::iCalError::operator delete ( void *  data)

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

Parameters
dataA pointer to this kind of object that is being deleted.

◆ Remove()

bool SoftwareAndServices::Library::Common::Error::Remove ( Tree_t< Error > **  Rootp,
const Tree_t< Error > *  ToRemove,
TreeCompare_fn_t  Cmp 
)
inherited

Insert a new node into the tree.

Parameters
RootpThe root of the node.
ToRemoveThe object to remove.
CmpThe compare method to call to compare toFind with each node.
Returns
TRUE if inserted.

◆ SetGuid()

void SoftwareAndServices::Library::Common::Error::SetGuid ( const char *  newGuid)
inherited
Parameters
newGuidThe guid to use.

◆ SetMsg() [1/2]

void SoftwareAndServices::Library::Common::Error::SetMsg ( const char *  Guid,
unsigned int  MsgNum,
const char *  Msg,
const char *  Locale 
)
inherited

Add an new message to the database.

Parameters
GuidThe GUID database to use.
MsgNumThe message number to use.
MsgThe message to use.
LocaleThe locale to use.

◆ SetMsg() [2/2]

void SoftwareAndServices::Library::Common::Error::SetMsg ( const char *  Guid,
unsigned int  MsgNum,
const char *  Msg 
)
inherited

Add an new message to the database.

Parameters
GuidThe GUID database to use.
MsgNumThe message number to use.
MsgThe message to use.

◆ SetPosition()

void SoftwareAndServices::Library::Common::Error::SetPosition ( int  Line,
int  CharOffset = -1 
)
inherited

Set the line number and column offset of the error.

Parameters
LineThe line number (if -1 not known).
CharOffsetThe column offset (if -1 not known).

◆ SetProductGuid()

void SoftwareAndServices::Library::Common::Error::SetProductGuid ( const char *  Guid)
inherited

Set the product GUID.

◆ Walk()

void SoftwareAndServices::Library::Common::Error::Walk ( const Tree_t< Error > *  Root,
TreeAction_fn_t  Walk 
)
inherited

Walk the tree, calling walk for each node found.

Parameters
RootThe root of the tree.
WalkThe callback function to call when each node is found.

Member Data Documentation

◆ _CharOffset

int SoftwareAndServices::Library::Common::Error::_CharOffset
protectedinherited

For line oriented message, the character offset in the line.

Definition at line 439 of file Error.hpp.

◆ _CombinedGuid

const char* SoftwareAndServices::Library::Common::Error::_CombinedGuid
mutableprotectedinherited

Combined GUID - calculated.

Definition at line 408 of file Error.hpp.

◆ _Dt

DateTime SoftwareAndServices::Library::Common::Error::_Dt
protectedinherited

Our errno.

Set to constructor creation time of this object.

Definition at line 428 of file Error.hpp.

◆ _Errno

int SoftwareAndServices::Library::Common::Error::_Errno
protectedinherited

The errono - our errno, not the systems.

Definition at line 423 of file Error.hpp.

◆ _Guid

const char* SoftwareAndServices::Library::Common::Error::_Guid
protectedinherited

The current application GUID.

Definition at line 397 of file Error.hpp.

◆ _LineNumber

int SoftwareAndServices::Library::Common::Error::_LineNumber
protectedinherited

For line oriented message, the line number.

Definition at line 433 of file Error.hpp.

◆ _Locale

const char* SoftwareAndServices::Library::Common::Error::_Locale
protectedinherited

The locale for the message.

Definition at line 418 of file Error.hpp.

◆ _Msg

const char* SoftwareAndServices::Library::Common::Error::_Msg
protectedinherited

The message - per locale tree.

Definition at line 413 of file Error.hpp.

◆ _ProductGuid

const char* SoftwareAndServices::Library::Common::Error::_ProductGuid
mutableprotectedinherited

The current product GUID.

May be nullptr.

Definition at line 403 of file Error.hpp.


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