Vidalia  0.3.1
ControlCommand.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If
4 ** you did not receive the LICENSE file with this file, you may obtain it
5 ** from the Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file ControlCommand.h
13 ** \brief A command sent to Tor's control interface
14 */
15 
16 #ifndef _CONTROLCOMMAND_H
17 #define _CONTROLCOMMAND_H
18 
19 #include <QStringList>
20 
21 
23 {
24 public:
26  ControlCommand(const QString &keyword);
27  ControlCommand(const QString &keyword, const QString &arg);
28  ControlCommand(const QString &keyword, const QStringList &args);
29 
30  /** Returns the keyword for this control command. */
31  QString keyword() const { return _keyword; }
32 
33  /** Set the keyword for this control command */
34  void setKeyword(const QString &keyword);
35 
36  /** Add an argument to this control command */
37  void addArgument(const QString &arg);
38  /** Adds all arguments in <b>args</b> to this control command. */
39  void addArguments(const QStringList &args);
40 
41  /** Append a data line for this control command */
42  void appendData(const QString &data);
43 
44  /** Format this control command into a format conforming to Tor's v1
45  * protocol specification. */
46  QString toString() const;
47 
48 private:
49  /** Escape special characters in the supplied string */
50  QString escape(const QString &str) const;
51 
52  QString _keyword;
53  QStringList _arguments;
54  QStringList _data;
55 };
56 
57 #endif
58 
QString escape(const QString &str) const
void setKeyword(const QString &keyword)
QString keyword() const
QStringList _arguments
QString toString() const
void addArguments(const QStringList &args)
void appendData(const QString &data)
QStringList _data
void addArgument(const QString &arg)