1
#if !defined(RESIP_HEADERFIELDVALUELIST_HXX)
2
#define RESIP_HEADERFIELDVALUELIST_HXX
7
#include "rutil/StlPoolAllocator.hxx"
8
#include "rutil/PoolBase.hxx"
14
class ParserContainerBase;
15
class HeaderFieldValue;
20
class HeaderFieldValueList
23
static const HeaderFieldValueList Empty;
25
HeaderFieldValueList()
31
HeaderFieldValueList(PoolBase& pool)
32
: mHeaders(StlPoolAllocator<HeaderFieldValue, PoolBase>(&pool)),
37
~HeaderFieldValueList();
38
HeaderFieldValueList(const HeaderFieldValueList& rhs);
39
HeaderFieldValueList(const HeaderFieldValueList& rhs, PoolBase& pool);
40
HeaderFieldValueList& operator=(const HeaderFieldValueList& rhs);
42
inline void setParserContainer(ParserContainerBase* parser) {mParserContainer = parser;}
43
inline ParserContainerBase* getParserContainer() const {return mParserContainer;}
45
EncodeStream& encode(int headerEnum, EncodeStream& str) const;
46
EncodeStream& encode(const Data& headerName, EncodeStream& str) const;
47
EncodeStream& encodeEmbedded(const Data& headerName, EncodeStream& str) const;
49
bool empty() const {return mHeaders.empty();}
50
size_t size() const {return mHeaders.size();}
52
//void push_front(HeaderFieldValue* header) {mHeaders.push_front(header);}
55
READ THIS CAREFULLY BEFORE USING THIS FUNCTION
56
@param own Specifies whether the created HeaderFieldValue will take
57
ownership of the buffer passed. This will never make a copy
58
of the buffer; if own==false, the HeaderFieldValue will retain the
59
same reference that it would if own==true. The only difference is
60
that if own==false, the buffer will not be deleted when the
61
HeaderFieldValue goes away/releases its reference, while if
62
own==true the buffer will be deleted. This means that no matter what
63
you pass for this param, you must ensure that the buffer is not
64
deleted during the lifetime of this HeaderFieldValueList.
66
void push_back(const char* buffer, size_t length, bool own)
68
mHeaders.push_back(HeaderFieldValue::Empty);
69
mHeaders.back().init(buffer,length,own);
72
//void pop_front() {mHeaders.pop_front();}
73
void pop_back() {mHeaders.pop_back();};
74
HeaderFieldValue* front() {return &mHeaders.front();}
75
HeaderFieldValue* back() {return &mHeaders.back();}
76
const HeaderFieldValue* front() const {return &mHeaders.front();}
77
const HeaderFieldValue* back() const {return &mHeaders.back();}
79
inline void reserve(size_t size)
81
mHeaders.reserve(size);
84
bool parsedEmpty() const;
86
typedef std::vector<HeaderFieldValue, StlPoolAllocator<HeaderFieldValue, PoolBase > > ListImpl;
88
typedef ListImpl::iterator iterator;
89
typedef ListImpl::const_iterator const_iterator;
91
iterator begin() {return mHeaders.begin();}
92
iterator end() {return mHeaders.end();}
93
const_iterator begin() const {return mHeaders.begin();}
94
const_iterator end() const {return mHeaders.end();}
99
ParserContainerBase* mParserContainer;
101
void freeParserContainer();
108
/* ====================================================================
109
* The Vovida Software License, Version 1.0
111
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
113
* Redistribution and use in source and binary forms, with or without
114
* modification, are permitted provided that the following conditions
117
* 1. Redistributions of source code must retain the above copyright
118
* notice, this list of conditions and the following disclaimer.
120
* 2. Redistributions in binary form must reproduce the above copyright
121
* notice, this list of conditions and the following disclaimer in
122
* the documentation and/or other materials provided with the
125
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
126
* and "Vovida Open Communication Application Library (VOCAL)" must
127
* not be used to endorse or promote products derived from this
128
* software without prior written permission. For written
129
* permission, please contact vocal@vovida.org.
131
* 4. Products derived from this software may not be called "VOCAL", nor
132
* may "VOCAL" appear in their name, without prior written
133
* permission of Vovida Networks, Inc.
135
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
136
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
137
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
138
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
139
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
140
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
141
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
142
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
143
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
144
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
145
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
146
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
149
* ====================================================================
151
* This software consists of voluntary contributions made by Vovida
152
* Networks, Inc. and many individuals on behalf of Vovida Networks,
153
* Inc. For more information on Vovida Networks, Inc., please see
154
* <http://www.vovida.org/>.