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. |
|
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 458 of file HeyParser.hh. References hpi_Commands, hpi_Name, hpi_Specifiers, and hpi_Usage. |
|
Definition at line 487 of file HeyParser.hh. References hpi_Commands. |
|
Definition at line 479 of file HeyParser.hh. References hpi_Name. |
|
Definition at line 495 of file HeyParser.hh. References hpi_Specifiers. |
|
Definition at line 503 of file HeyParser.hh. References hpi_Usage. |
|
Output stream operator for an HPI_NULL terminated array of HeyPropertyInfo objects.
Definition at line 550 of file HeyParser.hh. |
|
Output stream operator for HeyPropertyInfo objects.
Definition at line 515 of file HeyParser.hh. |