Kitlist  1.1.0
Public Member Functions | Protected Attributes | Friends | List of all members
ModelCategory Class Reference

Represents a Category combined with GuiState attributes. More...

#include <kitmodel.hpp>

Inheritance diagram for ModelCategory:
Category GuiState

Public Member Functions

 ModelCategory ()
 
 ~ModelCategory ()
 
virtual ModelItemContainerget_model_items ()
 
virtual ItemContainerget_items ()
 Returns the list of items belonging to the Category. More...
 
virtual ItemContainerget_items (ItemFunctor &functor)
 Returns the list of items belonging to the Category, filtered by the passed functor. More...
 
virtual ItemMapget_removed_children ()
 Returns a list of items that have been removed from the Category. More...
 
virtual ItemMapget_added_children ()
 Returns a list of items that have been added to the Category. More...
 
virtual void add_item (Item *)
 Adds the passed item to this ModelCategory. More...
 
virtual void remove_item (Item *item)
 Removes the passed item from this ModelCategory. More...
 
virtual void remove_items (ModelItemContainer *items)
 Removes all the passed items from this ModelCategory. More...
 
virtual void reset ()
 Resets the Category state. More...
 
virtual void purge ()
 
- Public Member Functions inherited from Category
 ~Category ()
 
void set_id (long id)
 
long get_id ()
 
void set_name (const std::string name)
 
std::string get_name ()
 
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...
 
- Public Member Functions inherited from GuiState
 GuiState ()
 
bool is_dirty ()
 
void set_dirty (bool dirty=true)
 
bool is_deleted ()
 
void set_deleted (bool deleted)
 
void set_new_flag (bool flag)
 
bool is_new ()
 

Protected Attributes

ItemMapm_removed_children
 List of items removed from the Category. More...
 
ItemMapm_added_children
 List of items added to the Category. More...
 
- Protected Attributes inherited from Category
long m_id
 Unique id. More...
 
std::string m_name
 The category name. More...
 
ItemContainer m_items
 List of associated items. More...
 
- Protected Attributes inherited from GuiState
bool m_dirty
 
bool m_deleted
 
bool m_new
 

Friends

class KitModel
 

Detailed Description

Represents a Category combined with GuiState attributes.

Definition at line 94 of file kitmodel.hpp.

Constructor & Destructor Documentation

◆ ModelCategory()

ModelCategory::ModelCategory ( )

Definition at line 43 of file kitmodel.cpp.

References m_added_children, and m_removed_children.

◆ ~ModelCategory()

ModelCategory::~ModelCategory ( )

Definition at line 49 of file kitmodel.cpp.

References m_added_children, and m_removed_children.

Member Function Documentation

◆ add_item()

void ModelCategory::add_item ( Item item)
virtual

Adds the passed item to this ModelCategory.

Also updates the lists of removed and added items.

Reimplemented from Category.

Definition at line 88 of file kitmodel.cpp.

References Category::add_item(), Item::get_id(), m_added_children, and m_removed_children.

Referenced by KitModel::add_item(), KitModel::copy_items(), and KitParser::process_category_item().

◆ get_added_children()

virtual ItemMap* ModelCategory::get_added_children ( )
inlinevirtual

Returns a list of items that have been added to the Category.

Definition at line 109 of file kitmodel.hpp.

References GuiState::reset().

◆ get_items() [1/2]

ItemContainer * ModelCategory::get_items ( )
virtual

Returns the list of items belonging to the Category.

Items flagged as deleted are excluded.

Definition at line 151 of file kitmodel.cpp.

References GuiState::is_deleted(), and Category::m_items.

Referenced by Service::get_filtered_items(), and Service::get_items().

◆ get_items() [2/2]

ItemContainer * ModelCategory::get_items ( ItemFunctor functor)
virtual

Returns the list of items belonging to the Category, filtered by the passed functor.

Items flagged as deleted are excluded.

Parameters
functorif the operator() method returns true the item is included in the returned list.

Definition at line 172 of file kitmodel.cpp.

References GuiState::is_deleted(), and Category::m_items.

◆ get_model_items()

ModelItemContainer * ModelCategory::get_model_items ( )
virtual

Returns the list of items belonging to the Category.

Items flagged as deleted are excluded.

Definition at line 134 of file kitmodel.cpp.

References GuiState::is_deleted(), and Category::m_items.

◆ get_removed_children()

virtual ItemMap* ModelCategory::get_removed_children ( )
inlinevirtual

Returns a list of items that have been removed from the Category.

Definition at line 107 of file kitmodel.hpp.

◆ purge()

void ModelCategory::purge ( )
virtual

Definition at line 68 of file kitmodel.cpp.

References Category::m_items.

Referenced by KitModel::purge().

◆ remove_item()

void ModelCategory::remove_item ( Item item)
virtual

Removes the passed item from this ModelCategory.

Also updates the lists of removed and added items.

Reimplemented from Category.

Definition at line 106 of file kitmodel.cpp.

References Item::get_id(), m_added_children, m_removed_children, and Category::remove_item().

Referenced by remove_items().

◆ remove_items()

void ModelCategory::remove_items ( ModelItemContainer items)
virtual

Removes all the passed items from this ModelCategory.

Also updates the lists of removed and added items.

Definition at line 122 of file kitmodel.cpp.

References remove_item().

Referenced by KitListGui::on_menu_cut().

◆ reset()

void ModelCategory::reset ( )
virtual

Resets the Category state.

Removes any items flagged as deleted. Sets the GuiState to it's defaults and clears the lists of added and removed items.

Reimplemented from GuiState.

Definition at line 61 of file kitmodel.cpp.

References m_added_children, m_removed_children, and GuiState::reset().

Referenced by KitModel::reset().

Friends And Related Function Documentation

◆ KitModel

friend class KitModel
friend

Definition at line 115 of file kitmodel.hpp.

Member Data Documentation

◆ m_added_children

ItemMap* ModelCategory::m_added_children
protected

List of items added to the Category.

Definition at line 99 of file kitmodel.hpp.

Referenced by add_item(), ModelCategory(), remove_item(), reset(), and ~ModelCategory().

◆ m_removed_children

ItemMap* ModelCategory::m_removed_children
protected

List of items removed from the Category.

Definition at line 97 of file kitmodel.hpp.

Referenced by add_item(), ModelCategory(), remove_item(), reset(), and ~ModelCategory().


The documentation for this class was generated from the following files:

Copyright 2008-2021 Frank Dean