47 lines
875 B
C
47 lines
875 B
C
|
|
// file : hello/person.hxx
|
||
|
|
// copyright : not copyrighted - public domain
|
||
|
|
|
||
|
|
#ifndef BOOK_S_H
|
||
|
|
#define BOOK_S_H
|
||
|
|
|
||
|
|
#include <memory>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
#include <odb/core.hxx>
|
||
|
|
|
||
|
|
#include "author_s.h"
|
||
|
|
|
||
|
|
#pragma db object
|
||
|
|
class Book_S
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
Book_S() = default;
|
||
|
|
|
||
|
|
Book_S(const std::string& name,
|
||
|
|
const std::shared_ptr<Author_S>& author,
|
||
|
|
const int year)
|
||
|
|
{
|
||
|
|
m_author = author;
|
||
|
|
m_name = name;
|
||
|
|
m_year = year;
|
||
|
|
};
|
||
|
|
|
||
|
|
unsigned long long id() const { return m_id; }
|
||
|
|
std::shared_ptr<Author_S> author() const { return m_author; }
|
||
|
|
std::string name() const { return m_name; }
|
||
|
|
int year() const { return m_year; }
|
||
|
|
|
||
|
|
private:
|
||
|
|
friend class odb::access;
|
||
|
|
|
||
|
|
private:
|
||
|
|
#pragma db id auto
|
||
|
|
unsigned long long m_id;
|
||
|
|
|
||
|
|
std::shared_ptr<Author_S> m_author;
|
||
|
|
std::string m_name;
|
||
|
|
int m_year;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // BOOK_S_H
|