00001 // packet.hh 00002 // Jabber client library 00003 // 00004 // Original Code Copyright (C) 1999-2001 Dave Smith (dave@jabber.org) 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License, or (at your option) any later version. 00010 // 00011 // This library 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 GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // Contributor(s): Julian Missig 00021 // 00022 // This Original Code has been modified by IBM Corporation. Modifications 00023 // made by IBM described herein are Copyright (c) International Business 00024 // Machines Corporation, 2002. 00025 // 00026 // Date Modified by Description of modification 00027 // 01/20/2002 IBM Corp. Updated to libjudo 1.1.1 00028 // 2002-03-05 IBM Corp. Updated to libjudo 1.1.5 00029 // 2002-07-09 IBM Corp. Added Roster::getSession() 00030 // 00031 // ===================================================================================== 00032 #ifndef PACKET_HH 00033 #define PACKET_HH 00034 00035 #include <judo.hpp> 00036 00037 namespace jabberoo { 00042 class Packet 00043 { 00044 public: 00050 Packet(const std::string& name); 00051 00057 Packet(const judo::Element& t); 00058 00059 // Common ops 00064 const std::string getFrom() const; 00065 00070 const std::string getTo() const; 00071 00076 const std::string getID() const; 00077 00082 const std::string getError() const; 00083 00088 const int getErrorCode() const; 00089 00094 const std::string toString() const; 00095 00101 const judo::Element& getBaseElement() const; 00102 00107 void setFrom(const std::string& from); 00108 00113 void setTo(const std::string& to); 00114 00119 void setID(const std::string& id); 00120 00121 00130 judo::Element* addX(); 00131 00140 judo::Element* addX(const std::string& tnamespace); 00141 00148 judo::Element* findX(const std::string& tnamespace) const; 00149 00157 void eraseX(const std::string& tnamespace); 00158 00164 judo::Element& getBaseElement(); 00165 00166 protected: 00167 judo::Element _base; 00168 }; 00169 } // namespace jabberoo 00170 00171 #endif // PACKET_HH