CompleteDB Embedded: Direct C++ API  2.4.2
Object.hpp
Go to the documentation of this file.
1 #ifndef COMPLETEDB_OBJECT_HPP
2 #define COMPLETEDB_OBJECT_HPP
3 
4 #include "CompleteDb.h"
6 namespace completedb {
7 
13 class Object
14 {
15 
16 protected: // fields
17 
18  void* m;
19 
20 public: // iface
21 
25  virtual bool cast(const Object& from) { return completedb_Object_cast(&m, from.get(), from.getClassType()); }
29  virtual bool isConnected() const { return completedb_Object_isConnected(m); }
33  virtual bool isDisconnected() const { return completedb_Object_isDisconnected(m); }
42  inline void* get() const { return m; }
43 
44 public: // factory lvalue
45 
46  Object& operator=(const Object& src) { completedb_Object_assign(&m, src.m, src.getClassType()); return *this; }
47  Object(const Object& src) : m(completedb_Object_alloc_copy(src.m, src.getClassType())) {}
48 
49 public: // factory
50 
51  virtual ~Object() { completedb_Object_free(&m); }
53 
54 protected: // factory
55 
56  Object(void* src) : m(src) {}
57 
58 };
59 
60 } // namespace
61 
62 #endif /* COMPLETEDB_OBJECT_HPP */