GL Studio C++ Runtime API
DistiAttribDict Class Reference

#include <disti_metadata.h>

Public Types

typedef DistiAttributeBaseAttr_t
 

Public Member Functions

 DistiAttribDict ()
 
virtual ~DistiAttribDict ()
 
DistiAttribDictoperator= (const DistiAttribDict &old_class)
 
bool operator== (const DistiAttribDict &old_class)
 
virtual void Add (DistiAttributeBase *attr)
 
int Count () const
 
int Count (const AttributeName &name) const
 
void Clear ()
 
virtual void Delete (const AttributeName &name)
 
virtual void ReadStrings (std::istream &instr)
 
virtual void Write (std::ostream &outstr, bool changedDataOnly=false)
 
virtual bool Read (std::istream &instr)
 
bool ReadAndCaptureMissing (std::istream &instr, std::stringstream *missingStream)
 
virtual std::string ValueString (const AttributeName &name) const
 
virtual void ValueString (const AttributeName &name, const std::string &val)
 
long ValueInt (const AttributeName &name) const
 
void ValueInt (const AttributeName &name, long val)
 
virtual std::ostream & WriteValue (const AttributeName &name, std::ostream &outstr)
 
virtual std::istream & ReadValue (const AttributeName &name, std::istream &instr)
 
virtual DistiAttributeBaseGet (const AttributeName &name) const
 
virtual bool IsEqual (const AttributeName &name, const long val) const
 
virtual 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

virtual ~DistiAttribDict ( )
virtual

Destructor

Member Function Documentation

virtual void Add ( DistiAttributeBase attr)
virtual

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

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

virtual void Delete ( const AttributeName name)
virtual

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

virtual DistiAttributeBase* Get ( const AttributeName name) const
virtual

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

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

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

DistiAttribDict& operator= ( const DistiAttribDict old_class)

Assignment operator Copies the values for all items which have matching names. All others are ignored

bool operator== ( const DistiAttribDict old_class)

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

virtual bool Read ( std::istream &  instr)
virtual

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.

virtual void ReadStrings ( std::istream &  instr)
virtual

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

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

Calls ReadValue() for the attribute specified by name

virtual void Remove ( const AttributeName name)
virtual

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

virtual std::string ValueString ( const AttributeName name) const
virtual

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

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

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

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

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.

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

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: