controlreply.cpp

Go to the documentation of this file.
00001 /****************************************************************
00002  *  Vidalia is distributed under the following license:
00003  *
00004  *  Copyright (C) 2006,  Matt Edman, Justin Hipple
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00019  *  Boston, MA  02110-1301, USA.
00020  ****************************************************************/
00021 
00022 /** 
00023  * \file controlreply.cpp
00024  * \version $Id: controlreply.cpp 1735 2007-05-13 07:23:57Z edmanm $
00025  * \brief A response from Tor's control interface
00026  */
00027 
00028 #include "controlreply.h"
00029 
00030 /** Default constructor */
00031 ControlReply::ControlReply()
00032 {
00033 }
00034 
00035 /** Add a line associated with this reply */
00036 void
00037 ControlReply::appendLine(ReplyLine line)
00038 {
00039   _lines << line;
00040 }
00041 
00042 /** Returns the requested line from this reply */
00043 ReplyLine
00044 ControlReply::getLine(int idx) const
00045 {
00046   return _lines.at(idx);
00047 }
00048 
00049 /** Returns all lines for this reply */
00050 QList<ReplyLine>
00051 ControlReply::getLines() const
00052 {
00053   return _lines;
00054 }
00055 
00056 /** Returns the status of the first line in the reply */
00057 QString
00058 ControlReply::getStatus() const
00059 {
00060   return getLine().getStatus();
00061 }
00062 
00063 /** Returns the message of the first line in the reply */
00064 QString
00065 ControlReply::getMessage() const
00066 {
00067   return getLine().getMessage();
00068 }
00069 
00070 /** Returns the data for the first line in the reply. */
00071 QStringList
00072 ControlReply::getData() const
00073 {
00074   return getLine().getData();
00075 }
00076 
00077 /** Returns the entire contents of the control reply. */
00078 QString
00079 ControlReply::toString() const
00080 {
00081   QString str;
00082   foreach (ReplyLine line, _lines) {
00083     str.append(line.toString());
00084     str.append("\n");
00085   }
00086   return str.trimmed();
00087 }
00088 

Generated on Wed Sep 5 15:49:27 2007 for Vidalia by  doxygen 1.5.3