Skip to content

Commit

Permalink
Rename CXml -> XMLDocument.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Jan 25, 2016
1 parent 259afbc commit b56d7af
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
64 changes: 32 additions & 32 deletions src/xrCore/XML/xrXMLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
#include "xrXMLParser.h"


CXml::CXml()
XMLDocument::XMLDocument()
: m_root (NULL),
m_pLocalRoot (NULL)
{}

CXml::~CXml()
XMLDocument::~XMLDocument()
{
ClearInternal();
}

void CXml::ClearInternal()
void XMLDocument::ClearInternal()
{
m_Doc.Clear();
}

void ParseFile(LPCSTR path, CMemoryWriter& W, IReader *F, CXml* xml )
void ParseFile(LPCSTR path, CMemoryWriter& W, IReader *F, XMLDocument* xml )
{
string4096 str;

Expand Down Expand Up @@ -56,7 +56,7 @@ void ParseFile(LPCSTR path, CMemoryWriter& W, IReader *F, CXml* xml )
}
}

void CXml::Load(LPCSTR path_alias, LPCSTR path, LPCSTR _xml_filename)
void XMLDocument::Load(LPCSTR path_alias, LPCSTR path, LPCSTR _xml_filename)
{
shared_str fn = correct_file_name(path, _xml_filename);

Expand All @@ -66,7 +66,7 @@ void CXml::Load(LPCSTR path_alias, LPCSTR path, LPCSTR _xml_filename)
}

//èíèöèàëèçàöèÿ è çàãðóçêà XML ôàéëà
void CXml::Load(LPCSTR path, LPCSTR xml_filename)
void XMLDocument::Load(LPCSTR path, LPCSTR xml_filename)
{
xr_strcpy (m_xml_file_name, xml_filename);
// Load and parse xml file
Expand All @@ -90,7 +90,7 @@ void CXml::Load(LPCSTR path, LPCSTR xml_filename)
m_root = m_Doc.FirstChildElement();
}

XML_NODE* CXml::NavigateToNode(XML_NODE* start_node, LPCSTR path, int node_index)
XML_NODE* XMLDocument::NavigateToNode(XML_NODE* start_node, LPCSTR path, int node_index)
{
R_ASSERT3 (start_node && path, "NavigateToNode failed in XML file ",m_xml_file_name);
XML_NODE* node = NULL;
Expand Down Expand Up @@ -134,12 +134,12 @@ XML_NODE* CXml::NavigateToNode(XML_NODE* start_node, LPCSTR path, int node_inde
return node;
}

XML_NODE* CXml::NavigateToNode(LPCSTR path, int node_index)
XML_NODE* XMLDocument::NavigateToNode(LPCSTR path, int node_index)
{
return NavigateToNode(GetLocalRoot()?GetLocalRoot():GetRoot(), path, node_index);
}

XML_NODE* CXml::NavigateToNodeWithAttribute(LPCSTR tag_name, LPCSTR attrib_name, LPCSTR attrib_value)
XML_NODE* XMLDocument::NavigateToNodeWithAttribute(LPCSTR tag_name, LPCSTR attrib_name, LPCSTR attrib_value)
{

XML_NODE *root = GetLocalRoot() ? GetLocalRoot() : GetRoot();
Expand All @@ -157,22 +157,22 @@ XML_NODE* CXml::NavigateToNodeWithAttribute(LPCSTR tag_name, LPCSTR attrib_name,
}


LPCSTR CXml::Read(LPCSTR path, int index, LPCSTR default_str_val)
LPCSTR XMLDocument::Read(LPCSTR path, int index, LPCSTR default_str_val)
{
XML_NODE* node = NavigateToNode(path, index);
LPCSTR result = Read(node, default_str_val);
return result;
}

LPCSTR CXml::Read(XML_NODE* start_node, LPCSTR path, int index, LPCSTR default_str_val)
LPCSTR XMLDocument::Read(XML_NODE* start_node, LPCSTR path, int index, LPCSTR default_str_val)
{
XML_NODE* node = NavigateToNode(start_node, path, index);
LPCSTR result = Read(node, default_str_val);
return result;
}


LPCSTR CXml::Read(XML_NODE* node, LPCSTR default_str_val)
LPCSTR XMLDocument::Read(XML_NODE* node, LPCSTR default_str_val)
{
if(node == NULL)
return default_str_val;
Expand All @@ -188,7 +188,7 @@ LPCSTR CXml::Read(XML_NODE* node, LPCSTR default_str_val)
}
}

int CXml::ReadInt(XML_NODE* node, int default_int_val)
int XMLDocument::ReadInt(XML_NODE* node, int default_int_val)
{
LPCSTR result_str = Read(node, NULL );

Expand All @@ -198,7 +198,7 @@ int CXml::ReadInt(XML_NODE* node, int default_int_val)
return atoi (result_str);
}

int CXml::ReadInt(LPCSTR path, int index, int default_int_val)
int XMLDocument::ReadInt(LPCSTR path, int index, int default_int_val)
{
LPCSTR result_str = Read(path, index, NULL );
if(result_str==NULL)
Expand All @@ -207,7 +207,7 @@ int CXml::ReadInt(LPCSTR path, int index, int default_int_val)
return atoi (result_str);
}

int CXml::ReadInt(XML_NODE* start_node, LPCSTR path, int index, int default_int_val)
int XMLDocument::ReadInt(XML_NODE* start_node, LPCSTR path, int index, int default_int_val)
{
LPCSTR result_str = Read(start_node, path, index, NULL );
if(result_str==NULL)
Expand All @@ -216,7 +216,7 @@ int CXml::ReadInt(XML_NODE* start_node, LPCSTR path, int index, int default_int_
return atoi (result_str);
}

float CXml::ReadFlt(LPCSTR path, int index, float default_flt_val)
float XMLDocument::ReadFlt(LPCSTR path, int index, float default_flt_val)
{
LPCSTR result_str = Read(path, index, NULL );
if(result_str==NULL)
Expand All @@ -225,7 +225,7 @@ float CXml::ReadFlt(LPCSTR path, int index, float default_flt_val)
return (float)atof (result_str);
}

float CXml::ReadFlt(XML_NODE* start_node, LPCSTR path, int index, float default_flt_val)
float XMLDocument::ReadFlt(XML_NODE* start_node, LPCSTR path, int index, float default_flt_val)
{
LPCSTR result_str = Read(start_node, path, index, NULL );
if(result_str==NULL)
Expand All @@ -234,7 +234,7 @@ float CXml::ReadFlt(XML_NODE* start_node, LPCSTR path, int index, float defa
return (float)atof (result_str);
}

float CXml::ReadFlt(XML_NODE* node, float default_flt_val)
float XMLDocument::ReadFlt(XML_NODE* node, float default_flt_val)
{
LPCSTR result_str = Read(node, NULL );

Expand All @@ -244,7 +244,7 @@ float CXml::ReadFlt(XML_NODE* node, float default_flt_val)
return (float)atof (result_str);
}

LPCSTR CXml::ReadAttrib(XML_NODE* start_node, LPCSTR path, int index,
LPCSTR XMLDocument::ReadAttrib(XML_NODE* start_node, LPCSTR path, int index,
LPCSTR attrib, LPCSTR default_str_val)
{
XML_NODE* node = NavigateToNode(start_node, path, index);
Expand All @@ -254,15 +254,15 @@ LPCSTR CXml::ReadAttrib(XML_NODE* start_node, LPCSTR path, int index,
}


LPCSTR CXml::ReadAttrib(LPCSTR path, int index,
LPCSTR XMLDocument::ReadAttrib(LPCSTR path, int index,
LPCSTR attrib, LPCSTR default_str_val)
{
XML_NODE* node = NavigateToNode(path, index);
LPCSTR result = ReadAttrib(node, attrib, default_str_val);
return result;
}

LPCSTR CXml::ReadAttrib(XML_NODE* node, LPCSTR attrib, LPCSTR default_str_val)
LPCSTR XMLDocument::ReadAttrib(XML_NODE* node, LPCSTR attrib, LPCSTR default_str_val)
{
if(node == NULL)
return default_str_val;
Expand Down Expand Up @@ -294,7 +294,7 @@ LPCSTR CXml::ReadAttrib(XML_NODE* node, LPCSTR attrib, LPCSTR default_str_val)
}


int CXml::ReadAttribInt(XML_NODE* node, LPCSTR attrib, int default_int_val)
int XMLDocument::ReadAttribInt(XML_NODE* node, LPCSTR attrib, int default_int_val)
{
LPCSTR result_str = ReadAttrib(node, attrib, NULL);

Expand All @@ -304,7 +304,7 @@ int CXml::ReadAttribInt(XML_NODE* node, LPCSTR attrib, int default_int_val)
return atoi (result_str);
}

int CXml::ReadAttribInt(LPCSTR path, int index, LPCSTR attrib, int default_int_val)
int XMLDocument::ReadAttribInt(LPCSTR path, int index, LPCSTR attrib, int default_int_val)
{
LPCSTR result_str = ReadAttrib(path, index, attrib, NULL);

Expand All @@ -315,7 +315,7 @@ int CXml::ReadAttribInt(LPCSTR path, int index, LPCSTR attrib, int default_int_v
}


int CXml::ReadAttribInt(XML_NODE* start_node, LPCSTR path, int index, LPCSTR attrib, int default_int_val)
int XMLDocument::ReadAttribInt(XML_NODE* start_node, LPCSTR path, int index, LPCSTR attrib, int default_int_val)
{
LPCSTR result_str = ReadAttrib(start_node, path, index, attrib, NULL);

Expand All @@ -324,7 +324,7 @@ int CXml::ReadAttribInt(XML_NODE* start_node, LPCSTR path, int index, LPCSTR att
return atoi (result_str);
}

float CXml::ReadAttribFlt(LPCSTR path, int index, LPCSTR attrib, float default_flt_val)
float XMLDocument::ReadAttribFlt(LPCSTR path, int index, LPCSTR attrib, float default_flt_val)
{
LPCSTR result_str = ReadAttrib(path, index, attrib, NULL);

Expand All @@ -334,7 +334,7 @@ float CXml::ReadAttribFlt(LPCSTR path, int index, LPCSTR attrib, float defaul
return (float)atof (result_str);
}

float CXml::ReadAttribFlt(XML_NODE* start_node, LPCSTR path, int index, LPCSTR attrib, float default_flt_val)
float XMLDocument::ReadAttribFlt(XML_NODE* start_node, LPCSTR path, int index, LPCSTR attrib, float default_flt_val)
{
LPCSTR result_str = ReadAttrib(start_node, path, index, attrib, NULL);

Expand All @@ -344,7 +344,7 @@ float CXml::ReadAttribFlt(XML_NODE* start_node, LPCSTR path, int index, LPCST
return (float)atof (result_str);
}

float CXml::ReadAttribFlt(XML_NODE* node, LPCSTR attrib, float default_flt_val)
float XMLDocument::ReadAttribFlt(XML_NODE* node, LPCSTR attrib, float default_flt_val)
{
LPCSTR result_str = ReadAttrib(node, attrib, NULL);

Expand All @@ -354,7 +354,7 @@ float CXml::ReadAttribFlt(XML_NODE* node, LPCSTR attrib, float default_flt_val
return (float)atof (result_str);
}

int CXml::GetNodesNum(LPCSTR path, int index, LPCSTR tag_name)
int XMLDocument::GetNodesNum(LPCSTR path, int index, LPCSTR tag_name)
{
XML_NODE* node = NULL;

Expand All @@ -374,7 +374,7 @@ int CXml::GetNodesNum(LPCSTR path, int index, LPCSTR tag_name)
return GetNodesNum (node, tag_name);
}

int CXml::GetNodesNum(XML_NODE* node, LPCSTR tag_name)
int XMLDocument::GetNodesNum(XML_NODE* node, LPCSTR tag_name)
{
if(node == NULL) return 0;

Expand All @@ -400,14 +400,14 @@ int CXml::GetNodesNum(XML_NODE* node, LPCSTR tag_name)
}

//íàõîæäåíèå ýëåìíåòà ïî åãî àòðèáóòó
XML_NODE* CXml::SearchForAttribute(LPCSTR path, int index, LPCSTR tag_name, LPCSTR attrib, LPCSTR attrib_value_pattern)
XML_NODE* XMLDocument::SearchForAttribute(LPCSTR path, int index, LPCSTR tag_name, LPCSTR attrib, LPCSTR attrib_value_pattern)
{
XML_NODE* start_node = NavigateToNode(path, index);
XML_NODE* result = SearchForAttribute(start_node, tag_name, attrib, attrib_value_pattern);
return result;
}

XML_NODE* CXml::SearchForAttribute(XML_NODE* start_node, LPCSTR tag_name, LPCSTR attrib, LPCSTR attrib_value_pattern)
XML_NODE* XMLDocument::SearchForAttribute(XML_NODE* start_node, LPCSTR tag_name, LPCSTR attrib, LPCSTR attrib_value_pattern)
{
while (start_node)
{
Expand Down Expand Up @@ -436,7 +436,7 @@ XML_NODE* CXml::SearchForAttribute(XML_NODE* start_node, LPCSTR tag_name, LPCSTR

#ifdef DEBUG // debug & mixed

LPCSTR CXml::CheckUniqueAttrib (XML_NODE* start_node, LPCSTR tag_name, LPCSTR attrib_name)
LPCSTR XMLDocument::CheckUniqueAttrib (XML_NODE* start_node, LPCSTR tag_name, LPCSTR attrib_name)
{
m_AttribValues.clear_not_free ();

Expand Down
10 changes: 5 additions & 5 deletions src/xrCore/XML/xrXMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const LPCSTR UI_PATH = "ui";
typedef TiXmlNode XML_NODE;
typedef TiXmlAttribute XML_ATTRIBUTE;

class XRCORE_API CXml
class XRCORE_API XMLDocument
{
void Load (LPCSTR path_alias, LPCSTR xml_filename);
public:
string_path m_xml_file_name;
CXml ();
virtual ~CXml ();
XMLDocument ();
virtual ~XMLDocument ();
void ClearInternal ();

void Load (LPCSTR path_alias, LPCSTR path, LPCSTR xml_filename);
Expand Down Expand Up @@ -89,8 +89,8 @@ class XRCORE_API CXml
public:
virtual shared_str correct_file_name (LPCSTR path, LPCSTR fn) {return fn;}
private:
CXml (const CXml& copy);
void operator= ( const CXml& copy );
XMLDocument (const XMLDocument& copy);
void operator= ( const XMLDocument& copy );

typedef TiXmlElement XML_ELEM;
TiXmlDocument m_Doc;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ui/xrUIXmlParser.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "xrCore/XML/xrXMLParser.h"

class CUIXml : public CXml
class CUIXml : public XMLDocument
{
int m_dbg_id;
public:
Expand Down

0 comments on commit b56d7af

Please sign in to comment.