GL Studio API
Classes | Public Member Functions | Friends | List of all members
AttributeName Class Reference

#include <disti_metadata.h>

Public Member Functions

 AttributeName (const std::string &name)
 
 AttributeName (const char *name)
 
 AttributeName (long stringIndex)
 
long StringIndex () const
 
bool operator== (const AttributeName &other) const
 
bool operator!= (const AttributeName &other) const
 
 operator std::string () const
 

Friends

std::ostream & operator<< (std::ostream &outstr, const AttributeName &name)
 
bool operator== (const AttributeName &lName, const char *rName)
 

Detailed Description

AttributeName class can be treated like a std::string in some instances It creates static storage for any referenced name. This results in only one copy for each name which saves memory Very fast comparison between references to names

Constructor & Destructor Documentation

AttributeName ( const std::string &  name)
explicit

Constructor Explicit because construction of an AttributeName is an expensive operation. If possible you should use a static AttrbuteName object rather than constructing a new one each time it is needed.

Parameters
namethe desired Name
AttributeName ( const char *  name)
explicit

Constructor See comments on AttributeName(const std::string &name)

Parameters
namethe desired Name
AttributeName ( long  stringIndex)
explicit

Constructor

Parameters
stringIndexThe index into the string map.

Member Function Documentation

operator std::string ( ) const

Defines the cast operator to make this look like a std::string for reading

bool operator!= ( const AttributeName other) const

Compares this string for inequality to the specified AttributeName. This compare is very fast compared to doing string compares, and is one of the primary reasons for creating this class

bool operator== ( const AttributeName other) const

Compares this string to the specified AttributeName. This compare is very fast compared to doing string compares, and is one of the primary reasons for creating this class

long StringIndex ( ) const

Returns the index to the string associate with this instance

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  outstr,
const AttributeName name 
)
friend

More pretending to be a std::string. Returns a C string pointer to the actual name Defines the stream out operator

bool operator== ( const AttributeName lName,
const char *  rName 
)
friend

Defines various == operators which makes the users syntax easier


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