WSF
UtmlObject Class Reference

#include <Utml.hpp>

Public Types

typedef std::map< std::string, UtmlObjectPropertyMap

Public Member Functions

 UtmlObject ()
 UtmlObject (const std::string &aValue)
 UtmlObject (const UtmlObject &aRhs)
UtmlObjectoperator= (const UtmlObject &aRhs)
 ~UtmlObject ()
bool IsValue () const
bool IsContainer () const
const std::string & GetValue () const
 To be used when IsContainer() is false, the value as a string.
void SetValue (const std::string &aValue)
 Assign the value. Not valid for containers.
void SetValueLines (const std::vector< std::string > &aLines)
std::vector< std::string > GetValueLines () const
 Multi-line values are allowed. This is a helper method to parse multiple lines, trimming whitespace.
bool GetBoolValue () const
void SetBoolValue (bool aValue)
const std::string & GetType () const
 }
std::map< std::string, UtmlObject > & GetProperties ()
 Returns the list of properties on the object.
const std::map< std::string, UtmlObject > & GetProperties () const
 Returns the list of properties on the object.
UtmlObjectFindProperty (const std::string &aName) const
 Returns the named property if it exists.
std::string PropertyValue (const std::string &aPropertyName, const std::string &aDefaultValue) const
bool Contains (const std::string &aPropertyName) const
 Returns 'true' if the property by this name exists on this object.
UtmlObjectoperator[] (const std::string &aName)
UtmlObjectoperator+= (const UtmlObject &aRhs)
 Add a sub-object to this object.
int GetObjectCount () const
 Returns the number of objects in the container.
UtmlObjectGetObject (int aIndex)
 returns the object at the specified index
const UtmlObjectGetObject (int aIndex) const
 returns the object at the specified index
UtmlObjectFirstObjectByType (const std::string &aTypeName) const
void GiveProperty (const std::string &aName, UtmlObject &aObject)
 Consumes aObject and adds the object as a named property of this container.
void GiveObject (UtmlObject &aObject)
 Consumes aObject and adds the object as a sub-object.
void Swap (UtmlObject &aRhs)
 }
std::string ToText () const
bool operator== (const UtmlObject &aRhs) const
bool operator!= (const UtmlObject &aRhs) const

Static Public Member Functions

static UtmlObject makeContainer (const std::string &aType)
 Returns a container object of the specified type.
static UtmlObject parse (const std::string &aContainerType, const std::string &aText)
 Parse a string and return it as a Utml container.
static UtmlObject parseFile (const std::string &aFilePath)
 Parse a file and return it as a Utml container.

Member Typedef Documentation

◆ PropertyMap

typedef std::map<std::string, UtmlObject> UtmlObject::PropertyMap

Constructor & Destructor Documentation

◆ UtmlObject() [1/3]

◆ UtmlObject() [2/3]

UtmlObject::UtmlObject ( const std::string & aValue)

◆ UtmlObject() [3/3]

UtmlObject::UtmlObject ( const UtmlObject & aRhs)

References UtmlObject().

◆ ~UtmlObject()

UtmlObject::~UtmlObject ( )

Member Function Documentation

◆ Contains()

bool UtmlObject::Contains ( const std::string & aPropertyName) const

Returns 'true' if the property by this name exists on this object.

◆ FindProperty()

UtmlObject * UtmlObject::FindProperty ( const std::string & aName) const

Returns the named property if it exists.

References UtmlObject().

Referenced by WsfEventPipeInterface::AddedToSimulation(), and PropertyValue().

◆ FirstObjectByType()

UtmlObject * UtmlObject::FirstObjectByType ( const std::string & aTypeName) const

Returns a pointer to the first object with the specified type. Returns 'null' if none exist.

References UtmlObject().

◆ GetBoolValue()

bool UtmlObject::GetBoolValue ( ) const

◆ GetObject() [1/2]

◆ GetObject() [2/2]

const UtmlObject & UtmlObject::GetObject ( int aIndex) const
inline

returns the object at the specified index

References GetObjectCount(), and UtmlObject().

◆ GetObjectCount()

◆ GetProperties() [1/2]

std::map< std::string, UtmlObject > & UtmlObject::GetProperties ( )
inline

Returns the list of properties on the object.

Referenced by GiveProperty(), and operator[]().

◆ GetProperties() [2/2]

const std::map< std::string, UtmlObject > & UtmlObject::GetProperties ( ) const
inline

Returns the list of properties on the object.

◆ GetType()

const std::string & UtmlObject::GetType ( ) const
inline

}

Container methods These methods are for operating on container objects. To be called only if IsContainer() is true. { Returns the type name of the object

References IsContainer().

Referenced by WsfEventPipeInterface::AddedToSimulation(), UtPackEnumType::Read(), UtPackSchema::Read(), UtPackStruct::Read(), UtPackUnion::Read(), UtPackSchema::ReadType(), and wizard::ToolPrefData::ToolPrefData().

◆ GetValue()

const std::string & UtmlObject::GetValue ( ) const
inline

To be used when IsContainer() is false, the value as a string.

References IsContainer().

Referenced by PropertyValue(), UtPackBasicType::Read(), UtPackField::Read(), UtPackType::Read(), and ToText().

◆ GetValueLines()

std::vector< std::string > UtmlObject::GetValueLines ( ) const

Multi-line values are allowed. This is a helper method to parse multiple lines, trimming whitespace.

◆ GiveObject()

void UtmlObject::GiveObject ( UtmlObject & aObject)

Consumes aObject and adds the object as a sub-object.

References Swap(), and UtmlObject().

◆ GiveProperty()

void UtmlObject::GiveProperty ( const std::string & aName,
UtmlObject & aObject )

Consumes aObject and adds the object as a named property of this container.

References GetProperties(), Swap(), and UtmlObject().

◆ IsContainer()

bool UtmlObject::IsContainer ( ) const
inline

An object can either be a container or a simple value. Returns 'true' if this is a container

Referenced by GetType(), GetValue(), operator+=(), UtmlParser::Parse(), and SetValue().

◆ IsValue()

bool UtmlObject::IsValue ( ) const
inline

An object can either be a container or a simple value. Returns 'true' if this is a simple value

Referenced by ToText().

◆ makeContainer()

UtmlObject UtmlObject::makeContainer ( const std::string & aType)
static

Returns a container object of the specified type.

References UtmlObject().

Referenced by WsfEventPipeInterface::AddedToSimulation(), parse(), parseFile(), and wizard::ToolPrefData::ToolPrefData().

◆ operator!=()

bool UtmlObject::operator!= ( const UtmlObject & aRhs) const
inline

References operator==(), and UtmlObject().

◆ operator+=()

UtmlObject & UtmlObject::operator+= ( const UtmlObject & aRhs)
inline

Add a sub-object to this object.

References IsContainer(), and UtmlObject().

◆ operator=()

UtmlObject & UtmlObject::operator= ( const UtmlObject & aRhs)

References UtmlObject().

◆ operator==()

bool UtmlObject::operator== ( const UtmlObject & aRhs) const

References UtmlObject().

◆ operator[]()

UtmlObject & UtmlObject::operator[] ( const std::string & aName)

Return a property if it exists. If the property does not exist, create a new property with an empty value

References GetProperties(), and UtmlObject().

◆ parse()

UtmlObject UtmlObject::parse ( const std::string & aContainerType,
const std::string & aText )
static

Parse a string and return it as a Utml container.

References makeContainer(), UtmlParser::Parse(), and UtmlObject().

◆ parseFile()

UtmlObject UtmlObject::parseFile ( const std::string & aFilePath)
static

Parse a file and return it as a Utml container.

References makeContainer(), UtmlParser::Parse(), UtmlObject(), and UtmlParseError::what().

◆ PropertyValue()

std::string UtmlObject::PropertyValue ( const std::string & aPropertyName,
const std::string & aDefaultValue ) const

If the name property exists and is a simple value, returns the value as a string. otherwise, aDefaultValue is returned.

References FindProperty(), GetValue(), and UtmlObject().

Referenced by WsfEventPipeInterface::AddedToSimulation(), UtPackBasicType::Read(), UtPackEnumType::Read(), UtPackField::Read(), UtPackListType::Read(), UtPackSchema::Read(), UtPackStruct::Read(), and wizard::ToolPrefData::ToolPrefData().

◆ SetBoolValue()

void UtmlObject::SetBoolValue ( bool aValue)

◆ SetValue()

void UtmlObject::SetValue ( const std::string & aValue)
inline

Assign the value. Not valid for containers.

References IsContainer().

Referenced by WsfEventPipeInterface::AddedToSimulation().

◆ SetValueLines()

void UtmlObject::SetValueLines ( const std::vector< std::string > & aLines)

{ Standard-value processing values are free-form, but these helper methods are provided to read specific value formats Multi-line values are allowed. This is a helper method to assign a multi-line value

◆ Swap()

void UtmlObject::Swap ( UtmlObject & aRhs)
inline

}

Swaps the value of two objects in constant time

References std::swap(), and UtmlObject().

Referenced by GiveObject(), and GiveProperty().

◆ ToText()

std::string UtmlObject::ToText ( ) const

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved