mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-20 13:33:51 +01:00
c++: rebuild type/*.hpp
This commit is contained in:
parent
394331cd4e
commit
0627324da6
@ -12,15 +12,17 @@ nobase_include_HEADERS = \
|
|||||||
msgpack/object.hpp \
|
msgpack/object.hpp \
|
||||||
msgpack/zone.hpp \
|
msgpack/zone.hpp \
|
||||||
msgpack/type.hpp \
|
msgpack/type.hpp \
|
||||||
msgpack/type/array.hpp \
|
msgpack/type/bool.hpp \
|
||||||
msgpack/type/boolean.hpp \
|
|
||||||
msgpack/type/float.hpp \
|
msgpack/type/float.hpp \
|
||||||
msgpack/type/integer.hpp \
|
msgpack/type/int.hpp \
|
||||||
|
msgpack/type/list.hpp \
|
||||||
msgpack/type/map.hpp \
|
msgpack/type/map.hpp \
|
||||||
msgpack/type/nil.hpp \
|
msgpack/type/nil.hpp \
|
||||||
msgpack/type/pair.hpp \
|
msgpack/type/pair.hpp \
|
||||||
msgpack/type/raw.hpp \
|
msgpack/type/raw.hpp \
|
||||||
msgpack/type/set.hpp \
|
msgpack/type/set.hpp \
|
||||||
|
msgpack/type/string.hpp \
|
||||||
|
msgpack/type/vector.hpp \
|
||||||
msgpack/type/tuple.hpp \
|
msgpack/type/tuple.hpp \
|
||||||
msgpack/type/define.hpp
|
msgpack/type/define.hpp
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#include "msgpack/type/array.hpp"
|
#include "msgpack/type/bool.hpp"
|
||||||
#include "msgpack/type/boolean.hpp"
|
|
||||||
#include "msgpack/type/float.hpp"
|
#include "msgpack/type/float.hpp"
|
||||||
#include "msgpack/type/integer.hpp"
|
#include "msgpack/type/int.hpp"
|
||||||
|
#include "msgpack/type/list.hpp"
|
||||||
#include "msgpack/type/map.hpp"
|
#include "msgpack/type/map.hpp"
|
||||||
#include "msgpack/type/nil.hpp"
|
#include "msgpack/type/nil.hpp"
|
||||||
#include "msgpack/type/pair.hpp"
|
#include "msgpack/type/pair.hpp"
|
||||||
#include "msgpack/type/raw.hpp"
|
#include "msgpack/type/raw.hpp"
|
||||||
#include "msgpack/type/set.hpp"
|
#include "msgpack/type/set.hpp"
|
||||||
|
#include "msgpack/type/string.hpp"
|
||||||
|
#include "msgpack/type/vector.hpp"
|
||||||
#include "msgpack/type/tuple.hpp"
|
#include "msgpack/type/tuple.hpp"
|
||||||
#include "msgpack/type/define.hpp"
|
#include "msgpack/type/define.hpp"
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
#ifndef MSGPACK_TYPE_BOOLEAN_HPP__
|
#ifndef MSGPACK_TYPE_BOOL_HPP__
|
||||||
#define MSGPACK_TYPE_BOOLEAN_HPP__
|
#define MSGPACK_TYPE_BOOL_HPP__
|
||||||
|
|
||||||
#include "msgpack/object.hpp"
|
#include "msgpack/object.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
56
cpp/type/deque.hpp
Normal file
56
cpp/type/deque.hpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// MessagePack for C++ static resolution routine
|
||||||
|
//
|
||||||
|
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
#ifndef MSGPACK_TYPE_DEQUE_HPP__
|
||||||
|
#define MSGPACK_TYPE_DEQUE_HPP__
|
||||||
|
|
||||||
|
#include "msgpack/object.hpp"
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace msgpack {
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline std::deque<T>& operator>> (object o, std::deque<T>& v)
|
||||||
|
{
|
||||||
|
if(o.type != type::ARRAY) { throw type_error(); }
|
||||||
|
v.resize(o.via.array.size);
|
||||||
|
object* p = o.via.array.ptr;
|
||||||
|
object* const pend = o.via.array.ptr + o.via.array.size;
|
||||||
|
typename std::deque<T>::iterator it = v.begin();
|
||||||
|
for(; p < pend; ++p, ++it) {
|
||||||
|
p->convert(&*it);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Stream, typename T>
|
||||||
|
inline packer<Stream>& operator<< (packer<Stream>& o, const std::deque<T>& v)
|
||||||
|
{
|
||||||
|
o.pack_array(v.size());
|
||||||
|
for(typename std::deque<T>::const_iterator it(v.begin()), it_end(v.end());
|
||||||
|
it != it_end; ++it) {
|
||||||
|
o.pack(*it);
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace msgpack
|
||||||
|
|
||||||
|
#endif /* msgpack/type/deque.hpp */
|
||||||
|
|
@ -34,7 +34,6 @@ inline float& operator>> (object o, float& v)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const float& v)
|
inline packer<Stream>& operator<< (packer<Stream>& o, const float& v)
|
||||||
{
|
{
|
||||||
@ -50,7 +49,6 @@ inline double& operator>> (object o, double& v)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const double& v)
|
inline packer<Stream>& operator<< (packer<Stream>& o, const double& v)
|
||||||
{
|
{
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
#ifndef MSGPACK_TYPE_INTEGER_HPP__
|
#ifndef MSGPACK_TYPE_INT_HPP__
|
||||||
#define MSGPACK_TYPE_INTEGER_HPP__
|
#define MSGPACK_TYPE_INT_HPP__
|
||||||
|
|
||||||
#include "msgpack/object.hpp"
|
#include "msgpack/object.hpp"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -143,5 +143,5 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const unsigned long long&
|
|||||||
|
|
||||||
} // namespace msgpack
|
} // namespace msgpack
|
||||||
|
|
||||||
#endif /* msgpack/type/integer.hpp */
|
#endif /* msgpack/type/int.hpp */
|
||||||
|
|
56
cpp/type/list.hpp
Normal file
56
cpp/type/list.hpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// MessagePack for C++ static resolution routine
|
||||||
|
//
|
||||||
|
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
#ifndef MSGPACK_TYPE_LIST_HPP__
|
||||||
|
#define MSGPACK_TYPE_LIST_HPP__
|
||||||
|
|
||||||
|
#include "msgpack/object.hpp"
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
namespace msgpack {
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline std::list<T>& operator>> (object o, std::list<T>& v)
|
||||||
|
{
|
||||||
|
if(o.type != type::ARRAY) { throw type_error(); }
|
||||||
|
v.resize(o.via.array.size);
|
||||||
|
object* p = o.via.array.ptr;
|
||||||
|
object* const pend = o.via.array.ptr + o.via.array.size;
|
||||||
|
typename std::list<T>::iterator it = v.begin();
|
||||||
|
for(; p < pend; ++p, ++it) {
|
||||||
|
p->convert(&*it);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Stream, typename T>
|
||||||
|
inline packer<Stream>& operator<< (packer<Stream>& o, const std::list<T>& v)
|
||||||
|
{
|
||||||
|
o.pack_array(v.size());
|
||||||
|
for(typename std::list<T>::const_iterator it(v.begin()), it_end(v.end());
|
||||||
|
it != it_end; ++it) {
|
||||||
|
o.pack(*it);
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace msgpack
|
||||||
|
|
||||||
|
#endif /* msgpack/type/list.hpp */
|
||||||
|
|
@ -34,7 +34,6 @@ inline std::pair<T1, T2>& operator>> (object o, std::pair<T1, T2>& v)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Stream, typename T1, typename T2>
|
template <typename Stream, typename T1, typename T2>
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const std::pair<T1, T2>& v)
|
inline packer<Stream>& operator<< (packer<Stream>& o, const std::pair<T1, T2>& v)
|
||||||
{
|
{
|
||||||
|
@ -69,16 +69,6 @@ inline type::raw_ref& operator>> (object o, type::raw_ref& v)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline std::string& operator>> (object o, std::string& v)
|
|
||||||
{
|
|
||||||
type::raw_ref r;
|
|
||||||
o >> r;
|
|
||||||
v.assign(r.ptr, r.size);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const type::raw_ref& v)
|
inline packer<Stream>& operator<< (packer<Stream>& o, const type::raw_ref& v)
|
||||||
{
|
{
|
||||||
@ -88,15 +78,6 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const type::raw_ref& v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Stream>
|
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const std::string& v)
|
|
||||||
{
|
|
||||||
o.pack_raw(v.size());
|
|
||||||
o.pack_raw_body(v.data(), v.size());
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace msgpack
|
} // namespace msgpack
|
||||||
|
|
||||||
#endif /* msgpack/type/raw.hpp */
|
#endif /* msgpack/type/raw.hpp */
|
||||||
|
47
cpp/type/string.hpp
Normal file
47
cpp/type/string.hpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// MessagePack for C++ static resolution routine
|
||||||
|
//
|
||||||
|
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
#ifndef MSGPACK_TYPE_STRING_HPP__
|
||||||
|
#define MSGPACK_TYPE_STRING_HPP__
|
||||||
|
|
||||||
|
#include "msgpack/object.hpp"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace msgpack {
|
||||||
|
|
||||||
|
|
||||||
|
inline std::string& operator>> (object o, std::string& v)
|
||||||
|
{
|
||||||
|
type::raw_ref r;
|
||||||
|
o >> r;
|
||||||
|
v.assign(r.ptr, r.size);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Stream>
|
||||||
|
inline packer<Stream>& operator<< (packer<Stream>& o, const std::string& v)
|
||||||
|
{
|
||||||
|
o.pack_raw(v.size());
|
||||||
|
o.pack_raw_body(v.data(), v.size());
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace msgpack
|
||||||
|
|
||||||
|
#endif /* msgpack/type/string.hpp */
|
||||||
|
|
@ -15,8 +15,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
#ifndef MSGPACK_TYPE_ARRAY_HPP__
|
#ifndef MSGPACK_TYPE_VECTOR_HPP__
|
||||||
#define MSGPACK_TYPE_ARRAY_HPP__
|
#define MSGPACK_TYPE_VECTOR_HPP__
|
||||||
|
|
||||||
#include "msgpack/object.hpp"
|
#include "msgpack/object.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -38,7 +38,6 @@ inline std::vector<T>& operator>> (object o, std::vector<T>& v)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Stream, typename T>
|
template <typename Stream, typename T>
|
||||||
inline packer<Stream>& operator<< (packer<Stream>& o, const std::vector<T>& v)
|
inline packer<Stream>& operator<< (packer<Stream>& o, const std::vector<T>& v)
|
||||||
{
|
{
|
||||||
@ -53,5 +52,5 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const std::vector<T>& v)
|
|||||||
|
|
||||||
} // namespace msgpack
|
} // namespace msgpack
|
||||||
|
|
||||||
#endif /* msgpack/type/array.hpp */
|
#endif /* msgpack/type/vector.hpp */
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user