ControlCommand Class Reference

#include <controlcommand.h>

List of all members.

Public Member Functions

 ControlCommand ()
 ControlCommand (const QString &keyword)
 ControlCommand (const QString &keyword, const QString &arg)
 ControlCommand (const QString &keyword, const QStringList &args)
QString keyword () const
void setKeyword (const QString &keyword)
void addArgument (const QString &arg)
void addArguments (const QStringList &args)
void appendData (const QString &data)
QString toString () const

Private Member Functions

QString escape (const QString &str) const

Private Attributes

QString _keyword
QStringList _arguments
QStringList _data

Detailed Description

Definition at line 23 of file controlcommand.h.


Constructor & Destructor Documentation

ControlCommand::ControlCommand (  ) 

Default constructor.

Definition at line 21 of file controlcommand.cpp.

ControlCommand::ControlCommand ( const QString &  keyword  ) 

Creates a command using the specified keyword.

Definition at line 26 of file controlcommand.cpp.

References _keyword.

ControlCommand::ControlCommand ( const QString &  keyword,
const QString &  arg 
)

Creates a control command using the specified keyword and argument.

Definition at line 32 of file controlcommand.cpp.

References _keyword, and addArgument().

ControlCommand::ControlCommand ( const QString &  keyword,
const QStringList &  args 
)

Creates a control command using the specified keyword and list of arguments.

Definition at line 40 of file controlcommand.cpp.

References _arguments, and _keyword.


Member Function Documentation

void ControlCommand::addArgument ( const QString &  arg  ) 
void ControlCommand::addArguments ( const QStringList &  args  ) 

Adds all arguments in args to this control command.

Definition at line 62 of file controlcommand.cpp.

References addArgument().

Referenced by TorControl::getConf(), and TorControl::getInfo().

void ControlCommand::appendData ( const QString &  data  ) 

Append a data line for this control command

Adds data to the end of this command.

Definition at line 71 of file controlcommand.cpp.

References _data.

QString ControlCommand::escape ( const QString &  unescaped  )  const [private]

Escape special characters in the supplied string

Escapes any special characters in this command.

Definition at line 78 of file controlcommand.cpp.

Referenced by toString().

QString ControlCommand::keyword (  )  const [inline]

Returns the keyword for this control command.

Definition at line 32 of file controlcommand.h.

References _keyword.

Referenced by ControlConnection::send().

void ControlCommand::setKeyword ( const QString &  keyword  ) 

Set the keyword for this control command

Sets the keyword for this command.

Definition at line 48 of file controlcommand.cpp.

References _keyword.

QString ControlCommand::toString (  )  const

Format this control command into a format conforming to Tor's v1 protocol specification.

Formats a command according to Tor's Control Protocol V1. The proper format of a command is as follows:

Command = Keyword Arguments CRLF / "+" Keyword Arguments CRLF Data Keyword = 1*ALPHA Arguments = *(SP / VCHAR)

Definition at line 100 of file controlcommand.cpp.

References _arguments, _data, _keyword, escape(), and i().

Referenced by ControlSocket::sendCommand().


Member Data Documentation

QStringList ControlCommand::_arguments [private]

Definition at line 54 of file controlcommand.h.

Referenced by addArgument(), ControlCommand(), and toString().

QStringList ControlCommand::_data [private]

Definition at line 55 of file controlcommand.h.

Referenced by appendData(), and toString().

QString ControlCommand::_keyword [private]

Definition at line 53 of file controlcommand.h.

Referenced by ControlCommand(), keyword(), setKeyword(), and toString().


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

Generated on 2 Sep 2009 for Vidalia by  doxygen 1.6.1