#include <kitparser.hpp>
Public Member Functions | |
KitParser (KitModel &model) | |
Constructor taking the rich data model to save the XML document within. | |
virtual | ~KitParser () |
Protected Member Functions | |
virtual void | on_start_document () |
Does nothing. Called at the start of a document. | |
virtual void | on_end_document () |
Does nothing. Called at the end of a document. | |
virtual void | on_start_element (const Glib::ustring &name, const AttributeList &attributes) |
Called for each element. | |
virtual void | on_end_element (const Glib::ustring &name) |
Called at the end of each element. | |
virtual void | on_characters (const Glib::ustring &text) |
Called for each piece of CDATA belonging to an element. | |
virtual void | on_comment (const Glib::ustring &text) |
Does nothing. Called for each comment. | |
virtual void | on_warning (const Glib::ustring &text) |
Outputs any warnings to STDOUT. | |
virtual void | on_error (const Glib::ustring &text) |
Outputs any errors to STDOUT. | |
virtual void | on_fatal_error (const Glib::ustring &text) |
Outputs any fatal errors to STDOUT. | |
Protected Attributes | |
KitModel & | m_model |
Private Member Functions | |
void | process_item (const AttributeList &attributes) |
<The most recently processed CDATA | |
void | process_category (const AttributeList &attributes) |
Reads a category's attributes from a 'category' element. | |
void | process_category_item (const AttributeList &attributes) |
Reads details of an item association with a category from a 'category-item' element. | |
Private Attributes | |
ModelCategory * | m_category |
The most recently processed category element. | |
ModelItem * | m_item |
The most recently processed item element. | |
Glib::ustring | m_cdata |
Definition at line 35 of file kitparser.hpp.
KitParser::KitParser | ( | KitModel & | model | ) | [inline] |
Constructor taking the rich data model to save the XML document within.
Definition at line 45 of file kitparser.hpp.
virtual KitParser::~KitParser | ( | ) | [inline, virtual] |
Definition at line 46 of file kitparser.hpp.
void KitParser::process_item | ( | const AttributeList & | attributes | ) | [private] |
<The most recently processed CDATA
Reads an item's attributes from an 'item' element.
attributes | The list of attributes for the element. |
Definition at line 45 of file kitparser.cpp.
References KitModel::add_item(), m_item, m_model, ModelItem::set_checked(), and Item::set_id().
Referenced by on_start_element().
void KitParser::process_category | ( | const AttributeList & | attributes | ) | [private] |
Reads a category's attributes from a 'category' element.
attributes | The list of attributes for the element. |
Definition at line 68 of file kitparser.cpp.
References KitModel::add_category(), m_category, m_model, and Category::set_id().
Referenced by on_start_element().
void KitParser::process_category_item | ( | const AttributeList & | attributes | ) | [private] |
Reads details of an item association with a category from a 'category-item' element.
attributes | The list of attributes for the element. |
Definition at line 87 of file kitparser.cpp.
References ModelCategory::add_item(), KitModel::find_item(), Category::get_id(), m_category, and m_model.
Referenced by on_start_element().
void KitParser::on_start_document | ( | ) | [protected, virtual] |
void KitParser::on_end_document | ( | ) | [protected, virtual] |
void KitParser::on_start_element | ( | const Glib::ustring & | name, | |
const AttributeList & | attributes | |||
) | [protected, virtual] |
Called for each element.
Determines which element is being processed and calls appropriate method to process the corresponding attributes.
Definition at line 115 of file kitparser.cpp.
References m_cdata, process_category(), process_category_item(), and process_item().
void KitParser::on_end_element | ( | const Glib::ustring & | name | ) | [protected, virtual] |
Called at the end of each element.
If any CDATA existed in the element body, sets the text belonging to the appropriate element object with the previously captured CDATA.
Definition at line 141 of file kitparser.cpp.
References m_category, m_cdata, m_item, Item::set_description(), and Category::set_name().
void KitParser::on_characters | ( | const Glib::ustring & | text | ) | [protected, virtual] |
Called for each piece of CDATA belonging to an element.
This may be called a number of times, each time passing a bit more of the parsed CDATA. The processing of the CDATA is split up by any embedded entities.
The CDATA is held in a private member variable. The CDATA variable is cleared at the start of each new element and appended to at each call to this method. The captured text is then set on the appropriate object during KitParser::on_end_element().
Definition at line 164 of file kitparser.cpp.
References m_cdata.
void KitParser::on_comment | ( | const Glib::ustring & | text | ) | [protected, virtual] |
void KitParser::on_warning | ( | const Glib::ustring & | text | ) | [protected, virtual] |
void KitParser::on_error | ( | const Glib::ustring & | text | ) | [protected, virtual] |
void KitParser::on_fatal_error | ( | const Glib::ustring & | text | ) | [protected, virtual] |
ModelCategory* KitParser::m_category [private] |
The most recently processed category element.
Definition at line 37 of file kitparser.hpp.
Referenced by on_end_element(), process_category(), and process_category_item().
ModelItem* KitParser::m_item [private] |
The most recently processed item element.
Definition at line 38 of file kitparser.hpp.
Referenced by on_end_element(), and process_item().
Glib::ustring KitParser::m_cdata [private] |
Definition at line 39 of file kitparser.hpp.
Referenced by on_characters(), on_end_element(), and on_start_element().
KitModel& KitParser::m_model [protected] |
Definition at line 48 of file kitparser.hpp.
Referenced by process_category(), process_category_item(), and process_item().