Main Page   Class Hierarchy   Compound List   Compound Members   Examples  

TPT::Object Class Reference

#include <object.h>

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 Methods

 Object ()
 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 ()
void deallocate ()
Object& operator= (const std::string &s)
Object& operator= (const ArrayType &a)
Object& operator= (const HashType &h)
Object& operator= (const TokenType &tok)
Object& operator= (const Object &obj) throw (tptexception)
Object& operator= (obj_types t) throw (tptexception)
 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)


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:
t   The type of object to be set

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

Construct an object of a scalar std::string.

Parameters:
str   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:
array   Array to be copied into this object.
Returns:
nothing

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

Construct an object of a hash of objects.

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

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

Construct an object of a token of objects.

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


Member Function Documentation

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

Get this object's array of objects

Parameters:
none  
Returns:
Reference to this object's array of object. @except tptexception

void TPT::Object::deallocate ( )
 

Deallocate this object and any objects it cointains.

Parameters:
none  
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

Parameters:
none  
Returns:
Reference to this object's hash of objects. @except tptexception

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:
false on success; true on success;

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 of objects to this object.

Parameters:
token   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:
hash   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:
array   Array to be copied into this object.
Returns:
reference to this object.

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

Copy a scalar string to this object.

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

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

Get this object's string

Parameters:
none  
Returns:
Reference to this object's string. @except 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

Parameters:
none  
Returns:
Reference to this object's token. @except tptexception


The documentation for this class was generated from the following files:
Generated at Tue Sep 10 23:32:47 2002 for LibTPT by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001