reSIProcate/stack  9694
StringCategory.cxx
Go to the documentation of this file.
00001 #if defined(HAVE_CONFIG_H)
00002 #include "config.h"
00003 #endif
00004 
00005 #include "resip/stack/StringCategory.hxx"
00006 #include "rutil/Logger.hxx"
00007 #include "rutil/ParseBuffer.hxx"
00008 //#include "rutil/WinLeakCheck.hxx"  // not compatible with placement new used below
00009 
00010 using namespace resip;
00011 using namespace std;
00012 
00013 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
00014 
00015 //====================
00016 // StringCategory
00017 //====================
00018 StringCategory::StringCategory() : 
00019    ParserCategory(), 
00020    mValue() 
00021 {}
00022 
00023 StringCategory::StringCategory(const Data& value)
00024    : ParserCategory(),
00025      mValue(value)
00026 {}
00027 
00028 StringCategory::StringCategory(const HeaderFieldValue& hfv, 
00029                                  Headers::Type type,
00030                                  PoolBase* pool)
00031    : ParserCategory(hfv, type, pool),
00032      mValue()
00033 {}
00034 
00035 StringCategory::StringCategory(const StringCategory& rhs,
00036                                  PoolBase* pool)
00037    : ParserCategory(rhs, pool),
00038      mValue(rhs.mValue)
00039 {}
00040 
00041 StringCategory&
00042 StringCategory::operator=(const StringCategory& rhs)
00043 {
00044    if (this != &rhs)
00045    {
00046       ParserCategory::operator=(rhs);
00047       mValue = rhs.mValue;
00048    }
00049    return *this;
00050 }
00051 ParserCategory* 
00052 StringCategory::clone() const
00053 {
00054    return new StringCategory(*this);
00055 }
00056 
00057 ParserCategory* 
00058 StringCategory::clone(void* location) const
00059 {
00060    return new (location) StringCategory(*this);
00061 }
00062 
00063 ParserCategory* 
00064 StringCategory::clone(PoolBase* pool) const
00065 {
00066    return new (pool) StringCategory(*this, pool);
00067 }
00068 
00069 void 
00070 StringCategory::parse(ParseBuffer& pb)
00071 {
00072    const char* anchor = pb.position();
00073    pb.skipToEnd();
00074    pb.data(mValue, anchor);
00075 }
00076 
00077 EncodeStream& 
00078 StringCategory::encodeParsed(EncodeStream& str) const
00079 {
00080    str << mValue;
00081    return str;
00082 }
00083 
00084 const Data& 
00085 StringCategory::value() const 
00086 {
00087    checkParsed(); 
00088    return mValue;
00089 }
00090 
00091 Data& 
00092 StringCategory::value()
00093 {
00094    checkParsed(); 
00095    return mValue;
00096 }
00097 
00098 /* ====================================================================
00099  * The Vovida Software License, Version 1.0 
00100  * 
00101  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00102  * 
00103  * Redistribution and use in source and binary forms, with or without
00104  * modification, are permitted provided that the following conditions
00105  * are met:
00106  * 
00107  * 1. Redistributions of source code must retain the above copyright
00108  *    notice, this list of conditions and the following disclaimer.
00109  * 
00110  * 2. Redistributions in binary form must reproduce the above copyright
00111  *    notice, this list of conditions and the following disclaimer in
00112  *    the documentation and/or other materials provided with the
00113  *    distribution.
00114  * 
00115  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00116  *    and "Vovida Open Communication Application Library (VOCAL)" must
00117  *    not be used to endorse or promote products derived from this
00118  *    software without prior written permission. For written
00119  *    permission, please contact vocal@vovida.org.
00120  *
00121  * 4. Products derived from this software may not be called "VOCAL", nor
00122  *    may "VOCAL" appear in their name, without prior written
00123  *    permission of Vovida Networks, Inc.
00124  * 
00125  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00126  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00127  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00128  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00129  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00130  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00131  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00132  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00133  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00134  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00135  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00136  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00137  * DAMAGE.
00138  * 
00139  * ====================================================================
00140  * 
00141  * This software consists of voluntary contributions made by Vovida
00142  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00143  * Inc.  For more information on Vovida Networks, Inc., please see
00144  * <http://www.vovida.org/>.
00145  *
00146  */