* Fixed g++ warnings
[libnetpp.git] / net / basic_message.hpp
blobf4dd6db22407ee10e50755cf8920109059366430
1 /*
2 * Copyright (c) 2008, 2009 by Vinzenz Feenstra
3 * All rights reserved.
5 * - Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * - Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 * - Neither the name of the Vinzenz Feenstra nor the names
11 * of its contributors may be used to endorse or promote products derived from
12 * this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
26 #ifndef GUARD_NET_BASIC_MESSAGE_HPP_INCLUDED
27 #define GUARD_NET_BASIC_MESSAGE_HPP_INCLUDED
29 #include <net/detail/traits.hpp>
31 namespace net
33 template<typename Tag>
34 class basic_message
36 typedef typename header_collection_traits<Tag>::type headers_type;
37 typedef typename string_traits<Tag>::type string_type;
39 headers_type headers_;
40 string_type body_;
41 string_type source_;
42 string_type target_;
43 public:
45 basic_message()
46 : headers_()
47 , body_()
48 , source_()
49 , target_()
54 basic_message(basic_message const & other)
55 : headers_(other.headers_)
56 , body_(other.body_)
57 , source_(other.source_)
58 , target_(other.target_)
63 ~basic_message()
67 basic_message & operator=(basic_message other)
69 swap(*this);
70 return *this;
73 void swap(basic_message & other)
75 std::swap(other.headers_, headers_);
76 std::swap(other.body_, body_);
77 std::swap(other.source_, source_);
78 std::swap(other.target_, target_);
81 headers_type const & headers() const
83 return headers_;
86 headers_type & headers()
88 return headers_;
91 string_type & body()
93 return body_;
96 string_type const & body() const
98 return body_;
101 string_type const & source() const
103 return source_;
106 string_type & target()
108 return target_;
111 string_type const & target() const
113 return target_;
119 #endif //GUARD_NET_HTTP_BASIC_MESSAGE_HPP_INCLUDED