Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::FileXML::Declaration Class Reference

XML Declaration object. More...

Inheritance diagram for Burger::FileXML::Declaration:
Collaboration diagram for Burger::FileXML::Declaration:

Public Member Functions

 Declaration ()
 Create an empty declaration object.
 
 Declaration (float fVersion, const char *pEncoding=0, uint_t bStandalone=2)
 Create a declaration object with supplied defaults.
 
virtual ~Declaration ()
 Call the destructor for a Declaration object.
 
virtual uint_t Parse (InputMemoryStream *pInput)
 Parse an XML Declaration object.
 
virtual uint_t Save (OutputMemoryStream *pOutput, uint_t uDepth) const
 Write out an XML Declaration object.
 
float GetVersion (void) const
 Return the declaration version.
 
void SetVersion (float fInput=1.0f)
 Sets the declaration version.
 
const char * GetEncoding (void) const
 Return the declaration encoding string.
 
void SetEncoding (const char *pInput)
 Sets the declaration encoding.
 
void SetEncoding (const String *pInput)
 Sets the declaration encoding.
 
uint_t GetStandalone (void) const
 Return the standalone boolean.
 
void SetStandalone (uint_t bInput)
 Sets the declaration standalone value.
 
- Public Member Functions inherited from Burger::FileXML::Generic
 Generic (eType uType)
 Initialize a generic object.
 
virtual ~Generic ()
 Call the destructor for a generic object.
 
GenericGetNext (void) const
 Get the pointer to the next object in the list.
 
GenericGetPrevious (void) const
 Get the pointer to the previous object in the list.
 
eType GetType (void) const
 Get the enumeration of the derived class' type.
 
void InsertBefore (Generic *pGeneric)
 Insert this object before this one in the linked list.
 
void InsertAfter (Generic *pGeneric)
 Insert this object after this one in the linked list.
 
ElementGetNextElement (void) const
 Follow the linked list of items to the next Element.
 
ElementGetNextElement (const char *pElementName) const
 Follow the linked list of items to the next named Element.
 
GenericGetNextItem (void) const
 Follow the linked list of items to the next object.
 
- Public Member Functions inherited from Burger::Base
const char * get_class_name (void) const noexcept
 Get the name of the class.
 
virtual const Burger::StaticRTTIget_StaticRTTI (void) const noexcept
 Get the description to the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Member Functions

static DeclarationNew (InputMemoryStream *pInput)
 Create a new Declaration structure and initialize it from an input file.
 
static DeclarationNew (float fVersion, const char *pEncoding=0, uint_t bStandalone=2)
 Create a new Declaration structure and initialize it.
 

Private Attributes

String m_Encoding
 ASCII of the encoding (Normally it's UTF-8)
 
float m_fVersion
 Version number of the declaration.
 
uint_t m_bStandalone
 TRUE if it's a standalone XML file
 

Additional Inherited Members

- Public Types inherited from Burger::FileXML::Generic
enum  eType {
  XML_ROOT , XML_COMMENT , XML_CDATA , XML_ATTRIBUTE ,
  XML_DECLARATION , XML_DOCUMENT , XML_ELEMENT , XML_TEXT ,
  XML_UNKNOWN
}
 Enumeration to identify derived classes. More...
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Detailed Description

XML Declaration object.


Sometimes an XML file has a <?xml ?> record for declaring the text encoding. This object contains this information. XML files should only have one of these records at the start of the file. It's not good practice to have multiple records nor having it not be the first record in the file.

Note
This will identify with eType of XML_DECLARATION
See also
FileXML, FileXML::Generic, FileXML::Comment or FileXML::Element

Constructor & Destructor Documentation

◆ Declaration() [1/2]

Burger::FileXML::Declaration::Declaration ( )

Create an empty declaration object.


◆ Declaration() [2/2]

Burger::FileXML::Declaration::Declaration ( float fVersion,
const char * pEncoding = 0,
uint_t bStandalone = 2 )

Create a declaration object with supplied defaults.


◆ ~Declaration()

Burger::FileXML::Declaration::~Declaration ( )
virtual

Call the destructor for a Declaration object.


Unlink itself from the linked list and release the contained strings

Member Function Documentation

◆ GetEncoding()

const char * Burger::FileXML::Declaration::GetEncoding ( void ) const
inline

Return the declaration encoding string.


Usually it's UTF-8 or ISO-8859-1

See also
SetEncoding(const char *) or SetEncoding(const String *)

◆ GetStandalone()

uint_t Burger::FileXML::Declaration::GetStandalone ( void ) const
inline

Return the standalone boolean.


The XML default is FALSE.

Returns
TRUE if it's standalone or FALSE if not.
See also
SetStandalone(uint_t)

◆ GetVersion()

float Burger::FileXML::Declaration::GetVersion ( void ) const
inline

Return the declaration version.


Usually this value is 1.0f

See also
SetVersion(float)

◆ New() [1/2]

Burger::FileXML::Declaration *BURGER_API Burger::FileXML::Declaration::New ( float fVersion,
const char * pEncoding = 0,
uint_t bStandalone = 2 )
static

Create a new Declaration structure and initialize it.


Parse the input file after the starting <?xml and up to and including the ending ?> Will return NULL on a parsing error or if it's out of memory

Parameters
fVersionVersion number of the declaration
pEncodingPointer to the string containing the encoding or an empty string.
bStandaloneTRUE for standalone, FALSE for not standalone, 2 for not standalone and disable the entry on write
Returns
NULL on error or a valid Declaration record on a successful parse

◆ New() [2/2]

Burger::FileXML::Declaration *BURGER_API Burger::FileXML::Declaration::New ( InputMemoryStream * pInput)
static

Create a new Declaration structure and initialize it from an input file.


Parse the input file after the starting <?xml and up to and including the ending ?> Will return NULL on a parsing error or if it's out of memory

Parameters
pInputPointer to an input stream at the byte after the <?xml
Returns
NULL on error or a valid Declaration record on a successful parse

◆ Parse()

uint_t Burger::FileXML::Declaration::Parse ( InputMemoryStream * pInput)
virtual

Parse an XML Declaration object.


Parameters
pInputPointer to the input text stream
Returns
Zero if no error, non-zero on error
See also
Save(OutputMemoryStream *)

Reimplemented from Burger::FileXML::Generic.

◆ Save()

uint_t Burger::FileXML::Declaration::Save ( OutputMemoryStream * pOutput,
uint_t uDepth ) const
virtual

Write out an XML Declaration object.


Parameters
pOutputPointer to the output text stream
uDepthNumber of tabs to output for formatting before writing out the comment
Returns
Zero if no error, non-zero on error
See also
Parse(InputMemoryStream *)

Reimplemented from Burger::FileXML::Generic.

◆ SetEncoding() [1/2]

void Burger::FileXML::Declaration::SetEncoding ( const char * pInput)
inline

Sets the declaration encoding.


Replace the contained encoding value string with a new one

Parameters
pInputPointer to the string containing the encoding or an empty string.
See also
GetEncoding(void) const or SetEncoding(const String *)

◆ SetEncoding() [2/2]

void Burger::FileXML::Declaration::SetEncoding ( const String * pInput)
inline

Sets the declaration encoding.


Replace the contained encoding value string with a new one

Parameters
pInputPointer to the string containing the encoding or an empty string.
See also
GetEncoding(void) const or SetEncoding(const char *)

◆ SetStandalone()

void Burger::FileXML::Declaration::SetStandalone ( uint_t bInput)
inline

Sets the declaration standalone value.


There's a special value of 2 that will set the standalone value to "false" and disable the ability to save this attribute to the output file.

Parameters
bInputTRUE for standalone, FALSE for not standalone, 2 for not standalone and disable the entry on write
See also
GetStandalone() const

◆ SetVersion()

void BURGER_API Burger::FileXML::Declaration::SetVersion ( float fInput = 1.0f)

Sets the declaration version.


Parameters
fInputVersion number of the declaration
See also
GetVersion() const

Member Data Documentation

◆ m_bStandalone

uint_t Burger::FileXML::Declaration::m_bStandalone
private

TRUE if it's a standalone XML file

◆ m_Encoding

String Burger::FileXML::Declaration::m_Encoding
private

ASCII of the encoding (Normally it's UTF-8)

◆ m_fVersion

float Burger::FileXML::Declaration::m_fVersion
private

Version number of the declaration.