GL Studio C++ Runtime API
DistiAttribDict Class Referencefinal

#include <disti_metadata.h>

Public Types

typedef DistiAttributeBaseAttr_t
 

Public Member Functions

 DistiAttribDict ()
 
 ~DistiAttribDict ()
 
 DistiAttribDict (DistiAttribDict &&other)
 
DistiAttribDictoperator= (DistiAttribDict &&other)
 
DistiAttribDictoperator= (const DistiAttribDict &dict)
 
void CopyCommonValues (const DistiAttribDict &dict)
 
bool operator== (const DistiAttribDict &other)
 
void Add (DistiAttributeBase *attr)
 
int Count () const
 
int Count (const AttributeName &name) const
 
void Clear ()
 
void Delete (const AttributeName &name)
 
void ReadStrings (std::istream &instr)
 
void Write (std::ostream &outstr, bool changedDataOnly=false)
 
bool Read (std::istream &instr)
 
bool ReadAndCaptureMissing (std::istream &instr, std::stringstream *missingStream)
 
std::string ValueString (const AttributeName &name) const
 
void ValueString (const AttributeName &name, const std::string &val)
 
long ValueInt (const AttributeName &name) const
 
void ValueInt (const AttributeName &name, long val)
 
std::ostream & WriteValue (const AttributeName &name, std::ostream &outstr)
 
std::istream & ReadValue (const AttributeName &name, std::istream &instr)
 
DistiAttributeBaseGet (const AttributeName &name) const
 
bool IsEqual (const AttributeName &name, const long val) const
 
void Remove (const AttributeName &name)
 

Static Public Member Functions

static void SpacingInc ()
 
static void SpacingDec ()
 
static void SpacingZero ()
 
static std::string SpacingString ()
 
static bool ScanToken (std::istream &instr, std::string &result)
 

Static Public Attributes

static unsigned int _currentFileVersionMajor
 
static unsigned int _currentFileVersionMinor
 
static unsigned int _currentFileVersionBuild
 
static double _currentFileVersionPrimary
 
static long _currentFileVersionSecondary
 
static int currentOutputSpacing
 

Detailed Description

The Attribute Dictionary is a container for DistiAttributeBase derived objects

Member Typedef Documentation

Allows for easy access to the contained class type

Constructor & Destructor Documentation

Constructor

Destructor

DistiAttribDict ( DistiAttribDict &&  other)
inline

Move constructor

Member Function Documentation

void Add ( DistiAttributeBase attr)

Adds the specified Attribute to the list. The object passed in becomes the responsibility of this class, and should NOT be deleted by the caller. It will be deleted by this class as needed

void Clear ( )

Removes all elements in the list, deleting the data as it goes

void CopyCommonValues ( const DistiAttribDict dict)

Copies the values for all items which have matching names between this object and dict. All other values are ignored

int Count ( ) const

Returns the current number of elements in the dictionary

int Count ( const AttributeName name) const

Returns the number of elements with the same name in the dictionary

void Delete ( const AttributeName name)

Removes the attribute specified by name from the dictionary and deletes the data. This does actually delete the attribute.

DistiAttributeBase* Get ( const AttributeName name) const

Returns the DistiAttributeBase* for the specified name If not found it returns NULL

bool IsEqual ( const AttributeName name,
const long  val 
) const

Retuns a comparison of val with ValueInt() of the attribute looked up by name Returns false if not found

DistiAttribDict& operator= ( DistiAttribDict &&  other)
inline

Move Assignment

DistiAttribDict& operator= ( const DistiAttribDict dict)
inline

Copies the values for all items which have matching names between this object and dict. All other values are ignored

Deprecated:
Use CopyCommonValues() instead.
bool operator== ( const DistiAttribDict other)

Equality operator Compares length, names and values. order does not matter

bool Read ( std::istream &  instr)

Reads multiple attributes from the stream expecting the form: "NAME: VALUE" Returns true if something was found and set.

bool ReadAndCaptureMissing ( std::istream &  instr,
std::stringstream *  missingStream 
)

Reads multiple attributes from the stream expecting the form: "NAME: VALUE" missing stream is filled with attributes that were not in the dictionary Returns true if something was found and set.

void ReadStrings ( std::istream &  instr)

Reads a stream, expecting each line to be of the form NAME: SomeStringValue For each line a new DistiAttribute<std::string> is created, and the remaining line is placed as it's value. This is intended for special uses and is not considered the 'normal' mode of operation

std::istream& ReadValue ( const AttributeName name,
std::istream &  instr 
)

Calls ReadValue() for the attribute specified by name

void Remove ( const AttributeName name)

Removes the attribute specified by name This does NOT actually delete the attribute, just removes it from the dictionary.

static bool ScanToken ( std::istream &  instr,
std::string &  result 
)
static

Static method used for parsing a stream Used internally and Exposed here so others can use it.

static void SpacingDec ( )
static

Static, Decrements the current spacing

static void SpacingInc ( )
static

Static, Increments the current spacing

static std::string SpacingString ( )
static

Static, Returns a string containing the current spacing

static void SpacingZero ( )
static

Static, Sets the spacing to zero

long ValueInt ( const AttributeName name) const

Gets the ValueInt() of the named attribute

void ValueInt ( const AttributeName name,
long  val 
)

Sets the ValueInt() of the named attribute

std::string ValueString ( const AttributeName name) const

Returns the std::string value of the attribute specified by name Returns "" if not found Internally it uses ValueString() from the attribute

void ValueString ( const AttributeName name,
const std::string &  val 
)

Sets the attribute of named 'name' to the value of 'val' If name is not found, there is no indication

void Write ( std::ostream &  outstr,
bool  changedDataOnly = false 
)

Writes all items in the dictionary to the stream in the form: "NAME: VALUE" If changedDataOnly is true, only items which return ValueChanged() == true will be written.

std::ostream& WriteValue ( const AttributeName name,
std::ostream &  outstr 
)

Calls WriteValue() for the attribute specified by name

Member Data Documentation

unsigned int _currentFileVersionBuild
static
unsigned int _currentFileVersionMajor
static

Used as needed for version specific parsing Whenever a version is parsed, the results should be stored here. This does add order dependency.

Note: These are not set or used by the DistiAttribDict class they are here to be set and accessed by the derived Attributes. Since they are shared by all instances of DistiAttribDict, they are only valid while the dictionary is parsing a file.

unsigned int _currentFileVersionMinor
static
double _currentFileVersionPrimary
static
Deprecated:
Do not use. Will be removed in a later version.
long _currentFileVersionSecondary
static
Deprecated:
Do not use. Will be removed in a later version.
int currentOutputSpacing
static

Static, data for formating output


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