libinvdb/source/include/item.hh

68 lines
2.2 KiB
C++

#ifndef INVENTORY_ITEM_HH_
#define INVENTORY_ITEM_HH_
#include "dbobjectptr.hh"
#include "dbcontainer.hh"
#include "dbsession.hh"
#include "dbobject.hh"
#include "dbfield.hh"
#include "cxx-semantics.hh"
namespace inventory {
namespace datamodel {
class Item;
template<>
class DBRecordDesc<Item> : semantics::non_constructible {
public:
static const struct DBRecordElementDesc desc_desc;
static const struct DBRecordElementDesc time_added_desc;
static const struct DBRecordElementDesc time_spoiled_desc;
static const struct DBRecordElementDesc cash_worth_desc;
static const struct DBRecordElementDesc currency_desc;
static const struct DBRecordElementDesc long_axis_desc;
static const struct DBRecordElementDesc short_axis_desc;
static const struct DBRecordElementDesc height_desc;
static const struct DBRecordElementDesc mass_desc;
static const struct DBRecordElementDesc url_desc;
};
class Item : public DBNamedObject<Item>, public DBHierarchicalObject<Item> {
public:
static const char *sc_table;
static const char *sc_view;
static const char *sc_dbclass;
DBString<Item> description;
DBUnsignedInt<Item> time_added;
DBUnsignedInt<Item> time_spoiled;
DBInt<Item> cash_worth;
DBInt<Item> currency_id;
DBInt<Item> long_axis;
DBInt<Item> short_axis;
DBInt<Item> height;
DBInt<Item> mass;
DBString<Item> url;
Item()
: description(this, &DBRecordDesc<Item>::desc_desc),
time_added(this, &DBRecordDesc<Item>::time_added_desc),
time_spoiled(this, &DBRecordDesc<Item>::time_spoiled_desc),
cash_worth(this, &DBRecordDesc<Item>::cash_worth_desc),
currency_id(this, &DBRecordDesc<Item>::currency_desc),
long_axis(this, &DBRecordDesc<Item>::long_axis_desc),
short_axis(this, &DBRecordDesc<Item>::short_axis_desc),
height(this, &DBRecordDesc<Item>::height_desc),
mass(this, &DBRecordDesc<Item>::mass_desc),
url(this, &DBRecordDesc<Item>::url_desc) {}
static void create_tables(db::DBSession &session);
static void validate_tables(db::DBSession &session);
static void remove_tables(db::DBSession &session);
};
}
}
#endif