CmdParse Class Reference

#include <CmdParse.h>

Collaboration diagram for CmdParse:

Collaboration graph
[legend]

List of all members.

Public Member Functions

CDELETE CmdParse (CmdContext *icc)
void addAction (CmdAction *c)
CmdActiongetAction (char *s)
CmdContextgetContext ()
int addClassArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addInstanceArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addLine (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addStringArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addDoubleArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addFloatArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addIntegerArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addLongArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int addBooleanArg (JCPN(StringTokenizer)*st, JCPN(Vector)*args, JCPN(StringBuffer)*cb)
int parse ()
void setContextVerbose (bool noisyHelp)

Private Member Functions

 JCPN (Vector)*alist
void clearArgs (JCPN(Vector)*args)

Private Attributes

CmdContextcc


Detailed Description

Simple line parser skeleton and services. The main use is to create a particular parser piecewise by adding CmdActions to it. Stateful parsers are supported by specializing the CmdContext object. The Context is passed into each CmdAction.

Constructor & Destructor Documentation

CDELETE CmdParse::CmdParse ( CmdContext icc  ) 

Actions in the constructed parser will be called with icc as their context.


Member Function Documentation

CmdParse::JCPN ( Vector   )  [private]

CmdActions added to this parser.

void CmdParse::clearArgs ( JCPN(Vector)*  args  )  [private]

Remove strings from an internally used structure.

void CmdParse::addAction ( CmdAction c  ) 

Adds a command to the parser. Presently does not check the sanity of the command. This function needs to do some insertion with checking for duplicates if we're paranoid. As it is, this comes out in the wash at getAction. Duplication will make commands useless.

CmdAction* CmdParse::getAction ( char *  s  ) 

Returns the nearest match (by leading characters) of commands stored in the list.

CmdContext* CmdParse::getContext (  ) 

Returns the context given in the constructor, so the application destroying the parser can choose to destroy or reuse the context. If you destroy the context, destroy the parser, too.

int CmdParse::addClassArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Converts the next token to a class (per app. definition) and adds to arg list.

int CmdParse::addInstanceArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Converts the next token to an instance (per app. definition) and adds to arg list.

int CmdParse::addLine ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Converts the remaining tokens to a string and adds to arg list.

int CmdParse::addStringArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Adds the next token as a string to the arg list

int CmdParse::addDoubleArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Adds the next token as a DoubleJC

int CmdParse::addFloatArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Adds the next token as a FloatJC

int CmdParse::addIntegerArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Adds the next token as a IntegerJC

int CmdParse::addLongArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Adds the next token as a LongJC (long long)

int CmdParse::addBooleanArg ( JCPN(StringTokenizer)*  st,
JCPN(Vector)*  args,
JCPN(StringBuffer)*  cb 
)

Adds the next token as a BooleanJC (int)

int CmdParse::parse (  ) 

Main command-line processing loop. Returns 0 if the parser instance is willing to yield, and -1 if the parser instance thinks something fatal happened.

void CmdParse::setContextVerbose ( bool  noisyHelp  ) 

adjust the verbosity of the CmdContext inside.


Member Data Documentation

this parser instance's data, functions, io and others


The documentation for this class was generated from the following file:

Generated on Tue Apr 28 03:12:53 2009 for CCAFFEINE by  doxygen 1.5.5