more docu

This commit is contained in:
Marc Wäckerlin
2009-04-22 08:25:20 +00:00
parent 650e88e2c3
commit 9548b27052
10 changed files with 243 additions and 36 deletions

View File

@@ -60,7 +60,7 @@ CREATE_SUBDIRS = NO
# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
# and Ukrainian.
OUTPUT_LANGUAGE = German
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
@@ -578,7 +578,7 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH = .
EXAMPLE_PATH = @SRCDIR@/..
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp

62
doc/examples/address.cxx Normal file
View File

@@ -0,0 +1,62 @@
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
// g++ -I../src ../src/xml.cxx address.cxx
#include <xml-cxx/xml.hxx>
#include <iostream>
#include <sstream>
#include <fstream>
int main(int, char**) try {
// Example template in factory instantiation
xml::Factory addrTpl(xml::Node("address")
<<(xml::Node("name").limits(1, 1)
<<xml::String("first").limits(1, 1)
<<xml::String("middle") // 0..n -> .limit(0, 0)
<<xml::String("last").limits(1, 1))
<<(xml::Node("location").max(1)
<<xml::String("line").min(1))
<<xml::String("email")
<<xml::String("url")
<<xml::String("country").max(1));
// Example XML file to read
std::stringstream ss("\
<address>\
<name>\
<first>Marc</first>\
<middle>Roman</middle>\
<last>Wäckerlin</last>\
</name>\
<location>\
<line>SwissSign AG</line>\
<line>Pfingstweidstrasse 60b</line>\
<line>8005 Zürich</line>\
</location>\
<country>Schweiz</country>\
<email>marc@waeckerlin.org</email>\
<email>marc.waeckerlin@swisssign.com</email>\
<url>http://dev.swisssign.com/trac/libxml-cxx</url>\
<url>http://marc.wäckerlin.ch</url>\
<url>http://marc.waeckerlin.org</url>\
<url>http://dev.swisssign.com</url>\
<url>http://swissign.com</url>\
<url>http://swissign.ch</url>\
</address>");
std::auto_ptr<xml::Node> author(addrTpl.read(ss));
// write to stdout
std::cout<<"Successfully read:"<<std::endl
<<"------------------------------"<<std::endl
<<*author<<std::endl
<<"------------------------------"<<std::endl;
// store in project's AUTHORS file
std::ofstream ofs("../AUTHORS");
ofs<<*author<<std::endl;
return 0;
} catch (std::exception& e) {
std::cerr<<"**** Error: "<<e.what()<<std::endl;
}

14
doc/examples/makefile.am Normal file
View File

@@ -0,0 +1,14 @@
## @id $Id$
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
AM_CXXFLAGS += -I ${top_srcdir}/src
AM_LDFLAGS = -L${top_builddir}/src
noinst_PROGRAMS = address
address_SOURCES = address.cxx
address_LDADD = -lxml-cxx
MAINTAINERCLEANFILES = makefile.in

View File

@@ -5,6 +5,8 @@
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
SUBDIRS = examples
develdir = ${pkgdatadir}/doc
devel_DATA = html/index.html