replyline.h

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 replyline.h
00024  * \version $Id: replyline.h 1735 2007-05-13 07:23:57Z edmanm $
00025  * \brief Reply from a previous control command sent to Tor
00026  */
00027 
00028 #ifndef _REPLYLINE_H
00029 #define _REPLYLINE_H
00030 
00031 #include <QStringList>
00032 
00033 
00034 class ReplyLine
00035 {
00036 public:
00037   ReplyLine();
00038   ReplyLine(QString status, QString message);
00039   ReplyLine(QString status, QString message, QString data);
00040 
00041   /** Set the status code to <b>status</b>. */
00042   void setStatus(QString status);
00043   /** Returns the status code for this reply line. */
00044   QString getStatus() const;
00045 
00046   /** Sets the ReplyText message this reply line to <b>msg</b>. */
00047   void setMessage(QString msg);
00048   /** Returns the ReplyText portion of this reply line. */
00049   QString getMessage() const;
00050 
00051   /** Appends <b>data</b> to this reply line. */
00052   void appendData(QString data);
00053   /** Returns a QStringList of all data lines for this reply line. */
00054   QStringList getData() const;
00055   
00056   /** Returns the entire contents of this reply line, including the status,
00057    * message, and any extra data. */
00058   QString toString() const;
00059 
00060 private:
00061   /** Unescapes special characters in <b>str</b> and returns the unescaped
00062    * result. */
00063   static QString unescape(QString str);
00064   
00065   QString _status;    /**< Response status code. */
00066   QString _message;   /**< ReplyText portion of this reply line. */
00067   QStringList _data;  /**< Contents of any DataReplyLines in this line. */
00068 };
00069 
00070 #endif
00071 

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