DUNE: Uniform Navigational Environment  2019.02.1
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

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.

Referenced by Transports::FTP::Session::~Session().

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

Retrieve the parameters of the last parsed command.

Returns
command parameters.

Referenced by Transports::FTP::Session::~Session().

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.

Referenced by Transports::FTP::Session::~Session().

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