Decouple <cstddef>
This commit is contained in:
+23
-21
@@ -8,6 +8,8 @@
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "LuaManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, RageFileBasic &f )
|
||||
{
|
||||
RString sError;
|
||||
@@ -68,7 +70,7 @@ static void InitEntities()
|
||||
{ '\"', "quot", },
|
||||
{ '\'', "apos", },
|
||||
{ '<', "lt", },
|
||||
{ '>', "gt", }
|
||||
{ '>', "gt", }
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < ARRAYLEN(EntityTable); ++i )
|
||||
@@ -126,10 +128,10 @@ RString::size_type LoadAttributes( XNode *pNode, const RString &xml, RString &sE
|
||||
|
||||
// XML Attr Name
|
||||
RString::size_type iEnd = xml.find_first_of( " =", iOffset );
|
||||
if( iEnd == xml.npos )
|
||||
if( iEnd == xml.npos )
|
||||
{
|
||||
// error
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = ssprintf( "<%s> attribute has error ", pNode->GetName().c_str() );
|
||||
return std::string::npos;
|
||||
}
|
||||
@@ -170,10 +172,10 @@ RString::size_type LoadAttributes( XNode *pNode, const RString &xml, RString &sE
|
||||
iEnd = xml.find_first_of( " >", iOffset );
|
||||
}
|
||||
|
||||
if( iEnd == xml.npos )
|
||||
if( iEnd == xml.npos )
|
||||
{
|
||||
// error
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = ssprintf( "<%s> attribute text: couldn't find matching quote", sName.c_str() );
|
||||
return std::string::npos;
|
||||
}
|
||||
@@ -224,7 +226,7 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
RString::size_type iEnd = xml.find( "-->", iOffset );
|
||||
if( iEnd == std::string::npos )
|
||||
{
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = "Unterminated comment";
|
||||
|
||||
return std::string::npos;
|
||||
@@ -249,7 +251,7 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
if( iOffset == std::string::npos )
|
||||
return std::string::npos;
|
||||
|
||||
// alone tag <TAG ... /> or <?TAG ... ?> or <!-- ... -->
|
||||
// alone tag <TAG ... /> or <?TAG ... ?> or <!-- ... -->
|
||||
// current pointer: ^ ^ ^
|
||||
|
||||
if( iOffset < xml.size() && (xml[iOffset] == chXMLTagPre || xml[iOffset] == chXMLQuestion || xml[iOffset] == chXMLDash) )
|
||||
@@ -263,7 +265,7 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
if( iOffset == xml.size() || xml[iOffset] != chXMLTagClose )
|
||||
{
|
||||
// error: <TAG ... / >
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = "Element must be closed.";
|
||||
|
||||
// ill-formed tag
|
||||
@@ -273,8 +275,8 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
// well-formed tag
|
||||
++iOffset;
|
||||
|
||||
// UGLY: We want to ignore all XML meta tags. So, since the Node we
|
||||
// just loaded is a meta tag, then Load ourself again using the rest
|
||||
// UGLY: We want to ignore all XML meta tags. So, since the Node we
|
||||
// just loaded is a meta tag, then Load ourself again using the rest
|
||||
// of the file until we reach a non-meta tag.
|
||||
if( !pNode->GetName().empty() && (pNode->GetName()[0] == chXMLQuestion || pNode->GetName()[0] == chXMLExclamation) )
|
||||
iOffset = LoadInternal( pNode, xml, sErrorOut, iOffset );
|
||||
@@ -286,12 +288,12 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
// ^- current pointer
|
||||
if( pNode->GetAttr(XNode::TEXT_ATTRIBUTE) == nullptr )
|
||||
{
|
||||
// Text Value
|
||||
// Text Value
|
||||
++iOffset;
|
||||
RString::size_type iEnd = xml.find( chXMLTagOpen, iOffset );
|
||||
if( iEnd == std::string::npos )
|
||||
{
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = ssprintf( "%s must be closed with </%s>", pNode->GetName().c_str(), pNode->GetName().c_str() );
|
||||
// error cos not exist CloseTag </TAG>
|
||||
return std::string::npos;
|
||||
@@ -342,7 +344,7 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
RString::size_type iEnd = xml.find_first_of( " >", iOffset );
|
||||
if( iEnd == std::string::npos )
|
||||
{
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = ssprintf( "it must be closed with </%s>", pNode->GetName().c_str() );
|
||||
// error
|
||||
return std::string::npos;
|
||||
@@ -360,7 +362,7 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
else
|
||||
{
|
||||
// not welformed open/close
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = ssprintf( "'<%s> ... </%s>' is not well-formed.", pNode->GetName().c_str(), closename.c_str() );
|
||||
return std::string::npos;
|
||||
}
|
||||
@@ -369,12 +371,12 @@ RString::size_type LoadInternal( XNode *pNode, const RString &xml, RString &sErr
|
||||
{
|
||||
if( pNode->GetAttr(XNode::TEXT_ATTRIBUTE) == nullptr && iOffset < xml.size() && xml[iOffset] != chXMLTagOpen )
|
||||
{
|
||||
// Text Value
|
||||
// Text Value
|
||||
RString::size_type iEnd = xml.find( chXMLTagOpen, iOffset );
|
||||
if( iEnd == std::string::npos )
|
||||
{
|
||||
// error cos not exist CloseTag </TAG>
|
||||
if( sErrorOut.empty() )
|
||||
if( sErrorOut.empty() )
|
||||
sErrorOut = ssprintf( "it must be closed with </%s>", pNode->GetName().c_str() );
|
||||
return std::string::npos;
|
||||
}
|
||||
@@ -405,7 +407,7 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
|
||||
WRITE( "<" );
|
||||
WRITE( pNode->GetName() );
|
||||
|
||||
// <TAG Attr1="Val1"
|
||||
// <TAG Attr1="Val1"
|
||||
FOREACH_CONST_Attr( pNode, p )
|
||||
{
|
||||
if( p->first == XNode::TEXT_ATTRIBUTE )
|
||||
@@ -421,7 +423,7 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
|
||||
|
||||
if( pNode->ChildrenEmpty() && pNode->GetAttr(XNode::TEXT_ATTRIBUTE) == nullptr )
|
||||
{
|
||||
// <TAG Attr1="Val1"/> alone tag
|
||||
// <TAG Attr1="Val1"/> alone tag
|
||||
WRITE( "/>" );
|
||||
}
|
||||
else
|
||||
@@ -710,7 +712,7 @@ namespace
|
||||
lua_pop( L, 1 );
|
||||
|
||||
// Recursively process tables.
|
||||
for( size_t i = 0; i < NodesToAdd.size(); ++i )
|
||||
for( std::size_t i = 0; i < NodesToAdd.size(); ++i )
|
||||
{
|
||||
const RString &sNodeName = NodeNamesToAdd[i];
|
||||
LuaReference &NodeToAdd = NodesToAdd[i];
|
||||
@@ -817,7 +819,7 @@ void XmlFileUtil::MergeIniUnder( XNode *pFrom, XNode *pTo )
|
||||
/*
|
||||
* (c) 2001-2006 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -827,7 +829,7 @@ void XmlFileUtil::MergeIniUnder( XNode *pFrom, XNode *pTo )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
Reference in New Issue
Block a user