Vidalia 0.2.10
|
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 ReplyLine.h 00013 ** \version $Id: ReplyLine.h 3735 2009-04-28 20:28:01Z edmanm $ 00014 ** \brief Reply from a previous control command sent to Tor 00015 */ 00016 00017 #ifndef _REPLYLINE_H 00018 #define _REPLYLINE_H 00019 00020 #include <QStringList> 00021 00022 00023 class ReplyLine 00024 { 00025 public: 00026 ReplyLine(); 00027 ReplyLine(const QString &status, const QString &message); 00028 ReplyLine(const QString &status, const QString &message, const QString &data); 00029 00030 /** Set the status code to <b>status</b>. */ 00031 void setStatus(const QString &status); 00032 /** Returns the status code for this reply line. */ 00033 QString getStatus() const; 00034 00035 /** Sets the ReplyText message this reply line to <b>msg</b>. */ 00036 void setMessage(const QString &msg); 00037 /** Returns the ReplyText portion of this reply line. */ 00038 QString getMessage() const; 00039 00040 /** Appends <b>data</b> to this reply line. */ 00041 void appendData(const QString &data); 00042 /** Returns a QStringList of all data lines for this reply line. */ 00043 QStringList getData() const; 00044 /** Returns true if this reply contained a data portion. */ 00045 bool hasData() const { return _data.size() > 0; } 00046 00047 /** Returns the entire contents of this reply line, including the status, 00048 * message, and any extra data. */ 00049 QString toString() const; 00050 00051 private: 00052 /** Unescapes special characters in <b>str</b> and returns the unescaped 00053 * result. */ 00054 static QString unescape(const QString &escaped); 00055 00056 QString _status; /**< Response status code. */ 00057 QString _message; /**< ReplyText portion of this reply line. */ 00058 QStringList _data; /**< Contents of any DataReplyLines in this line. */ 00059 }; 00060 00061 #endif 00062