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

#include <Package.h>

Inheritance diagram for active::serialise::Package:
Inheritance graph
[legend]
Collaboration diagram for active::serialise::Package:
Collaboration graph
[legend]

Public Types

using Unique = std::unique_ptr<Package>
 Unique pointer.
 
using Shared = std::shared_ptr<Package>
 Shared pointer.
 
- Public Types inherited from active::serialise::Cargo
using Unique = std::unique_ptr<Cargo>
 Unique pointer.
 
using Shared = std::shared_ptr<Cargo>
 Shared pointer.
 
using size_type = std::string::size_type
 Class size type.
 
using sizeOption = std::optional<size_type>
 Optional size type (used to indicate an unspecified or non-existant position)
 

Public Member Functions

bool isRoot () const
 
virtual bool isAttributeFirst () const
 
virtual void setDefault ()
 
virtual bool insert (Cargo::Unique &&cargo, const Inventory::Item &item)
 
virtual bool read (const utility::String &source)
 
void setRoot (bool state)
 
virtual bool finaliseAttributes ()
 
- Public Member Functions inherited from active::serialise::Cargo
 Cargo ()
 
 Cargo (const Cargo &source)
 
virtual ~Cargo ()=default
 
virtual bool fillInventory (Inventory &inventory) const =0
 
virtual Cargo::Unique getCargo (const Inventory::Item &item) const =0
 
virtual void clear ()
 
virtual bool validate ()
 

Detailed Description

Interface for package objects (encapsulating multiple data items and/or packages) that support serialisation

Member Function Documentation

◆ finaliseAttributes()

virtual bool active::serialise::Package::finaliseAttributes ( )
inlinevirtual

Finalise the package attributes (called when isAttributeFirst = true and attributes have been imported)

Returns
True if the attributes have been successfully finalised (returning false will cause an exception to be thrown)

◆ insert()

virtual bool active::serialise::Package::insert ( Cargo::Unique && cargo,
const Inventory::Item & item )
inlinevirtual

Insert specified cargo into the package - used for cargo with many instances sharing the same ID (e.g. from an array/map)

Parameters
cargoThe cargo to insert
itemThe inventory item linked with the cargo
Returns
True if the cargo was accepted (false will trigger an import failure - simply discard if this is not an error)

Reimplemented in active::serialise::PackageWrap, active::serialise::xml::XMLSolidPolygon< Vert, VertWrap >, active::serialise::xml::XMLSolidPolygon< geometry::PolyPoint, XMLPolyPoint >, active::serialise::xml::XMLPolygon< Vert, VertWrap, Hole, HoleWrap >, active::serialise::xml::XMLValueSetting, and active::serialise::doc::Object.

◆ isAttributeFirst()

virtual bool active::serialise::Package::isAttributeFirst ( ) const
inlinevirtual

Determine if the package requires attributes to be imported first (primarily for unordered serialisation, e.g. JSON)

Returns
True if the package requires attributes first

◆ isRoot()

bool active::serialise::Package::isRoot ( ) const
inline

Determine if the package is the outermost/root layer of a hierarchy

Returns
True if the package is the outermost/root layer of a hierarchy

◆ read()

virtual bool active::serialise::Package::read ( const utility::String & source)
inlinevirtual

Import the package from a string

Parameters
sourceThe string to read
Returns
True if the package was successfully read

Reimplemented in active::serialise::PackageWrap.

◆ setDefault()

virtual void active::serialise::Package::setDefault ( )
inlinevirtual

◆ setRoot()

void active::serialise::Package::setRoot ( bool state)
inline

Set whether the package is the outermost/root layer of a hierarchy

Parameters
stateTrue if the package is the outermost/root layer of a hierarchy

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