47 xmlpp::SaxParser::AttributeList::const_iterator attribute =
48 std::find_if(attributes.begin(), attributes.end(), AttributeHasName(
"id"));
49 if (attribute != attributes.end()) {
52 std::cout <<
"WARNING: Missing id attribute for a item element " << std::endl;
55 std::find_if(attributes.begin(), attributes.end(), AttributeHasName(
"checked"));
56 if (attribute != attributes.end()) {
69 xmlpp::SaxParser::AttributeList::const_iterator attribute =
70 std::find_if(attributes.begin(), attributes.end(), AttributeHasName(
"id"));
71 if (attribute != attributes.end()) {
76 std::cout <<
"WARNING: Missing id attribute for a category element " << std::endl;
88 xmlpp::SaxParser::AttributeList::const_iterator attribute =
89 std::find_if(attributes.begin(), attributes.end(), AttributeHasName(
"id"));
90 if (attribute != attributes.end()) {
96 std::cout <<
"Unable to find item id: " 98 <<
"belonging to category id: " 104 std::cout <<
"WARNING: Missing id attribute for a category-item element " << std::endl;
119 if (name.compare(
"item") == 0) {
121 }
else if (name.compare(
"category") == 0) {
123 }
else if (name.compare(
"category-item") == 0) {
143 if (name.compare(
"item") == 0 &&
m_item != NULL &&
m_cdata.size() > 0) {
145 }
else if (name.compare(
"category-name") == 0 &&
m_category != NULL &&
m_cdata.size() > 0) {
178 std::cout <<
"on_warning(): " << text << std::endl;
184 std::cout <<
"on_error(): " << text << std::endl;
190 std::cout <<
"on_fatal_error: " << text << std::endl;
virtual void on_error(const Glib::ustring &text)
Outputs any errors to STDOUT.
virtual void on_start_element(const Glib::ustring &name, const AttributeList &attributes)
Called for each element.
virtual void on_end_document()
Does nothing. Called at the end of a document.
ModelItem * m_item
The most recently processed item element.
void process_item(const AttributeList &attributes)
<The most recently processed CDATA
Represents a Category combined with GuiState attributes.
virtual void on_comment(const Glib::ustring &text)
Does nothing. Called for each comment.
virtual void add_category(ModelCategory *category)
Add a category to the model.
virtual ModelItem * find_item(long id)
Finds an item by it's unique ID.
virtual void on_warning(const Glib::ustring &text)
Outputs any warnings to STDOUT.
void set_name(const std::string name)
void process_category(const AttributeList &attributes)
Reads a category's attributes from a 'category' element.
virtual void on_characters(const Glib::ustring &text)
Called for each piece of CDATA belonging to an element.
virtual void on_end_element(const Glib::ustring &name)
Called at the end of each element.
Represents an Item combined with GuiState attributes.
virtual void on_fatal_error(const Glib::ustring &text)
Outputs any fatal errors to STDOUT.
virtual void on_start_document()
Does nothing. Called at the start of a document.
virtual void set_checked(bool checked)
virtual void add_item(Item *)
Adds the passed item to this ModelCategory.
virtual void add_item(ModelItem *item)
Adds an item to the model.
ModelCategory * m_category
The most recently processed category element.
void process_category_item(const AttributeList &attributes)
Reads details of an item association with a category from a 'category-item' element.
void set_description(const std::string description)