LRAUV  revA
ParsedCommand Class Reference

#include <Command.h>

Collaboration diagram for ParsedCommand:

Public Member Functions

 ParsedCommand ()
 
int getArgCount ()
 Returns the parsed arg count. More...
 
void undefTopArg ()
 Undefine top arg on the stack. More...
 
void clearTopArg ()
 Clears the top arg on the stack. More...
 
void clearAll ()
 Clears everything. More...
 
int getStart ()
 Returns first argStart. More...
 
void setStart (int start)
 Sets first argStart. More...
 
int getArgStart (int index)
 Returns argStart at the specified index Negative indices count backwards from the top. More...
 
int getArgLen (int index)
 Returns argLen at the specified index Negative indices count backwards from the top. More...
 
const CommandgetCommand () const
 
const CommandSyntaxgetSyntax () const
 
const CommandgetCommandArg () const
 
const CodedStrgetComponentArg () const
 
const StrgetConfigDirArg () const
 
const DecimationLogWriter::DecimationType getDecimationTypeArg () const
 
const StrgetMissionArg () const
 
const LogWriter::ServiceType getServiceTypeArg () const
 
const StrgetStringArg () const
 
const bool isInQuotedString () const
 
void setStringArg (const Str &stringArg)
 
const StrgetRegexArg () const
 
int getIntegerArg () const
 
float getNumberArg () const
 
const TimestampgetTimestampArg () const
 
const StrgetTokenArg () const
 
const UnitgetUnitArg () const
 
const UniversalURIgetUniversalArg () const
 
const ElementURIgetVariableArg () const
 
bool parseBufferEnd (FlexArray< Command * > &commands, const char *buffer, int index)
 If the last word in buffer is a valid arg, deal with it. More...
 
bool completeArg (FlexArray< Command * > &commands, CommandLine *commandLine, const char *buffer, int index)
 
void execute (Logger &logger)
 
Str toString ()
 
bool hasArgIndex (int argIndex)
 
CommandArgType getCurrentArgType ()
 

Protected Member Functions

bool findArg (FlexArray< Command * > &commands, const char *buffer, int len)
 Report if a valid arg matches the supplied arg. More...
 
void implySyntax ()
 If the last word in buffer is a valid arg, deal with it. More...
 
bool syntaxOk ()
 
MatchType orMatch (MatchType mt1, MatchType mt2)
 
MatchType matchArg (FlexArray< Command * > &commands, const CommandArg *arg, int argIndex, const char *buffer, int len)
 
MatchType matchUnique (int synArgIndex, CommandArgType argType)
 
MatchType matchCommand (FlexArray< Command * > &commands, Command *&command, int synArgIndex, const char *buffer, int len)
 Report if a command name matches the supplied arg. More...
 
bool completeCommand (FlexArray< Command * > &commands, CommandLine *commandLine, const char *buffer, int len)
 
MatchType matchComponent (int synArgIndex, const char *buffer, int len)
 
MatchType matchConfigDir (int synArgIndex, const char *buffer, int len)
 
MatchType matchConfigSubDir (const Str &subDir, int synArgIndex, const char *buffer, int len)
 
MatchType matchConfigVariable (int synArgIndex, const char *buffer, int len)
 
MatchType matchDecimationType (int synArgIndex, const char *buffer, int len)
 
MatchType matchFloat (int synArgIndex, const char *buffer, int len)
 
MatchType matchInteger (int synArgIndex, const char *buffer, int len)
 
MatchType matchKeyword (const char *keyword, int keywordLen, int synArgIndex, const char *buffer, int len)
 
MatchType matchMission (int synArgIndex, const char *buffer, int len)
 
MatchType matchQuotedString (int synArgIndex, const char *buffer, int len)
 
MatchType matchRegex (int synArgIndex, const char *buffer, int len)
 
MatchType matchSeconds (int synArgIndex, const char *buffer, int len)
 
MatchType matchServiceType (int synArgIndex, const char *buffer, int len)
 
MatchType matchString (int synArgIndex, const char *buffer, int len)
 
MatchType matchTimestamp (int synArgIndex, const char *buffer, int len)
 
MatchType matchToken (int synArgIndex, const char *buffer, int len)
 
MatchType matchUnit (int synArgIndex, const char *buffer, int len)
 
MatchType matchUniversal (int synArgIndex, const char *buffer, int len)
 
MatchType matchVariable (int synArgIndex, const char *buffer, int len)
 

Protected Attributes

int start_
 
int argCount_
 
int argStart_ [MAX_ARGS]
 
int argIndex_ [MAX_ARGS]
 
int argLen_ [MAX_ARGS]
 
MatchType argMatch_ [MAX_ARGS]
 
CommandArgType argType_ [MAX_ARGS]
 
Commandcommand_
 
CommandSyntaxsyntax_
 
CommandcommandArg_
 
CommandArgcurrentArg_
 
const CodedStrcomponentArg_
 
Str configDirArg_
 
DecimationLogWriter::DecimationType decimationTypeArg_
 
Str missionArg_
 
LogWriter::ServiceType serviceTypeArg_
 
Str stringArg_
 
Str regexArg_
 
int integerArg_
 
float numberArg_
 
Timestamp timestampArg_
 
Str tokenArg_
 
const UnitunitArg_
 
const UniversalURIuniversalArg_
 
const ElementURIvariableArg_
 
bool inQuotedString_
 

Private Member Functions

 ParsedCommand (const ParsedCommand &old)
 

Constructor & Destructor Documentation

ParsedCommand::ParsedCommand ( )
ParsedCommand::ParsedCommand ( const ParsedCommand old)
private

Member Function Documentation

void ParsedCommand::clearAll ( )
void ParsedCommand::clearTopArg ( )

Clears the top arg on the stack.

References ARG_NONE, argCount_, argIndex_, argLen_, argMatch_, argStart_, argType_, command_, currentArg_, MATCH_NONE, syntax_, and undefTopArg().

Referenced by clearAll(), and parseBufferEnd().

bool ParsedCommand::completeArg ( FlexArray< Command * > &  commands,
CommandLine commandLine,
const char *  buffer,
int  index 
)
bool ParsedCommand::completeCommand ( FlexArray< Command * > &  commands,
CommandLine commandLine,
const char *  buffer,
int  len 
)
protected
int ParsedCommand::getArgCount ( )
inline

Returns the parsed arg count.

References argCount_.

Referenced by CommandLine::commandSet().

int ParsedCommand::getArgLen ( int  index)
inline

Returns argLen at the specified index Negative indices count backwards from the top.

References argCount_, and argStart_.

int ParsedCommand::getArgStart ( int  index)
inline

Returns argStart at the specified index Negative indices count backwards from the top.

References argCount_, and argStart_.

const Command* ParsedCommand::getCommand ( ) const
inline

References command_.

const Command* ParsedCommand::getCommandArg ( ) const
inline

References commandArg_.

Referenced by CommandLine::commandHelp().

const CodedStr* ParsedCommand::getComponentArg ( ) const
inline
const Str& ParsedCommand::getConfigDirArg ( ) const
inline
CommandArgType ParsedCommand::getCurrentArgType ( )
const DecimationLogWriter::DecimationType ParsedCommand::getDecimationTypeArg ( ) const
inline
const Str& ParsedCommand::getMissionArg ( ) const
inline
const Str& ParsedCommand::getRegexArg ( ) const
inline
const LogWriter::ServiceType ParsedCommand::getServiceTypeArg ( ) const
inline
int ParsedCommand::getStart ( )
inline

Returns first argStart.

References start_.

Referenced by CommandLine::completeArg(), and CommandLine::parseBufferEnd().

const CommandSyntax* ParsedCommand::getSyntax ( ) const
inline

References syntax_.

Referenced by CommandLine::commandShowDependencies().

const Timestamp& ParsedCommand::getTimestampArg ( ) const
inline

References timestampArg_.

Referenced by CommandLine::commandSchedule().

const Str& ParsedCommand::getTokenArg ( ) const
inline
const Unit* ParsedCommand::getUnitArg ( ) const
inline
const UniversalURI* ParsedCommand::getUniversalArg ( ) const
inline

References universalArg_.

Referenced by CommandLine::commandShowBest().

bool ParsedCommand::hasArgIndex ( int  argIndex)
void ParsedCommand::implySyntax ( )
protected

If the last word in buffer is a valid arg, deal with it.

If we need to toss the last character, return false.

References ARG_NONE, argCount_, argLen_, argType_, command_, CommandSyntax::getRequiredArgSize(), Command::getSyntax(), Command::getSyntaxCount(), CommandSyntax::setAltSyntax(), and syntax_.

Referenced by execute(), and parseBufferEnd().

const bool ParsedCommand::isInQuotedString ( ) const
inline

References inQuotedString_.

Referenced by CommandLine::parseBufferEnd().

MatchType ParsedCommand::matchCommand ( FlexArray< Command * > &  commands,
Command *&  command,
int  synArgIndex,
const char *  buffer,
int  len 
)
protected

Report if a command name matches the supplied arg.

If so, deal with it.

References ARG_COMMAND, argCount_, argIndex_, argType_, FlexArray< T >::get(), Command::getKeyword(), MATCH_MANY, MATCH_NONE, MATCH_UNIQUE, and FlexArrayBase::size().

Referenced by findArg(), and matchArg().

MatchType ParsedCommand::matchComponent ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchConfigDir ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References Str::EMPTY_STR, matchConfigSubDir(), and orMatch().

Referenced by matchArg().

MatchType ParsedCommand::matchConfigSubDir ( const Str subDir,
int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchConfigVariable ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchDecimationType ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchFloat ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_FLOAT, MATCH_NONE, matchUnique(), and numberArg_.

Referenced by matchArg().

MatchType ParsedCommand::matchInteger ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_INT, integerArg_, MATCH_NONE, and matchUnique().

Referenced by matchArg().

MatchType ParsedCommand::matchKeyword ( const char *  keyword,
int  keywordLen,
int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_KEYWORD, MATCH_NONE, and matchUnique().

Referenced by matchArg().

MatchType ParsedCommand::matchMission ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchQuotedString ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchRegex ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_REGEX, matchUnique(), and regexArg_.

Referenced by matchArg().

MatchType ParsedCommand::matchSeconds ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_SECONDS, MATCH_NONE, matchUnique(), and numberArg_.

Referenced by matchArg().

MatchType ParsedCommand::matchServiceType ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchString ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_STRING, MATCH_NONE, matchUnique(), and stringArg_.

Referenced by matchArg().

MatchType ParsedCommand::matchTimestamp ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchToken ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected

References ARG_TOKEN, MATCH_NONE, matchUnique(), and tokenArg_.

Referenced by matchArg().

MatchType ParsedCommand::matchUnit ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchUniversal ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::matchVariable ( int  synArgIndex,
const char *  buffer,
int  len 
)
protected
MatchType ParsedCommand::orMatch ( MatchType  mt1,
MatchType  mt2 
)
inlineprotected

References MATCH_MANY, MATCH_NONE, and MATCH_UNIQUE.

Referenced by matchConfigDir().

bool ParsedCommand::parseBufferEnd ( FlexArray< Command * > &  commands,
const char *  buffer,
int  index 
)

If the last word in buffer is a valid arg, deal with it.

If we need to toss the last character, return false.

References ARG_NONE, ARG_QUOTED_STRING, ARG_STRING, argCount_, argLen_, argMatch_, argStart_, argType_, clearTopArg(), findArg(), CommandSyntax::getArgCount(), implySyntax(), MATCH_UNIQUE, syntax_, and syntaxOk().

Referenced by CommandLine::parseBufferEnd().

void ParsedCommand::setStart ( int  start)
inline

Sets first argStart.

References start_.

Referenced by CommandLine::parseBufferEnd().

void ParsedCommand::setStringArg ( const Str stringArg)
inline

References stringArg_.

Referenced by DataReceiver::Receive().

bool ParsedCommand::syntaxOk ( )
protected

Member Data Documentation

int ParsedCommand::argLen_[MAX_ARGS]
protected
MatchType ParsedCommand::argMatch_[MAX_ARGS]
protected
int ParsedCommand::argStart_[MAX_ARGS]
protected
Command* ParsedCommand::command_
protected
Command* ParsedCommand::commandArg_
protected
const CodedStr* ParsedCommand::componentArg_
protected
Str ParsedCommand::configDirArg_
protected
CommandArg* ParsedCommand::currentArg_
protected
DecimationLogWriter::DecimationType ParsedCommand::decimationTypeArg_
protected
bool ParsedCommand::inQuotedString_
protected

Referenced by isInQuotedString(), and matchArg().

int ParsedCommand::integerArg_
protected
Str ParsedCommand::missionArg_
protected
float ParsedCommand::numberArg_
protected
Str ParsedCommand::regexArg_
protected
LogWriter::ServiceType ParsedCommand::serviceTypeArg_
protected
int ParsedCommand::start_
protected

Referenced by clearAll(), getStart(), and setStart().

Str ParsedCommand::stringArg_
protected
CommandSyntax* ParsedCommand::syntax_
protected
Timestamp ParsedCommand::timestampArg_
protected
Str ParsedCommand::tokenArg_
protected
const Unit* ParsedCommand::unitArg_
protected
const UniversalURI* ParsedCommand::universalArg_
protected
const ElementURI* ParsedCommand::variableArg_
protected

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