aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_downloads/ParseUtil.cpp
blob: 0a5c8d575505a9ce4a4675afb926c6cb5329f6ac (plain) (blame)
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
#include "ParseUtil.h"

bool PropertyIsTrue( const XMLNode *item, const wchar_t *property )
{
	if ( !item )
		return false;

	const wchar_t *value = item->GetProperty( property );
	if ( !value )
		return false;

	return !_wcsicmp( value, L"true" );
}

bool PropertyIsFalse( const XMLNode *item, const wchar_t *property )
{
	if ( !item )
		return false;

	const wchar_t *value = item->GetProperty( property );
	if ( !value )
		return false;

	return !_wcsicmp( value, L"false" );
}

const wchar_t *GetContent( const XMLNode *item, const wchar_t *tag )
{
	const XMLNode *curNode = item->Get( tag );
	if ( curNode )
		return curNode->GetContent();
	else
		return 0;
}

const wchar_t *GetProperty( const XMLNode *item, const wchar_t *tag, const wchar_t *property )
{
	const XMLNode *curNode = item->Get( tag );
	if ( curNode )
		return curNode->GetProperty( property );
	else
		return 0;
}