⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 domnodes.h

📁 简单的xml解析类
💻 H
📖 第 1 页 / 共 2 页
字号:
		void setName( String name );

		/** Defaults to adding a text node with the given value. */
		void setValue( String value );

		/**
		 * Sets the value of the given attribute node or adds the node
		 * if needed.
		 */
		void setAttribute( String attribute, String value );

		/** Adds a new text node. */
		void addText( String text );
		/** Sets the value of the given text node. */
		void setText( String text, int textNode );


	private:
		/**
		 * Copy constructor. Private because DomElementNodes should not be
		 * manipulated by more than one instance.
		 */
		DomElementNode( const DomElementNode& );
		/** Private assignment operator. See copy constructor documentation. */
		const DomElementNode& operator=( const DomElementNode& );

		virtual DomNode* clone( DomNode* parent );


		String m_name;
	};


	/**
	 * \class DomAttributeNode
	 * \brief Represents an attribute of an Xml element.
	 * \ingroup Xml
	 *
	 * getName() returns attribute name
	 * <br>getValue() returns attribute value
	 */
	class BLUE_EXPORT_XML DomAttributeNode :public DomNode
	{
	public:
		// ===========================================================
		//  creation/destruction
		// ===========================================================

		/** Constructor. */
		DomAttributeNode( DomNode* parent, String name = String::null, String value = String::null );

		/** Destructor. */
		virtual ~DomAttributeNode();


		// ===========================================================
		//  query
		// ===========================================================

		/** Returns the name of the attribute. */
		virtual String getName() const;
		/** Returns the value of the attribute. */
		virtual String getValue() const;
		/*** overload.  */
		virtual node_type_e getNodeType() const;
		
		/*** overload. */
		virtual String getPath() const;


		// ===========================================================
		//  manipulation
		// ===========================================================

		/** Sets the name of this attribute. */
		void setName( String name );
		/** Sets the value of this attribute. */
		void setValue( String value );


	private:
		/**
		 * Copy constructor. Private because DomAttributeNodes should not be
		 * manipulated by more than one instance.
		 */
		DomAttributeNode( const DomAttributeNode& );
		/** Private assignment operator. See copy constructor documentation. */
		const DomAttributeNode& operator=( const DomAttributeNode& );

		virtual DomNode* clone( DomNode* parent );

		String m_name;
		String m_value;
	};


	/**
	 * \class DomTextNode
	 * \brief Represents some text of an Xml element.
	 * \ingroup Xml
	 *
	 * Some elements contain more than one text segments.  An example
	 * of this can be seen in this Xml sample:
	 *
	 * \code
	 *  <root>
	 *     <child>
	 *        Some child data
	 *        <subChild/>
	 *        Some more child data
	 *     </child>
	 *  </root>
	 * \endcode
	 *
	 * There would be two DomTextNode nodes under the DomElementNode
	 * for the <code>child</code> element.  They would contain the
	 * text "Some child data" and "Some more child data".
	 *
	 * getName() returns "##text"
	 * <br>getValue() returns value of text
	 */
	class BLUE_EXPORT_XML DomTextNode :public DomNode
	{
	public:
		// ===========================================================
		//  creation/destruction
		// ===========================================================

		/** Constructor. */
		DomTextNode( DomNode* parent, String text = String::null );

		/** Destructor. */
		virtual ~DomTextNode();


		// ===========================================================
		//  query
		// ===========================================================

		/** Meaningless for this node type. */
		virtual String getName() const;
		/** Returns the text of the node. */
		virtual String getValue() const;
		/*** overload. */
		virtual node_type_e getNodeType() const;

		/*** overload. */
		virtual String getPath() const;

		// ===========================================================
		//  manipulation
		// ===========================================================

		/** Sets the text of the node. */
		void setValue( String value );


	private:
		/**
		 * Copy constructor. Private because DomTextNodes should not be
		 * manipulated by more than one instance.
		 */
		DomTextNode( const DomTextNode& );
		/** Private assignment operator. See copy constructor documentation. */
		const DomTextNode& operator=( const DomTextNode& );

		virtual DomNode* clone( DomNode* parent );


		String m_value;
	};


	/**
	 * \class DomCDataNode
	 * \brief Represents some CDATA text of an Xml element.
	 * \ingroup Xml
	 *
	 * This class acts identically to the DomTextNode class, but
	 * differentiates between normal text in an Xml document and
	 * CDATA text.
	 *
	 * getName() returns "##cdata"
	 * <br>getValue() returns text of node
	 */
	class BLUE_EXPORT_XML DomCDataNode :public DomTextNode
	{
	public:
		// ===========================================================
		//  creation/destruction
		// ===========================================================

		/** Constructor. */
		DomCDataNode( DomNode* parent, String text = String::null );

		/** Destructor. */
		virtual ~DomCDataNode();


		// ===========================================================
		//  query
		// ===========================================================

		/** Meaningless for this node type. */
		virtual String getName() const;
		/*** overload. */
		virtual node_type_e getNodeType() const;

		/*** overload. */
		virtual String getPath() const;

		// ===========================================================
		//  manipulation
		// ===========================================================


	private:
		/**
		 * Copy constructor. Private because DomCDataNodes should not be
		 * manipulated by more than one instance.
		 */
		DomCDataNode( const DomCDataNode& );
		/** Private assignment operator. See copy constructor documentation. */
		const DomCDataNode& operator=( const DomCDataNode& );

		virtual DomNode* clone( DomNode* parent );
	};


	/**
	 * \class DomProcInstNode
	 * \brief Represents a processing instruction in the Xml document.
	 * \ingroup Xml
	 *
	 * getName() returns name of instruction
	 * <br>getValue() returns String::null
	 */
	class BLUE_EXPORT_XML DomProcInstNode :public DomNode
	{
	public:
		// ===========================================================
		//  creation/destruction
		// ===========================================================

		/** Constructor. */
		DomProcInstNode( DomNode* parent, String instruction = String::null );

		/** Destructor. */
		virtual ~DomProcInstNode();


		// ===========================================================
		//  query
		// ===========================================================

		/** Returns the name of the processing instruction. */
		virtual String getName() const;
		/** Meaningless for this node type. */
		virtual String getValue() const;
		/*** overload. */
		virtual node_type_e getNodeType() const;

		/*** overload. */
		virtual String getPath() const;


		// ===========================================================
		//  manipulation
		// ===========================================================

		/** Sets the name of the processing instruction. */
		void setName( String name );


	private:
		/**
		 * Copy constructor. Private because DomProcInstNodes should not be
		 * manipulated by more than one instance.
		 */
		DomProcInstNode( const DomProcInstNode& );
		/** Private assignment operator. See copy constructor documentation. */
		const DomProcInstNode& operator=( const DomProcInstNode& );

		virtual DomNode* clone( DomNode* parent );


		String m_name;
	};


	/**
	 * \class DomCommentNode
	 * \brief Represents a comment in the Xml document.
	 * \ingroup Xml
	 *
	 * getName() returns "##comment"
	 * <br>getValue() returns text of comment
	 */
	class BLUE_EXPORT_XML DomCommentNode :public DomNode
	{
	public:
		// ===========================================================
		//  creation/destruction
		// ===========================================================

		/** Constructor. */
		DomCommentNode( DomNode* parent, String comment = String::null );

		/** Destructor. */
		virtual ~DomCommentNode();


		// ===========================================================
		//  query
		// ===========================================================

		/** Meaningless for this node type. */
		virtual String getName() const;
		/** Returns the contents of the comment. */
		virtual String getValue() const;
		/*** overload. */
		virtual node_type_e getNodeType() const;

		/*** overload. */
		virtual String getPath() const;


		// ===========================================================
		//  manipulation
		// ===========================================================

		/** Sets the value of the comment. */
		void setValue( String value );


	private:
		/**
		 * Copy constructor. Private because DomCommentNodes should not be
		 * manipulated by more than one instance.
		 */
		DomCommentNode( const DomCommentNode& );
		/** Private assignment operator. See copy constructor documentation. */
		const DomCommentNode& operator=( const DomCommentNode& );

		virtual DomNode* clone( DomNode* parent );


		String m_value;
	};


}}}	// namespaces


// Public External Variables ===============================================================================================

// Public Function Prototypes ==============================================================================================

// Public Inline Functions =================================================================================================

#endif // include guard

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -