controlreply.cpp

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If 
00004 **  you did not receive the LICENSE file with this file, you may obtain it
00005 **  from the Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to
00008 **  the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file controlreply.cpp
00013 ** \version $Id: controlreply.cpp 2362 2008-02-29 04:30:11Z edmanm $
00014 ** \brief A response from Tor's control interface
00015 */
00016 
00017 #include "controlreply.h"
00018 
00019 /** Default constructor */
00020 ControlReply::ControlReply()
00021 {
00022 }
00023 
00024 /** Add a line associated with this reply */
00025 void
00026 ControlReply::appendLine(ReplyLine line)
00027 {
00028   _lines << line;
00029 }
00030 
00031 /** Returns the requested line from this reply */
00032 ReplyLine
00033 ControlReply::getLine(int idx) const
00034 {
00035   return _lines.at(idx);
00036 }
00037 
00038 /** Returns all lines for this reply */
00039 QList<ReplyLine>
00040 ControlReply::getLines() const
00041 {
00042   return _lines;
00043 }
00044 
00045 /** Returns the status of the first line in the reply */
00046 QString
00047 ControlReply::getStatus() const
00048 {
00049   return getLine().getStatus();
00050 }
00051 
00052 /** Returns the message of the first line in the reply */
00053 QString
00054 ControlReply::getMessage() const
00055 {
00056   return getLine().getMessage();
00057 }
00058 
00059 /** Returns the data for the first line in the reply. */
00060 QStringList
00061 ControlReply::getData() const
00062 {
00063   return getLine().getData();
00064 }
00065 
00066 /** Returns the entire contents of the control reply. */
00067 QString
00068 ControlReply::toString() const
00069 {
00070   QString str;
00071   foreach (ReplyLine line, _lines) {
00072     str.append(line.toString());
00073     str.append("\n");
00074   }
00075   return str.trimmed();
00076 }
00077 

Generated on Sat Aug 16 17:31:48 2008 for Vidalia by  doxygen 1.5.6