Kitlist
1.1.0
|
SaxParser implementation for reading the KitModel from an XML document. More...
#include <kitparser.hpp>
Public Member Functions | |
KitParser (KitModel &model) | |
Constructor taking the rich data model to save the XML document within. More... | |
virtual | ~KitParser () |
Protected Member Functions | |
virtual void | on_start_document () |
Does nothing. Called at the start of a document. More... | |
virtual void | on_end_document () |
Does nothing. Called at the end of a document. More... | |
virtual void | on_start_element (const Glib::ustring &name, const AttributeList &attributes) |
Called for each element. More... | |
virtual void | on_end_element (const Glib::ustring &name) |
Called at the end of each element. More... | |
virtual void | on_characters (const Glib::ustring &text) |
Called for each piece of CDATA belonging to an element. More... | |
virtual void | on_comment (const Glib::ustring &text) |
Does nothing. Called for each comment. More... | |
virtual void | on_warning (const Glib::ustring &text) |
Outputs any warnings to STDOUT. More... | |
virtual void | on_error (const Glib::ustring &text) |
Outputs any errors to STDOUT. More... | |
virtual void | on_fatal_error (const Glib::ustring &text) |
Outputs any fatal errors to STDOUT. More... | |
Protected Attributes | |
KitModel & | m_model |
Private Member Functions | |
void | process_item (const AttributeList &attributes) |
<The most recently processed CDATA More... | |
void | process_category (const AttributeList &attributes) |
Reads a category's attributes from a 'category' element. More... | |
void | process_category_item (const AttributeList &attributes) |
Reads details of an item association with a category from a 'category-item' element. More... | |
Private Attributes | |
ModelCategory * | m_category |
The most recently processed category element. More... | |
ModelItem * | m_item |
The most recently processed item element. More... | |
Glib::ustring | m_cdata |
SaxParser implementation for reading the KitModel from an XML document.
Definition at line 35 of file kitparser.hpp.
|
inline |
Constructor taking the rich data model to save the XML document within.
Definition at line 45 of file kitparser.hpp.
|
inlinevirtual |
Definition at line 46 of file kitparser.hpp.
|
protectedvirtual |
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.
|
protectedvirtual |
Does nothing. Called for each comment.
Definition at line 171 of file kitparser.cpp.
|
protectedvirtual |
Does nothing. Called at the end of a document.
Definition at line 35 of file kitparser.cpp.
|
protectedvirtual |
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().
|
protectedvirtual |
Outputs any errors to STDOUT.
Definition at line 183 of file kitparser.cpp.
|
protectedvirtual |
Outputs any fatal errors to STDOUT.
Definition at line 189 of file kitparser.cpp.
|
protectedvirtual |
Does nothing. Called at the start of a document.
Definition at line 29 of file kitparser.cpp.
|
protectedvirtual |
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().
|
protectedvirtual |
Outputs any warnings to STDOUT.
Definition at line 177 of file kitparser.cpp.
|
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().
|
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().
|
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().
|
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().
|
private |
Definition at line 39 of file kitparser.hpp.
Referenced by on_characters(), on_end_element(), and on_start_element().
|
private |
The most recently processed item element.
Definition at line 38 of file kitparser.hpp.
Referenced by on_end_element(), and process_item().
|
protected |
Definition at line 48 of file kitparser.hpp.
Referenced by process_category(), process_category_item(), and process_item().