Main Page | Compound List | Compound Members | Examples

TPT::Object Class Reference

List of all members.

Public Types

typedef notboost::shared_ptr<
Object
PtrType
typedef std::vector< PtrType > ArrayType
typedef std::map< std::string,
PtrType > 
HashType
typedef Token TokenType
enum  obj_types {
  type_notalloc = 0, type_scalar, type_array, type_hash,
  type_token
}

Public Member Functions

 Object (obj_types t) throw (tptexception)
 Object (const Object &obj) throw (tptexception)
 Object (const std::string &s)
 Object (const char *str)
 Object (const ArrayType &a)
 Object (const HashType &h)
 Object (const TokenType &tok)
 Object (const TArrayType &v)
 Object (const THashType &h)
void deallocate ()
Objectoperator= (const std::string &s)
Objectoperator= (const char *s)
Objectoperator= (const ArrayType &a)
Objectoperator= (const HashType &h)
Objectoperator= (const TokenType &tok)
Objectoperator= (const Object &obj) throw (tptexception)
Objectoperator= (obj_types t) throw (tptexception)
Objectoperator= (const TArrayType &v)
Objectoperator= (const THashType &h)
 operator bool ()
bool exists (const std::string &key)
obj_types gettype () const
void settype (obj_types t) throw (tptexception)
std::string & scalar () throw (tptexception)
ArrayType & array () throw (tptexception)
HashType & hash () throw (tptexception)
TokenType & token () throw (tptexception)
Objectoperator[] (unsigned) throw (tptexception)
Objectoperator[] (const std::string &k) throw (tptexception)
Objectoperator[] (const char *k) throw (tptexception)

Detailed Description

The Object class is used to represent a generic object of type scalar, array, or hash.

Use Object::gettype() to determine the type of object before calling the corresponding method: Object::scalar(), Object::array(), Object::hash().


Constructor & Destructor Documentation

TPT::Object::Object obj_types  t  )  throw (tptexception) [explicit]
 

Construct an object of the specified type.

Parameters:
t The type of object to be set

TPT::Object::Object const Object obj  )  throw (tptexception)
 

Construct a copy of another object.

Parameters:
obj The type of object to be set

TPT::Object::Object const std::string &  s  ) 
 

Construct an object of a scalar std::string.

Parameters:
s std::string to be copied into this object.
Returns:
nothing

TPT::Object::Object const char *  str  ) 
 

Construct an object of a scalar std::string from a char*.

Parameters:
str std::string to be copied into this object.
Returns:
nothing

TPT::Object::Object const ArrayType &  a  ) 
 

Construct an object of a array of objects.

Parameters:
a Array to be copied into this object.
Returns:
nothing

TPT::Object::Object const HashType &  h  ) 
 

Construct an object of a hash of objects.

Parameters:
h Hash to be copied into this object.
Returns:
nothing

TPT::Object::Object const TokenType &  tok  ) 
 

Construct an object of a token of objects.

Parameters:
tok Token to be copied into this object.
Returns:
nothing

TPT::Object::Object const TArrayType &  v  ) 
 

Construct an object containing an array of objects.

Parameters:
v Source vector to copy into this object
Returns:
nothing

TPT::Object::Object const THashType &  h  ) 
 

Construct an object containing a hash of objects.

Parameters:
h Source hash to copy into his object.
Returns:
nothing


Member Function Documentation

Object::ArrayType & TPT::Object::array  )  throw (tptexception)
 

Get this object's array of objects

Returns:
Reference to this object's array of object.
Exceptions:
tptexception 

void TPT::Object::deallocate  ) 
 

Deallocate this object and any objects it cointains.

Returns:
nothing

bool TPT::Object::exists const std::string &  key  ) 
 

Tell if a key exists in a hash table.

Parameters:
key Key in hash
Returns:
true if key exists;

false if key does not exist or object not a hash.

Object::HashType & TPT::Object::hash  )  throw (tptexception)
 

Get this object's hash of objects

Returns:
Reference to this object's hash of objects.
Exceptions:
tptexception 

Object & TPT::Object::operator= const THashType &  h  ) 
 

Assign a hash of strings to the current object.

Parameters:
h source hash of strings
Returns:
reference to this object.

Object & TPT::Object::operator= const TArrayType &  v  ) 
 

Assign an array of strings to the current object.

Parameters:
v source vector of strings
Returns:
reference to this object.

Object & TPT::Object::operator= obj_types  t  )  throw (tptexception)
 

Change an object's type to an empty object of the specified type.

Parameters:
t The type of object to be set
Returns:
reference to this object.

Object & TPT::Object::operator= const Object obj  )  throw (tptexception)
 

Copy another object to this object.

Parameters:
obj Object to be copied into this object.
Returns:
reference to this object.

Object & TPT::Object::operator= const TokenType &  tok  ) 
 

Copy a token to this object.

Parameters:
tok Token to be copied into this object.
Returns:
reference to this object.

Object & TPT::Object::operator= const HashType &  h  ) 
 

Copy a hash of objects to this object.

Parameters:
h Hash to be copied into this object.
Returns:
reference to this object.

Object & TPT::Object::operator= const ArrayType &  a  ) 
 

Copy an array of objects to this object.

Parameters:
a Array to be copied into this object.
Returns:
reference to this object.

Object & TPT::Object::operator= const char *  s  ) 
 

Copy a scalar string to this object.

Parameters:
s C string to copy into this object.
Returns:
reference to this object.

Object & TPT::Object::operator= const std::string &  s  ) 
 

Copy a scalar string to this object.

Parameters:
s std::string to be copied into this object.
Returns:
reference to this object.

Object & TPT::Object::operator[] const char *  k  )  throw (tptexception)
 

Get the specified object member of this hash object for reading or writing. If the requested key does not yet exist, it will be initialized with an empty Object.

Parameters:
k hash key string
Returns:
Reference to Object in specified hash bucket
Exceptions:
tptexception 

Object & TPT::Object::operator[] const std::string &  k  )  throw (tptexception)
 

Get the specified object member of this hash object for reading or writing. If the requested key does not yet exist, it will be initialized with an empty Object.

Parameters:
k hash key string
Returns:
Reference to Object in specified hash bucket
Exceptions:
tptexception 

Object & TPT::Object::operator[] unsigned  n  )  throw (tptexception)
 

Get the specified object member of this array object. If the requested index does not yet exist, the array will be enlarged. All new elements will be initialized to an empty Object.

Parameters:
n array index.
Returns:
Reference to Object at specified index.
Exceptions:
tptexception 

std::string & TPT::Object::scalar  )  throw (tptexception)
 

Get this object's string

Returns:
Reference to this object's string.
Exceptions:
tptexception 

void TPT::Object::settype obj_types  t  )  throw (tptexception)
 

Change an object's type to an empty object of the specified type.

Parameters:
t The type of object to be set
Returns:
false on success;

true on success;

Object::TokenType & TPT::Object::token  )  throw (tptexception)
 

Get this object's token

Returns:
Reference to this object's token.
Exceptions:
tptexception 


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 16:06:08 2004 for LibTPT by doxygen 1.3.3