diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-09-01 11:16:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-09-01 11:16:00 +0200 |
commit | c97a759dcc080705c956c87fce076709ca66a0c8 (patch) | |
tree | 0f11125e3137cef9fc11d669f8addc2955df0460 /pimpl/person.hxx | |
parent | 55268128a30a56bfd42a4ffb382ad3a5179a739f (diff) |
Add 'access' and 'pimpl' examples
These illustrate the use of accessor/modifier functions and expressions
as well as virtual data members.
Diffstat (limited to 'pimpl/person.hxx')
-rw-r--r-- | pimpl/person.hxx | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pimpl/person.hxx b/pimpl/person.hxx new file mode 100644 index 0000000..d296c28 --- /dev/null +++ b/pimpl/person.hxx @@ -0,0 +1,56 @@ +// file : pimpl/person.hxx +// copyright : not copyrighted - public domain + +#ifndef PERSON_HXX +#define PERSON_HXX + +#include <string> + +#include <odb/core.hxx> + +#pragma db object +class person +{ +public: + ~person (); + person (const std::string& email, + const std::string& name, + unsigned short age); + + const std::string& + email () const; + + void + email (const std::string&); + + const std::string& + name () const; + + void + name (const std::string&); + + unsigned short + age () const; + + void + age (unsigned short) const; + +private: + person (const person&); + person& operator= (const person&); + +private: + friend class odb::access; + person (); + + struct impl; + + #pragma db transient + impl* pimpl_; + + #pragma db member(email) virtual(std::string) id + #pragma db member(name) virtual(std::string) + #pragma db member(age) virtual(unsigned short) +}; + +#endif // PERSON_HXX |