mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
examples: AddressBookXML2 modernised
git-svn-id: svn://ultimatepp.org/upp/trunk@4152 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9675db634c
commit
4615a77213
3 changed files with 13 additions and 18 deletions
|
|
@ -143,27 +143,17 @@ void AddressBook::Open()
|
|||
if(n.GetCount()==0 || n[0].GetTag() != TAG_ADDRESSBOOK)
|
||||
throw XmlError("No AddressBook tag");
|
||||
const XmlNode &ab = n[0];
|
||||
array.SetCount(ab.GetCount());
|
||||
for(int i=0; i < ab.GetCount(); i++){
|
||||
for(int i = 0; i < ab.GetCount(); i++) {
|
||||
const XmlNode &person = ab[i];
|
||||
for(int j=0; j < person.GetCount(); j++){
|
||||
const XmlNode &prop = person[j];
|
||||
if(prop.IsTag(TAG_NAME))
|
||||
array.Set(i, TAG_NAME, prop[0].GetText());
|
||||
else
|
||||
if(prop.IsTag(TAG_SURNAME))
|
||||
array.Set(i, TAG_SURNAME, prop[0].GetText());
|
||||
else
|
||||
if(prop.IsTag(TAG_ADDRESS))
|
||||
array.Set(i, TAG_ADDRESS, prop[0].GetText());
|
||||
else
|
||||
if(prop.IsTag(TAG_EMAIL))
|
||||
array.Set(i, TAG_EMAIL, prop[0].GetText());
|
||||
}
|
||||
if(person.IsTag(TAG_PERSON))
|
||||
array.Add(person[TAG_NAME].GatherText(),
|
||||
person[TAG_SURNAME].GatherText(),
|
||||
person[TAG_ADDRESS].GatherText(),
|
||||
person[TAG_EMAIL].GatherText());
|
||||
}
|
||||
}
|
||||
catch(XmlError &e) {
|
||||
Exclamation("Error reading the input file:&" + DeQtf(e) );
|
||||
Exclamation("Error reading the input file:&\1" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
description "Address book application, uses XML to store data (using DOM like U++ classes)";
|
||||
description "Address book application, uses XML to store data (using DOM like U++ classes)\377";
|
||||
|
||||
uses
|
||||
CtrlLib,
|
||||
|
|
|
|||
5
examples/AddressBookXML2/init
Normal file
5
examples/AddressBookXML2/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _AddressBookXML2_icpp_init_stub
|
||||
#define _AddressBookXML2_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "Report/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue