Definition at line 378 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. |
|
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'.
Definition at line 460 of file HeyParser.hh. |
|
Definition at line 489 of file HeyParser.hh. |
|
Definition at line 481 of file HeyParser.hh. |
|
Definition at line 497 of file HeyParser.hh. |
|
Definition at line 505 of file HeyParser.hh. |
|
Output stream operator for an HPI_NULL terminated array of HeyPropertyInfo objects.
Definition at line 552 of file HeyParser.hh. |
|
Output stream operator for HeyPropertyInfo objects.
Definition at line 517 of file HeyParser.hh. |