ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
active::serialise::xml::XMLTransport Class Reference

#include <XMLTransport.h>

Inheritance diagram for active::serialise::xml::XMLTransport:
Inheritance graph
[legend]
Collaboration diagram for active::serialise::xml::XMLTransport:
Collaboration graph
[legend]

Public Types

enum class  Status {
  nominal , unknownEscapeChar , badEncoding , badSource ,
  unboundedTag , unknownSection , unknownInstruction , missingTagName ,
  missingAttributes , attributeEqualMissing , attributeQuoteMissing , parsingError ,
  closingTagMissing , badName , badValue , badElement ,
  badDestination , missingInventory , unbalancedScope , inventoryBoundsExceeded ,
  unknownTag
}
 Status of of the XML transport. More...
 
- Public Types inherited from active::serialise::Transport
using TimeFormat = std::optional<xml::XMLDateTime::Format>
 
using size_type = utility::Memory::size_type
 

Public Member Functions

virtual void send (serialise::Cargo &&cargo, const serialise::Identity &identity, utility::BufferOut &&destination, bool isTabbed=false, bool isLineFeeds=false, bool isNameSpaces=true, bool isProlog=true) const override
 
virtual void receive (serialise::Cargo &&cargo, const serialise::Identity &identity, utility::BufferIn &&source) const override
 
bool isUnknownInstructionSkipped () const noexcept
 
void setUnknownInstructionSkipped (bool state) noexcept
 
 Transport (bool isUnknownNameSkipped=false, TimeFormat timeFormat=iso8601) noexcept
 
- Public Member Functions inherited from active::serialise::Transport
 Transport (bool isUnknownNameSkipped=false, TimeFormat timeFormat=iso8601) noexcept
 
virtual ~Transport () noexcept
 
TimeFormat getTimeFormat () const noexcept
 
size_type getLastRow () const noexcept
 
size_type getLastColumn () const noexcept
 
bool isUnknownNameSkipped () const noexcept
 
void setTimeFormat (TimeFormat format) noexcept
 
void setUnknownNameSkipped (bool state) noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from active::serialise::Transport
void setLastRow (size_type row) const noexcept
 
void setLastColumn (size_type col) const noexcept
 

Detailed Description

A serialisation tool class to send/receive data serialised via XML

Member Enumeration Documentation

◆ Status

Status of of the XML transport.

Enumerator
nominal 

No errors logged.

unknownEscapeChar 

The character following an escape is unknown, e.g. not
, \r, \u etc.

badEncoding 

The encoding of an escaped character is invalid, e.g. \uXXXX.

badSource 

The XML source failed, e.g. corrupt file.

unboundedTag 

The closing brace for a tag is missing (>)

unknownSection 

The specified section type is unknown.

unknownInstruction 

The specified instruction type is unknown.

missingTagName 

The tag name is empty.

missingAttributes 

The instruction attributes are missing.

attributeEqualMissing 

The equals character is missing in an attribute.

attributeQuoteMissing 

The quote character is missing in an attribute.

parsingError 

The XML source couldn't be parsed - likely corrupt or not well-formed.

closingTagMissing 

A closing tag is missing.

badName 

A value was found, but invalid.

badValue 

A value was found, but invalid.

badElement 

Element content was rejected as invalid.

badDestination 

The XML destination failed, e.g. full storage, corrupt FS etc prevented writing.

missingInventory 

An object has been provided to send/receive data, but it cannot provide an inventory for its content.

unbalancedScope 

The closing tag cannot be paired with the opening.

inventoryBoundsExceeded 

The source contains more items of a specific type than the inventory maximum permits.

unknownTag 

An unknown tag was found in the XML.

Member Function Documentation

◆ isUnknownInstructionSkipped()

bool active::serialise::xml::XMLTransport::isUnknownInstructionSkipped ( ) const
inlinenoexcept

Determine if unknown instructions are skipped

Returns
True if unknown instructions are skipped

◆ receive()

void XMLTransport::receive ( serialise::Cargo && cargo,
const serialise::Identity & identity,
utility::BufferIn && source ) const
overridevirtual

Receive cargo from a specified XML source

Parameters
cargoThe cargo to receive the XML data
identityThe cargo identity (name, optional namespace)
sourceThe XML source (can be a wrapper for file, memory, string)
Exceptions
std::system_errorThrown on read errors, invalid encoding or parsing failure (e.g. ill-formed XML)

Implements active::serialise::Transport.

◆ send()

void XMLTransport::send ( serialise::Cargo && cargo,
const serialise::Identity & identity,
utility::BufferOut && destination,
bool isTabbed = false,
bool isLineFeeds = false,
bool isNameSpaces = true,
bool isProlog = true ) const
overridevirtual

Send cargo as XML to a specified destination

Parameters
cargoThe cargo to be sent as XML
identityThe cargo identity (name, optional namespace)
destinationThe destination buffer for the exported XML (can target file, memory, string)
isTabbedTrue to indent lines with tabs
isLineFeedsTrue to add line-feeds
isNameSpacesTrue to inclued namespaces (where specified)
isPrologTrue if an serialisation prolog should be written
Exceptions
std::system_errorThrown on write errors, serialisation failure (e.g. invalid XML names, missing inventory etc)

Implements active::serialise::Transport.

◆ setUnknownInstructionSkipped()

void active::serialise::xml::XMLTransport::setUnknownInstructionSkipped ( bool state)
inlinenoexcept

Set whether unknown instructions are skipped

Parameters
stateTrue if unknown instructions are skipped

◆ Transport()

active::serialise::Transport::Transport ( bool isUnknownNameSkipped = false,
TimeFormat timeFormat = iso8601 )
inlinenoexcept

Default constructor

Parameters
isUnknownNameSkippedTrue if unknown tags should be skipped (false = stop parsing with an error)
timeFormatThe serialisation date/time format (nullopt = use the format specified in each outgoing item)

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