79 [](std::shared_ptr<Item> a, std::shared_ptr<Item> b) {
94 inline friend bool operator< (std::shared_ptr<Category> lhs, std::shared_ptr<Category> rhs) {
101 inline friend bool operator< (std::weak_ptr<Category> lhs, std::weak_ptr<Category> rhs) {
102 assert(!lhs.expired());
103 assert(!rhs.expired());
104 if (lhs.expired() || rhs.expired())
106 return *(lhs.lock()) < *(rhs.lock());
131 std::vector<std::shared_ptr<Item>>
items;
std::map< int32_t, std::shared_ptr< Item > > item_map
A map containing all the items, keyed by id.
std::string name
The descriptive name of the Category.
Category(int32_t id, std::string name)
Constructor taking the id and name of the Category.
int32_t id
The unique ID of the Category within the Model instance.
void set_name(const std::string &name)
Sets the descriptive name of the Category instance.
friend bool operator<(const Category &lhs, const Category &rhs)
Compares two Category instances.
const std::string get_name() const
void sort_items()
Sorts the list of items using the Item::operator< for comparison.
Category()
Default constructor.
std::vector< std::shared_ptr< Item > > items
Zero or more related Item instances.