/*
real GTextUtils::CPPStringToReal(const cppstring &sNumber)
{
	real fResult;
	GTextUtils::IsStringRealNumber(sNumber, &fResult);	// just return the result
	return fResult;
}
real GTextUtils::StringToReal(const narrowstring &sNumber)
{// not as robust as CPPStringToReal but does not need to be
	real fValue;
	std::stringstream ss;
	ss << sNumber;
	ss >> fValue;
	return fValue;
}
*/
int GTextUtils::CPPStringToLong(const cppstring &sInteger)
{
	int nResult = 0L;
	if (GTextUtils::IsStringLong(sInteger))
		nResult = GTextUtils::Gstrtol(sInteger.c_str(), NULL, 10);
	return nResult;
}
void GUtils::Trace(cppstring msg,
				   gchar * psFile,
				   int nLine)
{
	int nLen = 0;
	if (psFile != NULL)
	{
#ifdef _UNICODE
		nLen = wcslen(psFile);
#else
		nLen = strlen(psFile);
#endif
	}
	if ((nLen > 0) && 
		(nLine != -1)	)
	{ // Only print File and Line if we have something..
		cppsstream ss;
		ss << psFile << GSTD_S("(") << nLine << GSTD_S(") : ") << msg << kOSNewlineString;
		OSTrace(ss.str().c_str());
	}
	else
	 	OSTrace(msg.c_str());

	GSTD_LOG(msg);
}
std::string	GTextUtils::ConvertWideStringToNarrow(const cppstring  sWide)
{
#ifdef USE_WIDE_CHARS
	char * pMultiByteBuf;
	pMultiByteBuf   = (char *)malloc( sWide.length()*2 );
	size_t i = wcstombs( pMultiByteBuf, sWide.c_str(), sWide.length()*2 );
	std::string sNarrow (pMultiByteBuf);
	delete pMultiByteBuf;
#else
	std::string sNarrow(sWide); // since cppstring is already narrow there is nothing to do
#endif 
	return sNarrow;
}