|
reSIProcate/stack
9694
|
00001 #if !defined(RESIP_PIDF_HXX) 00002 #define RESIP_PIDF_HXX 00003 00004 #include <vector> 00005 00006 #include "resip/stack/Contents.hxx" 00007 #include "rutil/Data.hxx" 00008 #include "rutil/HashMap.hxx" 00009 #include "resip/stack/Uri.hxx" 00010 #include "rutil/HeapInstanceCounter.hxx" 00011 #include "resip/stack/QValue.hxx" 00012 00013 namespace resip 00014 { 00015 00022 class Pidf : public Contents 00023 { 00024 public: 00025 static const Pidf Empty; 00026 00027 // only for Pidf (not for CpimContents) 00028 RESIP_HeapCount(Pidf); 00029 Pidf(const Mime& contentType); 00030 explicit Pidf(const Uri& entity); 00031 // end of - only for Pidf (not for CpimContents) 00032 Pidf(); 00033 Pidf(const Data& txt); 00034 Pidf(const HeaderFieldValue& hfv, const Mime& contentType); 00035 Pidf(const Data& txt, const Mime& contentType); 00036 Pidf(const Pidf& rhs); 00037 virtual ~Pidf(); 00038 Pidf& operator=(const Pidf& rhs); 00039 00043 virtual Contents* clone() const; 00044 static const Mime& getStaticType() ; 00045 virtual EncodeStream& encodeParsed(EncodeStream& str) const; 00046 virtual void parse(ParseBuffer& pb); 00047 00048 // only for Pidf (not for CpimContents) 00049 void setSimpleId(const Data& id); 00050 void setEntity(const Uri& entity); 00051 const Uri& getEntity() const; 00052 void setSimpleStatus(bool online, const Data& note = Data::Empty, 00053 const Data& contact = Data::Empty); 00054 bool getSimpleStatus(Data* note=NULL) const; 00055 // end of - only for Pidf (not for CpimContents) 00056 00057 Data& text() {checkParsed(); return mNote;} 00058 00059 static bool init(); 00060 00061 00062 // only for Pidf (not for CpimContents) 00066 class Tuple 00067 { 00068 public: 00069 bool status; 00070 Data id; 00071 Data contact; 00072 QValue contactPriority; 00073 Data note; 00074 Data timeStamp; 00075 HashMap<Data, Data> attributes; 00076 }; 00077 00078 std::vector<Tuple>& getTuples(); 00079 const std::vector<Tuple>& getTuples() const; 00080 int getNumTuples() const; 00081 00082 // combine tuples 00083 void merge(const Pidf& other); 00084 // end of - only for Pidf (not for CpimContents) 00085 00086 private: 00087 Data mNote; // equivalent to mText in Cpim 00088 // only for Pidf (not for CpimContents) 00089 Uri mEntity; 00090 std::vector<Tuple> mTuples; 00091 // end of - only for Pidf (not for CpimContents) 00092 }; 00093 00094 EncodeStream& operator<<(EncodeStream& strm, const Pidf::Tuple& tuple); 00095 // only for Pidf (not for CpimContents) 00096 static bool invokePidfInit = Pidf::init(); 00097 // end of - only for Pidf (not for CpimContents) 00098 00099 } 00100 00101 #endif 00102 00103 /* ==================================================================== 00104 * The Vovida Software License, Version 1.0 00105 * 00106 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00107 * 00108 * Redistribution and use in source and binary forms, with or without 00109 * modification, are permitted provided that the following conditions 00110 * are met: 00111 * 00112 * 1. Redistributions of source code must retain the above copyright 00113 * notice, this list of conditions and the following disclaimer. 00114 * 00115 * 2. Redistributions in binary form must reproduce the above copyright 00116 * notice, this list of conditions and the following disclaimer in 00117 * the documentation and/or other materials provided with the 00118 * distribution. 00119 * 00120 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00121 * and "Vovida Open Communication Application Library (VOCAL)" must 00122 * not be used to endorse or promote products derived from this 00123 * software without prior written permission. For written 00124 * permission, please contact vocal@vovida.org. 00125 * 00126 * 4. Products derived from this software may not be called "VOCAL", nor 00127 * may "VOCAL" appear in their name, without prior written 00128 * permission of Vovida Networks, Inc. 00129 * 00130 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00131 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00132 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00133 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00134 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00135 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00136 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00137 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00138 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00139 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00140 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00141 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00142 * DAMAGE. 00143 * 00144 * ==================================================================== 00145 * 00146 * This software consists of voluntary contributions made by Vovida 00147 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00148 * Inc. For more information on Vovida Networks, Inc., please see 00149 * <http://www.vovida.org/>. 00150 * 00151 */
1.7.5.1