summaryrefslogtreecommitdiff
path: root/cpp/object.hpp
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:57 +0000
committerfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:57 +0000
commit4d13f614b6839ac4ca78f5526ab79e911f33ea65 (patch)
treec64a0719f7ba0176fa67bdd0eee266274be4a7da /cpp/object.hpp
parenta721837ed0c1b9783deb72a09d51dfad79411262 (diff)
downloadmsgpack-python-4d13f614b6839ac4ca78f5526ab79e911f33ea65.tar.gz
lang/c/msgpack: optimize zone::alloc()
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@61 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
Diffstat (limited to 'cpp/object.hpp')
-rw-r--r--cpp/object.hpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/cpp/object.hpp b/cpp/object.hpp
index b1f5369..959d84e 100644
--- a/cpp/object.hpp
+++ b/cpp/object.hpp
@@ -69,28 +69,28 @@ class dynamic_packer;
struct object_class {
virtual ~object_class() {}
- virtual bool isnil() const { return false; }
- virtual bool xbool() const { throw cast_error(); }
- virtual uint8_t xu8() const { throw cast_error(); }
- virtual uint16_t xu16() const { throw cast_error(); }
- virtual uint32_t xu32() const { throw cast_error(); }
- virtual uint64_t xu64() const { throw cast_error(); }
- virtual int8_t xi8() const { throw cast_error(); }
- virtual int16_t xi16() const { throw cast_error(); }
- virtual int32_t xi32() const { throw cast_error(); }
- virtual int64_t xi64() const { throw cast_error(); }
- virtual float xfloat() const { throw cast_error(); }
- virtual double xdouble() const { throw cast_error(); }
- virtual raw xraw() { throw cast_error(); }
- virtual array& xarray() { throw cast_error(); }
- virtual map& xmap() { throw cast_error(); }
- virtual const_raw xraw() const { throw cast_error(); }
+ virtual bool isnil () const { return false; }
+ virtual bool xbool () const { throw cast_error(); }
+ virtual uint8_t xu8 () const { throw cast_error(); }
+ virtual uint16_t xu16 () const { throw cast_error(); }
+ virtual uint32_t xu32 () const { throw cast_error(); }
+ virtual uint64_t xu64 () const { throw cast_error(); }
+ virtual int8_t xi8 () const { throw cast_error(); }
+ virtual int16_t xi16 () const { throw cast_error(); }
+ virtual int32_t xi32 () const { throw cast_error(); }
+ virtual int64_t xi64 () const { throw cast_error(); }
+ virtual float xfloat () const { throw cast_error(); }
+ virtual double xdouble() const { throw cast_error(); }
+ virtual raw xraw () { throw cast_error(); }
+ virtual array& xarray () { throw cast_error(); }
+ virtual map& xmap () { throw cast_error(); }
+ virtual const_raw xraw () const { throw cast_error(); }
virtual const array& xarray() const { throw cast_error(); }
- virtual const map& xmap() const { throw cast_error(); }
+ virtual const map& xmap () const { throw cast_error(); }
virtual bool operator== (const object_class* x) const { return false; }
- bool operator!= (const object_class* x) const { return !(this->operator==(x)); }
virtual bool operator< (const object_class* x) const { throw cast_error(); }
virtual bool operator> (const object_class* x) const { throw cast_error(); }
+ bool operator!= (const object_class* x) const { return !(this->operator==(x)); }
virtual void pack(dynamic_packer& p) const = 0;
operator bool() const { return xbool(); } // FIXME !isnil();
operator uint8_t() const { return xu8(); }
@@ -126,24 +126,24 @@ struct object {
object(object_class* v) : val(v) {}
//object(object_class& v) : val(&v) {}
~object() {}
- bool isnil() const { return val->isnil(); }
- bool xbool() const { return val->xbool(); }
- uint8_t xu8() const { return val->xu8(); }
- uint16_t xu16() const { return val->xu16(); }
- uint32_t xu32() const { return val->xu32(); }
- uint64_t xu64() const { return val->xu64(); }
- int8_t xi8() const { return val->xi8(); }
- int16_t xi16() const { return val->xi16(); }
- int32_t xi32() const { return val->xi32(); }
- int64_t xi64() const { return val->xi64(); }
- float xfloat() const { return val->xfloat(); }
- double xdouble() const { return val->xdouble(); }
- raw xraw() { return val->xraw(); }
- array& xarray() { return val->xarray(); }
- map& xmap() { return val->xmap(); }
- const_raw xraw() const { return const_cast<const object_class*>(val)->xraw(); }
+ bool isnil () const { return val->isnil(); }
+ bool xbool () const { return val->xbool(); }
+ uint8_t xu8 () const { return val->xu8(); }
+ uint16_t xu16 () const { return val->xu16(); }
+ uint32_t xu32 () const { return val->xu32(); }
+ uint64_t xu64 () const { return val->xu64(); }
+ int8_t xi8 () const { return val->xi8(); }
+ int16_t xi16 () const { return val->xi16(); }
+ int32_t xi32 () const { return val->xi32(); }
+ int64_t xi64 () const { return val->xi64(); }
+ float xfloat () const { return val->xfloat(); }
+ double xdouble() const { return val->xdouble(); }
+ raw xraw () { return val->xraw(); }
+ array& xarray () { return val->xarray(); }
+ map& xmap () { return val->xmap(); }
+ const_raw xraw () const { return const_cast<const object_class*>(val)->xraw(); }
const array& xarray() const { return const_cast<const object_class*>(val)->xarray(); }
- const map& xmap() const { return const_cast<const object_class*>(val)->xmap(); }
+ const map& xmap () const { return const_cast<const object_class*>(val)->xmap(); }
bool operator== (object x) const { return val->operator== (x.val); }
bool operator!= (object x) const { return val->operator!= (x.val); }
bool operator< (object x) const { return val->operator< (x.val); }
@@ -163,9 +163,9 @@ struct object {
operator raw() { return val->operator raw(); }
operator array&() { return val->operator array&(); }
operator map&() { return val->operator map&(); }
- operator raw() const { return val->operator raw(); }
- operator array&() const { return val->operator array&(); }
- operator map&() const { return val->operator map&(); }
+ operator const_raw() const { return val->operator const_raw(); }
+ operator const array&() const { return val->operator const array&(); }
+ operator const map&() const { return val->operator const map&(); }
const object& inspect(std::ostream& s) const
{ val->inspect(s); return *this; }
private: