//////////////////////////////////////////////////////////////////////
//
// XMLParser.inl
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000 Robert Cunnings. All rights reserved.
//
// You may copy, modify, distribute or publish this code free of charge.
//
// NO WARRANTY: This software is provided AS IS, without warranty of any kind.
//
//////////////////////////////////////////////////////////////////////
//
// Inline functions for XMLParser class
//
// Note: these routines for Win32 platforms only
//
//////////////////////////////////////////////////////////////////////

inline bool IsWhiteSpace(wchar_t c)
{
	return (iswspace(wint_t(c)) != 0);
}

inline bool IsAlpha(wchar_t c)
{
	return (iswalpha(wint_t(c)) != 0);
}

inline bool IsDigit(wchar_t c)
{
	return (iswdigit(wint_t(c)) != 0);
}

inline bool IsHexDigit(wchar_t c)
{
	return (iswxdigit(wint_t(c)) != 0);
}

inline int DecDigitValue(wchar_t c)
{
	wchar_t wszBuffer[2];
	wszBuffer[0] = c;
	wszBuffer[1] = 0;
	return _wtoi(wszBuffer);
}

inline int HexDigitValue(wchar_t c)
{
	wchar_t wszBuffer[2];
	wszBuffer[0] = c;
	wszBuffer[1] = 0;
	int nNbr = 0;
	swscanf(wszBuffer, L"%x", &nNbr);
	return nNbr;
}

inline bool IsAlphaDigit(wchar_t c)
{
	return (iswalpha(wint_t(c)) || iswdigit(wint_t(c)));
}

inline bool IsAlphaDigitEx(wchar_t c)
{
    return(IsAlphaDigit(c) || c == wchar_t('_') || c == wchar_t('.') || c == wchar_t(':') || c == wchar_t('-'));
}

inline bool IsXMLCharacter(wchar_t c)
{
	if (iswcntrl(wint_t(c)) == false)
		return true;
	if (c == wchar_t('\r') || c == wchar_t('\n') || c == wchar_t('\t'))
		return true;
	return false;
}
