reSIProcate/stack  9694
UInt32Category.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_UINT32_CATEGORY_HXX)
00002 #define RESIP_UINT32_CATEGORY_HXX
00003 
00004 #include "rutil/resipfaststreams.hxx"
00005 
00006 #include <iosfwd>
00007 #include "rutil/Data.hxx"
00008 #include "resip/stack/ParserCategory.hxx"
00009 
00010 namespace resip
00011 {
00012 
00017 class UInt32Category : public ParserCategory
00018 {
00019    public:
00020       enum {commaHandling = NoCommaTokenizing};
00021 
00022       UInt32Category();
00023       UInt32Category(const HeaderFieldValue& hfv, 
00024                      Headers::Type type,
00025                      PoolBase* pool=0);
00026       UInt32Category(const UInt32Category& orig,
00027                      PoolBase* pool=0);
00028       UInt32Category& operator=(const UInt32Category&);
00029 
00030       virtual void parse(ParseBuffer& pb);
00031       virtual EncodeStream& encodeParsed(EncodeStream& str) const;
00032       virtual ParserCategory* clone() const;
00033       virtual ParserCategory* clone(void* location) const;
00034       virtual ParserCategory* clone(PoolBase* pool) const;
00035 
00036       const UInt32& value() const;
00037       const Data& comment() const;
00038       UInt32& value();
00039       Data& comment();
00040 
00041       // Inform the compiler that overloads of these may be found in
00042       // ParserCategory, too.
00043       using ParserCategory::exists;
00044       using ParserCategory::remove;
00045       using ParserCategory::param;
00046 
00047       virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool);
00048       // .bwc, This is an awful lot for one lousy param type.
00049       bool exists(const Param<UInt32Category>& paramType) const;
00050       void remove(const Param<UInt32Category>& paramType);
00051 
00052 #define defineParam(_enum, _name, _type, _RFC_ref_ignored)                      \
00053       const _enum##_Param::DType& param(const _enum##_Param& paramType) const;  \
00054       _enum##_Param::DType& param(const _enum##_Param& paramType); \
00055       friend class _enum##_Param
00056 
00057 defineParam(duration, "duration", UInt32Parameter, "RFC 3261");
00058 
00059 #undef defineParam
00060 
00061    private:
00062       UInt32 mValue;
00063       Data mComment;
00064 
00065       static ParameterTypes::Factory ParameterFactories[ParameterTypes::MAX_PARAMETER];
00066 };
00067  
00068 }
00069 
00070 #endif
00071 
00072 /* ====================================================================
00073  * The Vovida Software License, Version 1.0 
00074  * 
00075  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00076  * 
00077  * Redistribution and use in source and binary forms, with or without
00078  * modification, are permitted provided that the following conditions
00079  * are met:
00080  * 
00081  * 1. Redistributions of source code must retain the above copyright
00082  *    notice, this list of conditions and the following disclaimer.
00083  * 
00084  * 2. Redistributions in binary form must reproduce the above copyright
00085  *    notice, this list of conditions and the following disclaimer in
00086  *    the documentation and/or other materials provided with the
00087  *    distribution.
00088  * 
00089  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00090  *    and "Vovida Open Communication Application Library (VOCAL)" must
00091  *    not be used to endorse or promote products derived from this
00092  *    software without prior written permission. For written
00093  *    permission, please contact vocal@vovida.org.
00094  *
00095  * 4. Products derived from this software may not be called "VOCAL", nor
00096  *    may "VOCAL" appear in their name, without prior written
00097  *    permission of Vovida Networks, Inc.
00098  * 
00099  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00100  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00101  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00102  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00103  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00104  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00105  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00106  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00107  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00108  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00109  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00110  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00111  * DAMAGE.
00112  * 
00113  * ====================================================================
00114  * 
00115  * This software consists of voluntary contributions made by Vovida
00116  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00117  * Inc.  For more information on Vovida Networks, Inc., please see
00118  * <http://www.vovida.org/>.
00119  *
00120  */