aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Xbox/Sentient/Include/SenClientXML.h
blob: d1ebc051f12623a2b49a0c29674ead6dee9f57a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/********************************************************
*                                                       *
* Copyright (C) Microsoft. All rights reserved.         *
*                                                       *
********************************************************/

// Sentient Client XML API
//
// Include this to get access to all XML Sentient features.

#pragma once

#include "SenClientTypes.h"


namespace Sentient
{
	//======================//
	//                      //
	//    XML Data Types    //
	//                      //
	//======================//

	/// @brief           An easy-to-access pre-parsed XML.
	///
	/// @details         This holds some easily-traversible, easily-searchible representations
	///                  of the content of a raw UTF-8 XML buffer.
	///
	/// @related         SenXMLParse()
	/// @related         SenXMLDestroy()
	///
	struct SenXML
	{
		void *reserved;
	};


	//=====================//
	//                     //
	//    XML Functions    //
	//                     //
	//=====================//

	/// @brief           Parse a raw UTF-8 XML buffer into a more useful format.
	///
	/// @param[in]       source
	///                  The raw UTF-8 XML buffer to be parsed.
	///
	/// @param[out]      out_senXML
	///                  The (private) object to hold the parsed data.
	///
	/// @return          Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.  Specific values include:
	///                  E_POINTER: Bad pointer to the raw XML buffer.
	///                  E_OUTOFMEMORY: Couldn't parse due to lack of memory.
	///                  E_FAIL: Failed to parse for unspecified reason.
	///                  S_OK: Parsed successfully.
	///
	/// @details         It is expensive to parse an XML file directly for each attribute fetch.
	///                  Thus, we pre-parse the whole thing once after (down)loading it and then
	///                  pass the parsed data to the fetch routines.
	///
	/// @related         SenXMLDestroy()
	///
	HRESULT SenXMLParse( 
		const char *source, 
		SenXML *out_senXML );

	/// @brief           Free the resources/memory associated with a parsed XML file.
	///
	/// @param[in]       senXML
	///                  The (private) object holding the parsed data to be freed.
	///
	/// @return          Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.  Specific values include:
	///                  E_INVALIDARG: senXML is not a parsed XML.
	///                  S_OK: Destroyed/freed successfully.
	///
	/// @details         A parsed XML takes up some extra memory.  Once done with its contents,
	///                  you should call this routine to free it up.
	///
	/// @related         SenXMLParse()
	///
	HRESULT SenXMLDestroy( 
		SenXML &senXML );

} // namespace Sentient