IXmlTextReader.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*******************************************************************************
  2. The content of this file includes portions of the AUDIOKINETIC Wwise Technology
  3. released in source code form as part of the SDK installer package.
  4. Commercial License Usage
  5. Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
  6. may use this file in accordance with the end user license agreement provided
  7. with the software or, alternatively, in accordance with the terms contained in a
  8. written agreement between you and Audiokinetic Inc.
  9. Apache License Usage
  10. Alternatively, this file may be used under the Apache License, Version 2.0 (the
  11. "Apache License"); you may not use this file except in compliance with the
  12. Apache License. You may obtain a copy of the Apache License at
  13. http://www.apache.org/licenses/LICENSE-2.0.
  14. Unless required by applicable law or agreed to in writing, software distributed
  15. under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  16. OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
  17. the specific language governing permissions and limitations under the License.
  18. Copyright (c) 2023 Audiokinetic Inc.
  19. *******************************************************************************/
  20. /// \file
  21. /// Persistance interface for Wwise plugins.
  22. #ifndef AK_XML_READER
  23. #define AK_XML_READER
  24. namespace AK
  25. {
  26. /// Types of possible XML elements. See MSDN documentation topics for XmlNodeType.
  27. namespace XmlNodeType
  28. {
  29. /// See MSDN documentation topics for XmlNodeType.
  30. /// MUST match XmlLite node types
  31. enum NodeType
  32. {
  33. Attribute = 2,
  34. CDATA = 4,
  35. Comment = 8,
  36. Document = 9,
  37. DocumentFragment = 11,
  38. DocumentType = 10,
  39. Element = 1,
  40. EndElement = 15,
  41. EndEntity = 16,
  42. Entity = 6,
  43. EntityReference = 5,
  44. None = 0,
  45. Notation = 12,
  46. ProcessingInstruction = 7,
  47. SignificantWhitespace = 14,
  48. Text = 3,
  49. Whitespace = 13,
  50. XmlDeclaration = 17
  51. };
  52. }
  53. /// Interface for plugin persistance.
  54. /// \sa AK::Wwise::IAudioPlugin::Load
  55. class IXmlTextReader
  56. {
  57. public:
  58. /// Destroys the text reader. You should not call this function.
  59. virtual void Destroy() = 0;
  60. // Properties
  61. /// Gets the name of the current element
  62. virtual CStringW GetName() const = 0;
  63. /// Gets the current node type
  64. /// \ref AK::XmlNodeType
  65. virtual AK::XmlNodeType::NodeType GetNodeType() const = 0;
  66. /// Tests if the current element is empty
  67. /// \return True if the current element is empty, false otherwise
  68. virtual bool IsEmptyElement() const = 0;
  69. /// Gets the string representation of the current element's value
  70. /// \return The value
  71. virtual CStringW GetValue() const = 0;
  72. /// \return True if the end of XML document was reached
  73. virtual bool IsEOF() const = 0;
  74. /// Gets the current element's line number. If the element is multiline, the start line is given.
  75. /// \return the element's line number
  76. virtual int GetLineNumber() const = 0;
  77. /// Gets the current element's horizontal position.
  78. /// \return the element column
  79. virtual int GetLinePosition() const = 0;
  80. // Methods
  81. /// Checks whether the current node is a content (non-white space text, CDATA, Element, EndElement,
  82. /// EntityReference, or EndEntity) node. If the node is not a content node, the reader skips ahead
  83. /// to the next content node or end of file. It skips over nodes of the following type:
  84. /// ProcessingInstruction, DocumentType, Comment, Whitespace, or SignificantWhitespace.
  85. /// \return The NodeType of the current node found by the method or XmlNodeType.None if the reader has reached the end of the input stream.
  86. virtual AK::XmlNodeType::NodeType MoveToContent() = 0;
  87. /// Reads the next node from the stream.
  88. /// \return true if the next node was read successfully; false if there are no more nodes to read.
  89. virtual bool Read() = 0;
  90. /// This is a helper method for reading simple text-only elements.
  91. /// \return The text contained in the element that was read. An empty string if the element is empty.
  92. virtual CStringW ReadElementString( const CStringW& in_rcsElementNameValidation ) = 0;
  93. /// Reads all the content, including markup, as a string.
  94. /// \return All the XML content, including markup, in the current node. If the current node has no children, an empty string is returned. If the current node is neither an element nor attribute, an empty string is returned.
  95. virtual void ReadInnerXml( CStringW& out_csXml ) = 0;
  96. /// Reads the content, including markup, representing this node and all its children.
  97. /// \return If the reader is positioned on an element or an attribute node, this method returns all the XML content, including markup, of the current node and all its children; otherwise, it returns an empty string.
  98. virtual void ReadOuterXml( CStringW& out_csXml ) = 0;
  99. /// Skips the children of the current node.
  100. virtual void Skip() = 0;
  101. /// Gets the value of an attribute.
  102. /// \return The attribute value
  103. virtual CStringW GetAttribute( const CStringW& in_rcsAttributeName /// The attribute name
  104. ) = 0;
  105. /// Gets the value of an attribute.
  106. /// \return The true if value exists
  107. virtual bool GetAttribute(
  108. const CStringW& in_rcsAttributeName, /// The attribute name
  109. CStringW& out_rcsValue/// The attribute name
  110. ) = 0;
  111. };
  112. }
  113. #endif