Vidalia  0.3.1
ControlReply.cpp
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 ControlReply.cpp
13 ** \brief A response from Tor's control interface
14 */
15 
16 #include "ControlReply.h"
17 
18 
19 /** Default constructor */
21 {
22 }
23 
24 /** Add a line associated with this reply */
25 void
27 {
28  _lines << line;
29 }
30 
31 /** Returns the requested line from this reply */
33 ControlReply::getLine(int idx) const
34 {
35  return _lines.at(idx);
36 }
37 
38 /** Returns all lines for this reply */
39 QList<ReplyLine>
41 {
42  return _lines;
43 }
44 
45 /** Returns the status of the first line in the reply */
46 QString
48 {
49  return getLine().getStatus();
50 }
51 
52 /** Returns the message of the first line in the reply */
53 QString
55 {
56  return getLine().getMessage();
57 }
58 
59 /** Returns the data for the first line in the reply. */
60 QStringList
62 {
63  return getLine().getData();
64 }
65 
66 /** Returns the entire contents of the control reply. */
67 QString
69 {
70  QString str;
71  foreach (ReplyLine line, _lines) {
72  str.append(line.toString());
73  str.append("\n");
74  }
75  return str.trimmed();
76 }
77 
QStringList getData() const
QList< ReplyLine > getLines() const
QStringList getData() const
Definition: ReplyLine.cpp:78
QString getMessage() const
Definition: ReplyLine.cpp:64
QString getStatus() const
Definition: ReplyLine.cpp:50
QString toString() const
QList< ReplyLine > _lines
Definition: ControlReply.h:48
ReplyLine getLine(int idx=0) const
void appendLine(ReplyLine line)
QString getStatus() const
QString getMessage() const
QString toString() const
Definition: ReplyLine.cpp:99