KitListDao Class Reference

Defines the methods that an implementation of this class must implement. More...

#include <kitlistdao.hpp>

Inheritance diagram for KitListDao:

XmlDao

List of all members.

Public Member Functions

 KitListDao (int verbose=0)
 Constructor which will use default database connection parameters.
virtual ~KitListDao ()
virtual KitModelget_model ()=0
 Loads the data model.
virtual void save_model (KitModel *model)=0
 Saves the current data model.
void set_verbose (int verbose_flag)
int is_verbose ()
virtual Categoryget_category (long cat_id, item_choice choice=ALL_ITEMS)=0
 Loads a category.
virtual ItemContainerget_all_items (item_choice choice=ALL_ITEMS)=0
 Returns a list of all items.
virtual long add_item (const std::string name)=0
virtual long add_item (const std::string name, long cat_id)=0
virtual void append_items_to_category (long to_cat_id, long from_cat_id=-1, item_choice choice=ALL_ITEMS)=0
 Copies items from one category to another.
virtual void associate_item_with_category (long id, long cat_id)=0
 Associates an existing item with an existing category.
virtual CategoryContainer get_categories ()=0
virtual long new_category (const std::string name)=0
 Creates a new category.
virtual void delete_item (long id)=0
virtual void update_item_checked_state (ItemContainer &items)=0
 Persists the state of the 'checked' flag of each item.
virtual void remove_item_from_category (long id, long cat_id)=0
virtual long get_next_item_id ()=0
virtual long get_next_category_id ()=0
virtual void delete_category (long id)=0
virtual void set_item_flag (long id)=0
virtual void unset_item_flag (long id)=0
virtual void set_category_flag (long id)=0
virtual void unset_category_flag (long id)=0
virtual void set_all_flags ()=0
virtual void unset_all_flags ()=0
virtual bool require_filename ()
 Indicates whether the implementation of the data model requires a filename.

Protected Attributes

int m_verbose_flag


Detailed Description

Defines the methods that an implementation of this class must implement.

Definition at line 46 of file kitlistdao.hpp.


Constructor & Destructor Documentation

KitListDao::KitListDao ( int  verbose = 0  )  [inline]

Constructor which will use default database connection parameters.

Parameters:
verbose Optional parameter indicating whether to include verbose output to STDOUT. Defaults to false.

Definition at line 59 of file kitlistdao.hpp.

virtual KitListDao::~KitListDao (  )  [inline, virtual]

Definition at line 61 of file kitlistdao.hpp.


Member Function Documentation

virtual KitModel* KitListDao::get_model (  )  [pure virtual]

Loads the data model.

The data model holds a rich graph of objects, representing the entire list of categories and items.

See also:
KitModel

Implemented in XmlDao.

Referenced by Service::create_default_model(), and Service::load_model().

virtual void KitListDao::save_model ( KitModel model  )  [pure virtual]

Saves the current data model.

Note: The data model will only be saved if it is dirty. Further, only items that are individually flagged as dirty will be saved.

See also:
GuiState

Implemented in XmlDao.

Referenced by Service::save().

void KitListDao::set_verbose ( int  verbose_flag  )  [inline]

Indicates whether verbose output should be written to STDOUT.

Definition at line 85 of file kitlistdao.hpp.

References m_verbose_flag.

int KitListDao::is_verbose (  )  [inline]

Indicates whether verbose output should be written to STDOUT.

Definition at line 92 of file kitlistdao.hpp.

References m_verbose_flag.

virtual Category* KitListDao::get_category ( long  cat_id,
item_choice  choice = ALL_ITEMS 
) [pure virtual]

Loads a category.

Parameters:
choice Which items to load for the category. One of ALL_ITEMS, CHECKED_ITEMS or UNCHECKED_ITEMS.

Implemented in XmlDao.

Referenced by KitList::list_items(), and KitList::tick_items().

virtual ItemContainer* KitListDao::get_all_items ( item_choice  choice = ALL_ITEMS  )  [pure virtual]

Returns a list of all items.

Parameters:
choice Which items to load. One of ALL_ITEMS, CHECKED_ITEMS or UNCHECKED_ITEMS.

Implemented in XmlDao.

Referenced by KitList::list_items(), and KitList::tick_items().

virtual long KitListDao::add_item ( const std::string  name  )  [pure virtual]

Creates a new item.

Parameters:
name The name of the new item.

Implemented in XmlDao.

Referenced by KitList::add_item().

virtual long KitListDao::add_item ( const std::string  name,
long  cat_id 
) [pure virtual]

Creates a new item and associates it with a category.

Parameters:
name The name of the new item.

Implemented in XmlDao.

virtual void KitListDao::append_items_to_category ( long  to_cat_id,
long  from_cat_id = -1,
item_choice  choice = ALL_ITEMS 
) [pure virtual]

Copies items from one category to another.

Optionally, only checked or unchecked items are copied.

Parameters:
from_cat_id The ID of the source category.
to_cat_id The ID of the target category.
choice One of ALL_ITEMS, CHECKED_ITEMS or UNCHECKED_ITEMS.

Implemented in XmlDao.

Referenced by KitList::append_items_to_category().

virtual void KitListDao::associate_item_with_category ( long  id,
long  cat_id 
) [pure virtual]

Associates an existing item with an existing category.

Parameters:
id The Item ID
cat_id The Category ID

Implemented in XmlDao.

Referenced by KitList::associate_item_with_category().

virtual CategoryContainer KitListDao::get_categories (  )  [pure virtual]

Returns a list of all categories.

Implemented in XmlDao.

Referenced by KitList::list_categories().

virtual long KitListDao::new_category ( const std::string  name  )  [pure virtual]

Creates a new category.

Parameters:
name the name of the new category.

Implemented in XmlDao.

Referenced by KitList::new_category().

virtual void KitListDao::delete_item ( long  id  )  [pure virtual]

Deletes an item by it's ID.

Parameters:
id the ID of the item to delete.

Implemented in XmlDao.

Referenced by KitList::delete_item().

virtual void KitListDao::update_item_checked_state ( ItemContainer items  )  [pure virtual]

Persists the state of the 'checked' flag of each item.

Implemented in XmlDao.

Referenced by KitList::tick_items().

virtual void KitListDao::remove_item_from_category ( long  id,
long  cat_id 
) [pure virtual]

Un-associates the specified item from the specified category.

Parameters:
id The Item id.
cat_id The Category id.

Implemented in XmlDao.

Referenced by KitList::remove_item_from_category().

virtual long KitListDao::get_next_item_id (  )  [pure virtual]

Returns the next unused unique id for items.

Implemented in XmlDao.

Referenced by Service::get_next_item_id().

virtual long KitListDao::get_next_category_id (  )  [pure virtual]

Returns the next unused unique id for categories.

Implemented in XmlDao.

Referenced by Service::get_next_category_id().

virtual void KitListDao::delete_category ( long  id  )  [pure virtual]

Deletes a category.

Implemented in XmlDao.

Referenced by KitList::delete_category().

virtual void KitListDao::set_item_flag ( long  id  )  [pure virtual]

Sets the checked flag for an item.

Parameters:
id The id of the item to change.

Implemented in XmlDao.

Referenced by KitList::set_item_flag().

virtual void KitListDao::unset_item_flag ( long  id  )  [pure virtual]

Clears the checked flag for an item.

Implemented in XmlDao.

Referenced by KitList::unset_item_flag().

virtual void KitListDao::set_category_flag ( long  id  )  [pure virtual]

Checks/ticks all items in the specified Category.

Implemented in XmlDao.

Referenced by KitList::set_category_flag().

virtual void KitListDao::unset_category_flag ( long  id  )  [pure virtual]

Unchecks/unticks all items in the specified Category.

Implemented in XmlDao.

Referenced by KitList::unset_category_flag().

virtual void KitListDao::set_all_flags (  )  [pure virtual]

Checks/ticks all items.

Implemented in XmlDao.

Referenced by KitList::set_all_flags().

virtual void KitListDao::unset_all_flags (  )  [pure virtual]

Unchecks/unticks all items.

Implemented in XmlDao.

Referenced by KitList::unset_all_flags().

virtual bool KitListDao::require_filename (  )  [inline, virtual]

Indicates whether the implementation of the data model requires a filename.

Some persistence models may require a filename to be chosen, others (e.g. database) may be defined through another mechanism. If a filename has not been set, then fire up save-as instead.

Returns:
Always returns false.

Reimplemented in XmlDao.

Definition at line 225 of file kitlistdao.hpp.

Referenced by Service::require_filename().


Member Data Documentation

int KitListDao::m_verbose_flag [protected]

Optional parameter indicating whether to include verbose output to STDOUT. Defaults to false.

Definition at line 50 of file kitlistdao.hpp.

Referenced by is_verbose(), and set_verbose().


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

Copyright 2008, 2009 Frank Dean