summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-01 08:48:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-01 09:24:28 (GMT)
commit2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch)
treed46294f35150c4f0f43deaf2d31fceaf945ae715 /3rdParty/CppUnit/cppunit/tools
downloadswift-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip
swift-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2
Import.
Diffstat (limited to '3rdParty/CppUnit/cppunit/tools')
-rw-r--r--3rdParty/CppUnit/cppunit/tools/Algorithm.h23
-rw-r--r--3rdParty/CppUnit/cppunit/tools/StringTools.h34
-rw-r--r--3rdParty/CppUnit/cppunit/tools/XmlDocument.h86
-rw-r--r--3rdParty/CppUnit/cppunit/tools/XmlElement.h149
4 files changed, 292 insertions, 0 deletions
diff --git a/3rdParty/CppUnit/cppunit/tools/Algorithm.h b/3rdParty/CppUnit/cppunit/tools/Algorithm.h
new file mode 100644
index 0000000..e5746a2
--- /dev/null
+++ b/3rdParty/CppUnit/cppunit/tools/Algorithm.h
@@ -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
diff --git a/3rdParty/CppUnit/cppunit/tools/StringTools.h b/3rdParty/CppUnit/cppunit/tools/StringTools.h
new file mode 100644
index 0000000..7a6b6d7
--- /dev/null
+++ b/3rdParty/CppUnit/cppunit/tools/StringTools.h
@@ -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
diff --git a/3rdParty/CppUnit/cppunit/tools/XmlDocument.h b/3rdParty/CppUnit/cppunit/tools/XmlDocument.h
new file mode 100644
index 0000000..4ee7325
--- /dev/null
+++ b/3rdParty/CppUnit/cppunit/tools/XmlDocument.h
@@ -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
diff --git a/3rdParty/CppUnit/cppunit/tools/XmlElement.h b/3rdParty/CppUnit/cppunit/tools/XmlElement.h
new file mode 100644
index 0000000..0b36bd2
--- /dev/null
+++ b/3rdParty/CppUnit/cppunit/tools/XmlElement.h
@@ -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