初步修复

This commit is contained in:
Cussrro 2024-12-19 09:48:26 +08:00
parent 8fc4357cc6
commit e4714f3f0e
46705 changed files with 12004901 additions and 0 deletions

View file

@ -0,0 +1,23 @@
#ifndef CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
#define CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
#include <cppunit/Portability.h>
CPPUNIT_NS_BEGIN
template<class SequenceType, class ValueType>
void
removeFromSequence( SequenceType &sequence,
const ValueType &valueToRemove )
{
for ( unsigned int index =0; index < sequence.size(); ++index )
{
if ( sequence[ index ] == valueToRemove )
sequence.erase( sequence.begin() + index );
}
}
CPPUNIT_NS_END
#endif // CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED

View file

@ -0,0 +1,7 @@
libcppunitincludedir = $(includedir)/cppunit/tools
libcppunitinclude_HEADERS = \
Algorithm.h \
StringTools.h \
XmlElement.h \
XmlDocument.h

View file

@ -0,0 +1,435 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = include/cppunit/tools
DIST_COMMON = $(libcppunitinclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/config/ac_create_prefix_config_h.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/ac_cxx_rtti.m4 \
$(top_srcdir)/config/ac_cxx_string_compare_string_first.m4 \
$(top_srcdir)/config/ac_dll.m4 \
$(top_srcdir)/config/ax_cxx_gcc_abi_demangle.m4 \
$(top_srcdir)/config/ax_cxx_have_isfinite.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libcppunitincludedir)"
libcppunitincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(libcppunitinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPUNIT_BINARY_AGE = @CPPUNIT_BINARY_AGE@
CPPUNIT_INTERFACE_AGE = @CPPUNIT_INTERFACE_AGE@
CPPUNIT_MAJOR_VERSION = @CPPUNIT_MAJOR_VERSION@
CPPUNIT_MICRO_VERSION = @CPPUNIT_MICRO_VERSION@
CPPUNIT_MINOR_VERSION = @CPPUNIT_MINOR_VERSION@
CPPUNIT_VERSION = @CPPUNIT_VERSION@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBADD_DL = @LIBADD_DL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
enable_dot = @enable_dot@
enable_html_docs = @enable_html_docs@
enable_latex_docs = @enable_latex_docs@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
libcppunitincludedir = $(includedir)/cppunit/tools
libcppunitinclude_HEADERS = \
Algorithm.h \
StringTools.h \
XmlElement.h \
XmlDocument.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/cppunit/tools/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu include/cppunit/tools/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-libcppunitincludeHEADERS: $(libcppunitinclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(libcppunitincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libcppunitincludedir)"
@list='$(libcppunitinclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(libcppunitincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libcppunitincludedir)/$$f'"; \
$(libcppunitincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libcppunitincludedir)/$$f"; \
done
uninstall-libcppunitincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libcppunitinclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libcppunitincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(libcppunitincludedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libcppunitincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-libcppunitincludeHEADERS
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libcppunitincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libcppunitincludeHEADERS install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libcppunitincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,34 @@
#ifndef CPPUNIT_TOOLS_STRINGTOOLS_H
#define CPPUNIT_TOOLS_STRINGTOOLS_H
#include <cppunit/Portability.h>
#include <string>
#include <cppunit/portability/CppUnitVector.h>
CPPUNIT_NS_BEGIN
/*! \brief Tool functions to manipulate string.
*/
struct StringTools
{
typedef CppUnitVector<std::string> Strings;
static std::string CPPUNIT_API toString( int value );
static std::string CPPUNIT_API toString( double value );
static Strings CPPUNIT_API split( const std::string &text,
char separator );
static std::string CPPUNIT_API wrap( const std::string &text,
int wrapColumn = CPPUNIT_WRAP_COLUMN );
};
CPPUNIT_NS_END
#endif // CPPUNIT_TOOLS_STRINGTOOLS_H

View file

@ -0,0 +1,86 @@
#ifndef CPPUNIT_TOOLS_XMLDOCUMENT_H
#define CPPUNIT_TOOLS_XMLDOCUMENT_H
#include <cppunit/Portability.h>
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( push )
#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
#endif
#include <string>
CPPUNIT_NS_BEGIN
class XmlElement;
/*! \brief A XML Document.
*
* A XmlDocument represents a XML file. It holds a pointer on the root XmlElement
* of the document. It also holds the encoding and style sheet used.
*
* By default, the XML document is stand-alone and tagged with enconding "ISO-8859-1".
*/
class CPPUNIT_API XmlDocument
{
public:
/*! \brief Constructs a XmlDocument object.
* \param encoding Encoding used in the XML file (default is Latin-1, ISO-8859-1 ).
* \param styleSheet Name of the XSL style sheet file used. If empty then no
* style sheet will be specified in the output.
*/
XmlDocument( const std::string &encoding = "",
const std::string &styleSheet = "" );
/// Destructor.
virtual ~XmlDocument();
std::string encoding() const;
void setEncoding( const std::string &encoding = "" );
std::string styleSheet() const;
void setStyleSheet( const std::string &styleSheet = "" );
bool standalone() const;
/*! \brief set the output document as standalone or not.
*
* For the output document, specify wether it's a standalone XML
* document, or not.
*
* \param standalone if true, the output will be specified as standalone.
* if false, it will be not.
*/
void setStandalone( bool standalone );
void setRootElement( XmlElement *rootElement );
XmlElement &rootElement() const;
std::string toString() const;
private:
/// Prevents the use of the copy constructor.
XmlDocument( const XmlDocument &copy );
/// Prevents the use of the copy operator.
void operator =( const XmlDocument &copy );
protected:
std::string m_encoding;
std::string m_styleSheet;
XmlElement *m_rootElement;
bool m_standalone;
};
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( pop )
#endif
CPPUNIT_NS_END
#endif // CPPUNIT_TOOLS_XMLDOCUMENT_H

View file

@ -0,0 +1,149 @@
#ifndef CPPUNIT_TOOLS_XMLELEMENT_H
#define CPPUNIT_TOOLS_XMLELEMENT_H
#include <cppunit/Portability.h>
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( push )
#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
#endif
#include <cppunit/portability/CppUnitDeque.h>
#include <string>
CPPUNIT_NS_BEGIN
class XmlElement;
#if CPPUNIT_NEED_DLL_DECL
// template class CPPUNIT_API std::deque<XmlElement *>;
#endif
/*! \brief A XML Element.
*
* A XML element has:
* - a name, specified on construction,
* - a content, specified on construction (may be empty),
* - zero or more attributes, added with addAttribute(),
* - zero or more child elements, added with addElement().
*/
class CPPUNIT_API XmlElement
{
public:
/*! \brief Constructs an element with the specified name and string content.
* \param elementName Name of the element. Must not be empty.
* \param content Content of the element.
*/
XmlElement( std::string elementName,
std::string content ="" );
/*! \brief Constructs an element with the specified name and numeric content.
* \param elementName Name of the element. Must not be empty.
* \param numericContent Content of the element.
*/
XmlElement( std::string elementName,
int numericContent );
/*! \brief Destructs the element and its child elements.
*/
virtual ~XmlElement();
/*! \brief Returns the name of the element.
* \return Name of the element.
*/
std::string name() const;
/*! \brief Returns the content of the element.
* \return Content of the element.
*/
std::string content() const;
/*! \brief Sets the name of the element.
* \param name New name for the element.
*/
void setName( const std::string &name );
/*! \brief Sets the content of the element.
* \param content New content for the element.
*/
void setContent( const std::string &content );
/*! \overload void setContent( const std::string &content )
*/
void setContent( int numericContent );
/*! \brief Adds an attribute with the specified string value.
* \param attributeName Name of the attribute. Must not be an empty.
* \param value Value of the attribute.
*/
void addAttribute( std::string attributeName,
std::string value );
/*! \brief Adds an attribute with the specified numeric value.
* \param attributeName Name of the attribute. Must not be empty.
* \param numericValue Numeric value of the attribute.
*/
void addAttribute( std::string attributeName,
int numericValue );
/*! \brief Adds a child element to the element.
* \param element Child element to add. Must not be \c NULL.
*/
void addElement( XmlElement *element );
/*! \brief Returns the number of child elements.
* \return Number of child elements (element added with addElement()).
*/
int elementCount() const;
/*! \brief Returns the child element at the specified index.
* \param index Zero based index of the element to return.
* \returns Element at the specified index. Never \c NULL.
* \exception std::invalid_argument if \a index < 0 or index >= elementCount().
*/
XmlElement *elementAt( int index ) const;
/*! \brief Returns the first child element with the specified name.
* \param name Name of the child element to return.
* \return First child element found which is named \a name.
* \exception std::invalid_argument if there is no child element with the specified
* name.
*/
XmlElement *elementFor( const std::string &name ) const;
/*! \brief Returns a XML string that represents the element.
* \param indent String of spaces representing the amount of 'indent'.
* \return XML string that represents the element, its attributes and its
* child elements.
*/
std::string toString( const std::string &indent = "" ) const;
private:
typedef std::pair<std::string,std::string> Attribute;
std::string attributesAsString() const;
std::string escape( std::string value ) const;
private:
std::string m_name;
std::string m_content;
typedef CppUnitDeque<Attribute> Attributes;
Attributes m_attributes;
typedef CppUnitDeque<XmlElement *> Elements;
Elements m_elements;
};
CPPUNIT_NS_END
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( pop )
#endif
#endif // CPPUNIT_TOOLS_XMLELEMENT_H