📄 xmluniformiser.h
字号:
#ifndef CPPUNITTEST_XMLUNIFORMISER_H#define CPPUNITTEST_XMLUNIFORMISER_H#include <cppunit/SourceLine.h>#include <cppunit/TestAssert.h>#include <string>/*! Uniformise an XML string. * * Strips spaces between attribut in Element. * \warning Attribute values must be double-quoted (att="value"). * No support for embedded DTD declaration */class XmlUniformiser{public: XmlUniformiser( const std::string &xml ); std::string stripped();private: void skipSpaces(); bool isValidIndex(); void skipNext( int count =1 ); void copyNext( int count =1 ); void skipProcessed(); void skipComment(); void copyElement(); void copyElementContent(); bool isSpace( char c ); bool isSpace(); bool startsWith( std::string expected ); void copyElementName(); void copyElementAttributes(); void copyAttributeName(); bool isEndOfAttributeName(); void copyAttributeValue(); void copyUntilDoubleQuote(); void removeTrailingSpaces();private: unsigned int m_index; std::string m_xml; std::string m_stripped;};void checkXmlEqual( std::string expectedXml, std::string actualXml, CPPUNIT_NS::SourceLine sourceLine );/// Asserts that two XML strings are equivalent.#define CPPUNITTEST_ASSERT_XML_EQUAL( expected, actual ) \ ::checkXmlEqual( expected, actual, \ CPPUNIT_SOURCELINE() )#endif // XMLUNIFORMISER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -