DUNE: Uniform Navigational Environment  2016.05.0
Transports::FTP::CommandParser Class Reference

Detailed Description

Implementation of a simple FTP command parser.

This class breaks lines into commands and splits the command into code and parameters.

Author
Ricardo Martins

Public Types

enum  Result { RES_NONE, RES_CMD, RES_ERR_SYN }
 

Public Member Functions

 CommandParser (void)
 
void clear (void)
 
const std::string & getCode (void) const
 
const std::string & getParameters (void) const
 
Result parse (char byte)
 

Member Enumeration Documentation

Parser results.

Enumerator
RES_NONE 

No command is available yet.

RES_CMD 

One command was successfuly parsed.

RES_ERR_SYN 

Found a syntax error while parsing command.

Constructor & Destructor Documentation

Transports::FTP::CommandParser::CommandParser ( void  )
inline

Default constructor, initializes parser to a sane state.

References clear().

Member Function Documentation

void Transports::FTP::CommandParser::clear ( void  )
inline

Reset the parser's internal state.

Referenced by CommandParser(), and parse().

const std::string& Transports::FTP::CommandParser::getCode ( void  ) const
inline

Retrieve the code of the last parsed command.

Returns
command code.
const std::string& Transports::FTP::CommandParser::getParameters ( void  ) const
inline

Retrieve the parameters of the last parsed command.

Returns
command parameters.
Result Transports::FTP::CommandParser::parse ( char  byte)
inline

Parse one byte of data.

Returns
see Result.

References clear(), RES_CMD, RES_ERR_SYN, and RES_NONE.

Collaboration diagram for Transports::FTP::CommandParser:
Collaboration graph