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

HeyParser Class Reference

List of all members.

Detailed Description

A parser for command-line arguments given in the pseudo-english "hey" form:.

See also:
hey_manager.cc

hey_strict_policy.cc


Public Types

enum  hp_what_t { LIST_PROPERTIES, GET_PROPERTY, SET_PROPERTY }
 An enumeration of the possible actions to perform on an object. More...


Public Member Functions

 HeyParser (int argc, const char *argv[]) throw (HeyParserException)
 Construct a parser that interprets the given command-line arguments.

virtual ~HeyParser ()
 Deconstruct a parser object.

const char * who (void)
hp_what_t what (void)
void popProperty (const char *&name_out, const char *&value_out) throw (HeyParserException)
 Pop a pair from the property stack.

const char * to (void) throw (HeyParserException)

Private Member Functions

const char * consumeArg (void) throw (HeyParserException)
 Consume an argument from the argument list.

void nextProperty (const char *&name_out, const char *&value_out) throw (HeyParserException)
 Find the next name/value pair in the argument list.


Private Attributes

int hp_ArgCount
 The arguments count.

const char ** hp_ArgValue
 The argument values.

hp_what_t hp_What
 The "what" value.

int hp_ArgIndex
 The current index in the argument list during processing.

stack< struct Pairhp_PropertyStack
 The stack of property pairs.


Member Enumeration Documentation

enum HeyParser::hp_what_t
 

An enumeration of the possible actions to perform on an object.

Enumeration values:
LIST_PROPERTIES  List the properties of an object.
GET_PROPERTY  Get a property from an object.
SET_PROPERTY  Set a property in an object.


Constructor & Destructor Documentation

HeyParser::HeyParser int  argc,
const char *  argv[]
throw (HeyParserException)
 

Construct a parser that interprets the given command-line arguments.

Most of the parsing will be done here so there are fewer surprises along the way.

Parameters:
argc The argument count.
argv The argument values.
Exceptions:
HeyParserException if there is a problem with the argument list.


Member Function Documentation

const char * HeyParser::consumeArg void   )  throw (HeyParserException) [private]
 

Consume an argument from the argument list.

This method is for internal use when initially processing the argument list.

Returns:
The next string in the argument list.
Exceptions:
HeyParserException if there are no more arguments to be consumed.

void HeyParser::nextProperty const char *&  name_out,
const char *&  value_out
throw (HeyParserException) [private]
 

Find the next name/value pair in the argument list.

This method differs from popProperty() in that it translates from the argument list to hp_PropertyStack. Whereas popProperty() interacts only with hp_PropertyStack.

Parameters:
name_out The reference where the property name should be stored.
value_out The reference where the property value should be stored.
Exceptions:
HeyParserException if there are insufficient arguments.

void HeyParser::popProperty const char *&  name_out,
const char *&  value_out
throw (HeyParserException)
 

Pop a pair from the property stack.

Parameters:
name_out The reference where the property name should be stored.
value_out The reference where the property value should be stored.
Exceptions:
HeyParserException if there are no more values on the stack.

const char * HeyParser::to void   )  throw (HeyParserException)
 

Returns:
The value that a property should be set to.
Exceptions:
HeyParserException if "to" was not given on the command line.

HeyParser::hp_what_t HeyParser::what void   ) 
 

Returns:
The action requested by the user (i.e. what to do).

const char * HeyParser::who void   ) 
 

Returns:
The argument that specifies which server to talk to.


Member Data Documentation

hp_what_t HeyParser::hp_What [private]
 

The "what" value.

This will only be set by the constructor when it is initially parsing the arguments.


The documentation for this class was generated from the following files:
Generated on Mon Dec 1 16:22:41 2003 for CPUBroker by doxygen 1.3.4