summaryrefslogtreecommitdiff
path: root/cpp/object.hpp
diff options
context:
space:
mode:
authorNaoki INADA <inada-n@klab.jp>2009-06-08 04:43:25 +0900
committerNaoki INADA <inada-n@klab.jp>2009-06-08 04:43:25 +0900
commit114ef92d42899ce323f603d6c584b2ba9f279e16 (patch)
tree3561d2a15aae958e5d5c71cb2d33a289c8d629ea /cpp/object.hpp
parent3628ea22d4079fa0a235a938eadf7b24943e326c (diff)
parent7cd359c1fdab21adb0fd5760741a6b1b0e4a806a (diff)
downloadmsgpack-python-114ef92d42899ce323f603d6c584b2ba9f279e16.tar.gz
Merge branch 'master' of git://git.sourceforge.jp/gitroot/msgpack/msgpack
Diffstat (limited to 'cpp/object.hpp')
-rw-r--r--cpp/object.hpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/cpp/object.hpp b/cpp/object.hpp
index 09ddb89..07917c2 100644
--- a/cpp/object.hpp
+++ b/cpp/object.hpp
@@ -80,13 +80,13 @@ struct object {
type::object_type type;
union_type via;
- bool is_nil() { return type == type::NIL; }
+ bool is_nil() const { return type == type::NIL; }
template <typename T>
- T as();
+ T as() const;
template <typename T>
- void convert(T* v);
+ void convert(T* v) const;
object();
object(msgpack_object obj);
@@ -96,7 +96,7 @@ private:
struct implicit_type;
public:
- implicit_type convert();
+ implicit_type convert() const;
};
struct object_kv {
@@ -201,23 +201,23 @@ inline object::operator msgpack_object()
}
-inline object::implicit_type object::convert()
+inline object::implicit_type object::convert() const
{
return implicit_type(*this);
}
template <typename T>
-inline T object::as()
+inline void object::convert(T* v) const
{
- T v;
- convert(&v);
- return v;
+ *this >> *v;
}
template <typename T>
-inline void object::convert(T* v)
+inline T object::as() const
{
- *this >> *v;
+ T v;
+ convert(&v);
+ return v;
}