reSIProcate/stack  9694
QValueParameter.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/QValueParameter.hxx"
00006 #include "rutil/ParseException.hxx"
00007 #include "resip/stack/Symbols.hxx"
00008 #include "rutil/ParseBuffer.hxx"
00009 #include "rutil/Logger.hxx"
00010 #include "rutil/WinLeakCheck.hxx"
00011 
00012 using namespace resip;
00013 using namespace std;
00014 
00015 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
00016 
00017 QValueParameter::QValueParameter(ParameterTypes::Type type, 
00018                                ParseBuffer& pb,
00019                                const std::bitset<256>& terminators)
00020    : Parameter(type),
00021      mValue(0)
00022 {
00023    pb.skipWhitespace();
00024    if (!pb.eof() && *pb.position() != '=')
00025    {
00026       throw ParseException("parameter constructor expected '='",
00027                            "QValueParameter", __FILE__, __LINE__);
00028    }
00029    pb.skipChar();
00030    pb.skipWhitespace();
00031    
00032    // .dlb. not zero terminated; no error detection
00033    mValue.setValue(pb.qVal());
00034 }
00035 
00036 QValueParameter::QValueParameter(ParameterTypes::Type type)
00037    : Parameter(type),
00038      mValue(0)
00039 {}
00040       
00041 Parameter* 
00042 QValueParameter::clone() const
00043 {
00044    return new QValueParameter(*this);
00045 }
00046 
00047 EncodeStream&
00048 QValueParameter::encode(EncodeStream& stream) const
00049 {
00050    return stream << getName() << Symbols::EQUALS << mValue;
00051 }
00052 
00053 EncodeStream&
00054 resip::operator<<(EncodeStream& stream, const QValue& qvalue)
00055 {
00056         return qvalue.encode(stream);
00057 }
00058 
00059 /* ====================================================================
00060  * The Vovida Software License, Version 1.0 
00061  * 
00062  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00063  * 
00064  * Redistribution and use in source and binary forms, with or without
00065  * modification, are permitted provided that the following conditions
00066  * are met:
00067  * 
00068  * 1. Redistributions of source code must retain the above copyright
00069  *    notice, this list of conditions and the following disclaimer.
00070  * 
00071  * 2. Redistributions in binary form must reproduce the above copyright
00072  *    notice, this list of conditions and the following disclaimer in
00073  *    the documentation and/or other materials provided with the
00074  *    distribution.
00075  * 
00076  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00077  *    and "Vovida Open Communication Application Library (VOCAL)" must
00078  *    not be used to endorse or promote products derived from this
00079  *    software without prior written permission. For written
00080  *    permission, please contact vocal@vovida.org.
00081  *
00082  * 4. Products derived from this software may not be called "VOCAL", nor
00083  *    may "VOCAL" appear in their name, without prior written
00084  *    permission of Vovida Networks, Inc.
00085  * 
00086  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00087  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00088  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00089  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00090  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00091  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00092  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00093  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00094  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00095  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00096  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00097  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00098  * DAMAGE.
00099  * 
00100  * ====================================================================
00101  * 
00102  * This software consists of voluntary contributions made by Vovida
00103  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00104  * Inc.  For more information on Vovida Networks, Inc., please see
00105  * <http://www.vovida.org/>.
00106  *
00107  */