Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

HeyPropertyInfo Class Reference

Collaboration diagram for HeyPropertyInfo:

Collaboration graph
[legend]
List of all members.

Detailed Description

Helper class that holds descriptions of properties.

See also:
HeyParser

Definition at line 376 of file HeyParser.hh.

Public Member Functions

 HeyPropertyInfo (const char *name, unsigned int commands, const char *specifiers=NULL, const char *usage=NULL)
 Construct a description of a property.

virtual ~HeyPropertyInfo (void)
 Deconstruct a HeyPropertyInfo.

const char * getName (void) const
unsigned int getCommands (void) const
const char * getSpecifiers (void) const
const char * getUsage (void) const

Static Public Attributes

HeyPropertyInfo HPI_NULL
 Typed NULL for HeyPropertyInfo's.


Private Attributes

const char * hpi_Name
 The property's name.

unsigned int hpi_Commands
 The bitmap of commands supported by this property.

const char * hpi_Specifiers
 The string describing the specifier argument, if any.

const char * hpi_Usage
 The string describing how to use this property.


Friends

std::ostream & operator<< (std::ostream &os, const HeyPropertyInfo &hpi)
 Output stream operator for HeyPropertyInfo objects.

std::ostream & operator<< (std::ostream &os, const HeyPropertyInfo hpi[])
 Output stream operator for an HPI_NULL terminated array of HeyPropertyInfo objects.


Constructor & Destructor Documentation

HeyPropertyInfo::HeyPropertyInfo const char *  name,
unsigned int  commands,
const char *  specifiers = NULL,
const char *  usage = NULL
[inline]
 

Construct a description of a property.

For example, if a server supported the following requests on a 'string' object:

 $ hey server create string with id 2 value Foobar
 ok
 $ hey server get string 2
 Foobar
 $ hey server delete string 2
 ok
 $ hey server get string 2
 Error: No such string: 2

The 'suites' for these requests would be encoded by the following array of HeyPropertyInfo's.

 HeyPropertyInfo suites[] = {
     HeyPropertyInfo("string",
                     (1L << HeyParser::CREATE_PROPERTY),
                     "",
                     "id:int - The string's identifer.\n"
                     "value:string - The string's value.\n"
                     "\n"
                     "Create a string with the given id and value.\n"),
     HeyPropertyInfo("string",
                     (1L << HeyParser::GET_PROPERTY) |
                     (1L << HeyParser::SET_PROPERTY),
                     "id:int",
                     "Get or set the value of string 'id'.\n"),
     HeyPropertyInfo("string",
                     (1L << HeyParser::DELETE_PROPERTY),
                     "id:int",
                     "Delete a string 'id'.\n"),
     HeyPropertyInfo::HPI_NULL // TERMINATOR
 };

The first object indicates that the 'string' property supports CREATE_PROPERTY and takes two arguments, the string identifier and the string's value. The second and third objects also describe the 'string' property, but this time, they document what happens when used with the get, set, and delete actions. These objects are then grouped in an array so they can be easily sent to an output stream, like so:

   cout << suites;

The result would then look like the following:

 $ hey server getsuites
 Property:  string
   Supported verbs: create
 Create a string with the given id and value.

 Property:  string
   Supported verbs: get set
   Specifiers:  id:int
 Get or set the value of string 'id'.

 Property:  string
   Supported verbs: create
   Specifiers:  id:int
 Delete a string 'id'.

Parameters:
name The name of the property.
commands The commands supported by the property. The commands are encoded as a bitmap of the HeyParser::hp_what_t values.
specifiers A description of the specifier argument.
usage A description of the property and how to use it.

Definition at line 458 of file HeyParser.hh.

References hpi_Commands, hpi_Name, hpi_Specifiers, and hpi_Usage.


Member Function Documentation

unsigned int HeyPropertyInfo::getCommands void   )  const [inline]
 

Returns:
The bitmap of commands supported by this property.

Definition at line 487 of file HeyParser.hh.

References hpi_Commands.

const char* HeyPropertyInfo::getName void   )  const [inline]
 

Returns:
The property's name.

Definition at line 479 of file HeyParser.hh.

References hpi_Name.

const char* HeyPropertyInfo::getSpecifiers void   )  const [inline]
 

Returns:
The string describing the specifier argument, if any.

Definition at line 495 of file HeyParser.hh.

References hpi_Specifiers.

const char* HeyPropertyInfo::getUsage void   )  const [inline]
 

Returns:
The string describing how to use this property.

Definition at line 503 of file HeyParser.hh.

References hpi_Usage.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const HeyPropertyInfo  hpi[]
[friend]
 

Output stream operator for an HPI_NULL terminated array of HeyPropertyInfo objects.

Parameters:
os The destination output stream.
hpi The array to output.
Returns:
The value of the 'os' parameter.

Definition at line 550 of file HeyParser.hh.

std::ostream& operator<< std::ostream &  os,
const HeyPropertyInfo hpi
[friend]
 

Output stream operator for HeyPropertyInfo objects.

Parameters:
os The destination output stream.
hpi The object to output.
Returns:
The value of the 'os' parameter.

Definition at line 515 of file HeyParser.hh.


The documentation for this class was generated from the following files:
Generated on Mon Dec 1 16:30:34 2003 for CPU Broker by doxygen 1.3.4