Kitlist
1.1.0
|
Represents a Category. More...
#include <category.hpp>
Public Member Functions | |
~Category () | |
void | set_id (long id) |
long | get_id () |
void | set_name (const std::string name) |
std::string | get_name () |
virtual void | add_item (Item *item) |
Associates the passed item with this Category. More... | |
virtual void | remove_item (Item *item) |
Removes the association of the passed item from this Category. More... | |
virtual size_t | item_count () |
Returns the number of items associated with this category. More... | |
virtual bool | has_items () |
Returns true if there are any items associated with this category. More... | |
void | foreach_item (const SlotForeachItem &slot) |
Executes a callback function for each associated item. More... | |
void | execute (ItemFunctor &functor) |
Executes the passed ItemFunctor. More... | |
Protected Attributes | |
long | m_id |
Unique id. More... | |
std::string | m_name |
The category name. More... | |
ItemContainer | m_items |
List of associated items. More... | |
Friends | |
class | CategoryCompareName |
class | CategoryCompareId |
class | KitModel |
Represents a Category.
Many categories may have one or more items.
Definition at line 37 of file category.hpp.
|
inline |
Definition at line 43 of file category.hpp.
|
virtual |
Associates the passed item with this Category.
Reimplemented in ModelCategory.
Definition at line 29 of file category.cpp.
References m_items.
Referenced by ModelCategory::add_item(), and get_name().
void Category::execute | ( | ItemFunctor & | functor | ) |
Executes the passed ItemFunctor.
The ItemFunctor's override operator() method is called, passing a reference to the item being iterated over. If the called method returns true, the iteration stops and no more calls will be made to the functor.
Definition at line 71 of file category.cpp.
References m_items.
Referenced by has_items(), and KitList::tick_items().
void Category::foreach_item | ( | const SlotForeachItem & | slot | ) |
Executes a callback function for each associated item.
The callback function will be passed a reference to the current item being iterated.
slot | the callback function. |
Definition at line 55 of file category.cpp.
References m_items.
Referenced by XmlDao::add_category_to_dom(), has_items(), and KitList::list_items().
|
inline |
Definition at line 45 of file category.hpp.
References m_id.
Referenced by KitModel::add_category(), XmlDao::add_category_to_dom(), KitListGui::close_add_category_window(), XmlDao::get_model(), KitParser::process_category_item(), and KitListGui::refresh_category_list().
|
inline |
Definition at line 47 of file category.hpp.
References add_item(), m_name, and remove_item().
Referenced by XmlDao::add_category_to_dom(), KitListGui::on_menu_rename_category(), and KitListGui::refresh_category_list().
|
inlinevirtual |
Returns true if there are any items associated with this category.
Definition at line 53 of file category.hpp.
References execute(), and foreach_item().
Referenced by KitList::list_items().
|
inlinevirtual |
Returns the number of items associated with this category.
Definition at line 51 of file category.hpp.
Referenced by KitList::list_items().
|
virtual |
Removes the association of the passed item from this Category.
The passed item is not deleted.
item | the item to un-associate. |
Reimplemented in ModelCategory.
Definition at line 40 of file category.cpp.
References m_items.
Referenced by get_name(), and ModelCategory::remove_item().
|
inline |
Definition at line 44 of file category.hpp.
Referenced by Service::create_category(), and KitParser::process_category().
|
inline |
Definition at line 46 of file category.hpp.
Referenced by KitListGui::close_add_category_window(), and KitParser::on_end_element().
|
friend |
Definition at line 57 of file category.hpp.
|
friend |
Definition at line 56 of file category.hpp.
|
friend |
Definition at line 58 of file category.hpp.
|
protected |
Unique id.
Definition at line 39 of file category.hpp.
Referenced by get_id(), and CategoryCompareId::operator()().
|
protected |
List of associated items.
Definition at line 41 of file category.hpp.
Referenced by add_item(), KitModel::copy_items(), execute(), foreach_item(), ModelCategory::get_items(), ModelCategory::get_model_items(), ModelCategory::purge(), and remove_item().
|
protected |
The category name.
Definition at line 40 of file category.hpp.
Referenced by get_name(), and CategoryCompareName::operator()().