[mapguide-commits] r8453 - trunk/MgDev/Common/CoordinateSystem
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Nov 20 17:05:28 PST 2014
Author: hubu
Date: 2014-11-20 17:05:28 -0800 (Thu, 20 Nov 2014)
New Revision: 8453
Modified:
trunk/MgDev/Common/CoordinateSystem/ArbitraryCoordsys.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysCategory.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysDatum.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysDatumDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoid.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysEnum.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCategory.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysFormatConverter.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysGridGeneric.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysProjectionInformation.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysTransform.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysUnitInformation.cpp
trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h
trunk/MgDev/Common/CoordinateSystem/MentorDictionary.cpp
trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h
trunk/MgDev/Common/CoordinateSystem/MentorUtil.cpp
Log:
#2508 http://trac.osgeo.org/mapguide/ticket/2508, submit on behalf of Andreas Steffen.
CsMap dictionary string encoding changed to UTF-8
CsMap changed the encoding from local code page to UTF-8 for a char pointer or string. See http://trac.osgeo.org/csmap/ticket/182
As consumer of CsMap this encoding change need to be handled according. It mainly has an impact when converting characters to wide characters.
Therefore I have added new methods Convert_UTF8_To_Wide and Convert_Wide_To_UTF8 which are replacing the ones used to convert from and to the locale code page (Convert_Ascii_To_Wide & Convert_Wide_To_Ascii). Internally the new conversion methods are using MgUtil::MultiByteToWideChar and MgUtil::WideCharToMultiByte.
In some rare places I have keep to use the Ascii conversion because CsMap still needs the file paths in the local code page encoding.
Modified: trunk/MgDev/Common/CoordinateSystem/ArbitraryCoordsys.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/ArbitraryCoordsys.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/ArbitraryCoordsys.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -18,7 +18,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii, CsDictionaryOpenMode
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8, CsDictionaryOpenMode
#include "ArbitraryCoordsys.h"
#include "MentorUtil.h" //for BuildCsprmFromArbitraryDef
@@ -165,7 +165,7 @@
{
if(wszWktCoordinateSystem)
{
- char* tempSrsWkt = Convert_Wide_To_Ascii(wszWktCoordinateSystem);
+ char* tempSrsWkt = Convert_Wide_To_UTF8(wszWktCoordinateSystem);
string srsWkt = tempSrsWkt;
delete [] tempSrsWkt;
tempSrsWkt = NULL;
@@ -187,7 +187,7 @@
{
return false;
}
- char* tempSrsWkt = Convert_Wide_To_Ascii(wszCoordSys);
+ char* tempSrsWkt = Convert_Wide_To_UTF8(wszCoordSys);
string srsWkt = tempSrsWkt;
delete [] tempSrsWkt;
tempSrsWkt = NULL;
@@ -280,7 +280,7 @@
string sUnitWkt = vComponents.at(0);
if(sUnitWkt.length() > 0)
{
- wchar_t* wsUnits = Convert_Ascii_To_Wide(sUnitWkt.c_str());
+ wchar_t* wsUnits = Convert_UTF8_To_Wide(sUnitWkt.c_str());
//-- ensure the scale is valid
string sScale = vComponents.at(1);
@@ -301,8 +301,8 @@
{
if(_wcsicmp(wsUnits, CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].unitsCode) == 0)
{
- char* tempname = Convert_Wide_To_Ascii(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].code);
- char* tempunit = Convert_Wide_To_Ascii(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].unitsCode);
+ char* tempname = Convert_Wide_To_UTF8(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].code);
+ char* tempunit = Convert_Wide_To_UTF8(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].unitsCode);
CS_stncp(csdef.key_nm, tempname, sizeof (csdef.key_nm));
CS_stncp(csdef.unit, tempunit, sizeof (csdef.unit));
delete [] tempname;
@@ -321,8 +321,8 @@
{
if (bResult && fabs (CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].conversionToMeters - csdef.unit_scl) < 5.0E-8)
{
- char* tempname = Convert_Wide_To_Ascii(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].code);
- char* tempunit = Convert_Wide_To_Ascii(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].unitsCode);
+ char* tempname = Convert_Wide_To_UTF8(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].code);
+ char* tempunit = Convert_Wide_To_UTF8(CCsArbitraryCoordinateSystemUtil::ArbitraryXYCoordinateSystems[i].unitsCode);
CS_stncp(csdef.key_nm, tempname, sizeof (csdef.key_nm));
CS_stncp(csdef.unit, tempunit, sizeof (csdef.unit));
delete [] tempname;
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -17,7 +17,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "CriticalSection.h"
#include "CoordSys.h" //for CCoordinateSystem
@@ -136,7 +136,7 @@
bool bGeodetic=CsdefIsGeodetic(csdef);
if (bGeodetic)
{
- wchar_t* pwszDtName = Convert_Ascii_To_Wide(csdef.dat_knm);
+ wchar_t* pwszDtName = Convert_UTF8_To_Wide(csdef.dat_knm);
STRING sDtName(::ToLower(pwszDtName));
delete[] pwszDtName;
@@ -180,7 +180,7 @@
} //if it's geodetic
else
{
- wchar_t* pwszElName = Convert_Ascii_To_Wide(csdef.elp_knm);
+ wchar_t* pwszElName = Convert_UTF8_To_Wide(csdef.elp_knm);
STRING sElName(::ToLower(pwszElName));
delete[] pwszElName;
pwszElName = NULL;
@@ -818,7 +818,7 @@
/// </summary>
STRING CCoordinateSystem::GetUnits()
{
- wchar_t* pUnit = Convert_Ascii_To_Wide(m_csprm.csdef.unit);
+ wchar_t* pUnit = Convert_UTF8_To_Wide(m_csprm.csdef.unit);
if (NULL == pUnit)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetUnits", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -984,7 +984,7 @@
STRING sName;
MG_TRY()
- wchar_t* pName = Convert_Ascii_To_Wide(m_csprm.csdef.key_nm);
+ wchar_t* pName = Convert_UTF8_To_Wide(m_csprm.csdef.key_nm);
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1018,7 +1018,7 @@
}
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sCode.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sCode.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1064,7 +1064,7 @@
MG_TRY()
- wchar_t* pProjection = Convert_Ascii_To_Wide(m_csprm.csdef.prj_knm);
+ wchar_t* pProjection = Convert_UTF8_To_Wide(m_csprm.csdef.prj_knm);
if (NULL == pProjection)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetProjection", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1210,7 +1210,7 @@
return L"";
}
- wchar_t* pDatum = Convert_Ascii_To_Wide(m_csprm.csdef.dat_knm);
+ wchar_t* pDatum = Convert_UTF8_To_Wide(m_csprm.csdef.dat_knm);
if (NULL == pDatum)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1272,7 +1272,7 @@
return L"";
}
- wchar_t* pEllipsoid = Convert_Ascii_To_Wide(m_csprm.csdef.elp_knm);
+ wchar_t* pEllipsoid = Convert_UTF8_To_Wide(m_csprm.csdef.elp_knm);
if (NULL == pEllipsoid)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1546,7 +1546,7 @@
}
//Build a wchar_t* from the datum name
- wchar_t* pStrDt = Convert_Ascii_To_Wide(m_csprm.csdef.dat_knm);
+ wchar_t* pStrDt = Convert_UTF8_To_Wide(m_csprm.csdef.dat_knm);
if (NULL == pStrDt)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1570,7 +1570,7 @@
}
//Build a wchar_t* from the ellipsoid name
- wchar_t* pStrEl = Convert_Ascii_To_Wide(m_csprm.csdef.elp_knm);
+ wchar_t* pStrEl = Convert_UTF8_To_Wide(m_csprm.csdef.elp_knm);
if (NULL == pStrEl)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1769,7 +1769,7 @@
STRING sDesc;
MG_TRY()
- wchar_t* pDesc = Convert_Ascii_To_Wide(m_csprm.csdef.desc_nm);
+ wchar_t* pDesc = Convert_UTF8_To_Wide(m_csprm.csdef.desc_nm);
if (NULL == pDesc)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1809,7 +1809,7 @@
MG_TRY()
- wchar_t* pGroup = Convert_Ascii_To_Wide(m_csprm.csdef.group);
+ wchar_t* pGroup = Convert_UTF8_To_Wide(m_csprm.csdef.group);
if (NULL == pGroup)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1847,7 +1847,7 @@
MG_TRY()
- wchar_t* pSource = Convert_Ascii_To_Wide(m_csprm.csdef.source);
+ wchar_t* pSource = Convert_UTF8_To_Wide(m_csprm.csdef.source);
if (NULL == pSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1929,7 +1929,7 @@
MG_TRY()
- wchar_t* pLoc = Convert_Ascii_To_Wide(m_csprm.csdef.locatn);
+ wchar_t* pLoc = Convert_UTF8_To_Wide(m_csprm.csdef.locatn);
if (NULL == pLoc)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetLocation", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1969,7 +1969,7 @@
MG_TRY()
- wchar_t* pCntrySt = Convert_Ascii_To_Wide(m_csprm.csdef.cntry_st);
+ wchar_t* pCntrySt = Convert_UTF8_To_Wide(m_csprm.csdef.cntry_st);
if (NULL == pCntrySt)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetCountryOrState", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -2550,7 +2550,7 @@
{
throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
}
- char *pStr = Convert_Wide_To_Ascii(sDatum.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sDatum.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -2579,7 +2579,7 @@
{
throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
}
- char *pStr = Convert_Wide_To_Ascii(sEllipsoid.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sEllipsoid.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -3097,7 +3097,7 @@
}
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sSrc.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysCategory.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysCategory.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysCategory.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -22,7 +22,7 @@
#include "CoordSysCategory.h" //for CCoordinateSystemCategory
#include "CoordSysEnumCoordinateSystemInCategory.h" //for CCoordinateSystemEnumCoordinateSystemInCategory
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for IsLegalMentorName
#include <algorithm> //for std::find
@@ -141,7 +141,7 @@
MG_TRY()
- pszwName = Convert_Ascii_To_Wide(this->mp_ctDef->ctName);
+ pszwName = Convert_UTF8_To_Wide(this->mp_ctDef->ctName);
categoryName = pszwName;
MG_CATCH(L"MgCoordinateSystemCategory.GetName");
@@ -168,7 +168,7 @@
throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.SetName", __LINE__, __WFILE__, NULL, L"", NULL);
}
- pszNewName = Convert_Wide_To_Ascii(sName.c_str());
+ pszNewName = Convert_Wide_To_UTF8(sName.c_str());
CS_stncp(this->mp_ctDef->ctName, pszNewName, cs_CATDEF_CATNMSZ);
MG_CATCH(L"MgCoordinateSystemCategory.SetName")
@@ -351,7 +351,7 @@
{
for(ulong32_t i = 0; i < this->mp_ctDef->nameCnt; ++i)
{
- wchar_t *pszwCsName = Convert_Ascii_To_Wide(this->mp_ctDef->csNames[i].csName);
+ wchar_t *pszwCsName = Convert_UTF8_To_Wide(this->mp_ctDef->csNames[i].csName);
this->m_listCoordinateSystemNames.push_back(pszwCsName);
delete[] pszwCsName;
}
@@ -400,7 +400,7 @@
std::vector<STRING>& allCsNames = this->GetAllCsNames();
//Make sure it's a legal name
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -455,7 +455,7 @@
std::vector<STRING>& allCsNames = this->GetAllCsNames();
//Make sure it's a legal name
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
_ASSERT(NULL != pName); //would throw an exception otherwise
if (!IsLegalMentorName(pName))
@@ -503,7 +503,7 @@
MG_TRY()
//Make sure it's a legal name
- pName = Convert_Wide_To_Ascii(sName.c_str());
+ pName = Convert_Wide_To_UTF8(sName.c_str());
if (IsLegalMentorName(pName))
{
//Try to find it
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -20,7 +20,7 @@
#include "CriticalSection.h"
#include "CoordSysCategory.h" //for CCoordinateSystemCategory
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii, CsDictionaryOpenMode
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8, CsDictionaryOpenMode
#include "CoordSysCategoryDictionary.h" //for CCoordinateSystemCategoryDictionary
#include "CoordSysEnumCategory.h" //for CCoordinateSystemEnumCategory
@@ -345,7 +345,7 @@
MG_TRY()
//Look for it in our index
- pName = Convert_Wide_To_Ascii(sName.c_str());
+ pName = Convert_Wide_To_UTF8(sName.c_str());
CCategoryNameIndexMap::const_iterator iter = Index().find(CCategoryName(pName));
@@ -432,7 +432,7 @@
{
throw new MgInvalidArgumentException(L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, NULL, L"", NULL);
}
- pName = Convert_Wide_To_Ascii(str.c_str());
+ pName = Convert_Wide_To_UTF8(str.c_str());
CCategoryNameIndexMap::const_iterator iter = Index().find(CCategoryName(pName));
@@ -495,7 +495,7 @@
MG_TRY()
//Look for it in our index
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
CCategoryNameIndexMap::const_iterator iter = Index().find(CCategoryName(pName));
//Did we find it?
@@ -547,7 +547,7 @@
MG_TRY()
//Look in our index
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
SmartCriticalClass csmapLock;
@@ -605,7 +605,7 @@
MG_TRY()
//Make sure def with old name is present
- pOldName = Convert_Wide_To_Ascii(sOldName.c_str());
+ pOldName = Convert_Wide_To_UTF8(sOldName.c_str());
CCategoryName oldCategory(pOldName);
CCategoryNameIndexMap::iterator iter = Index().find(oldCategory);
@@ -626,7 +626,7 @@
throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
}
- pNewName = Convert_Wide_To_Ascii(sNewName.c_str());
+ pNewName = Convert_Wide_To_UTF8(sNewName.c_str());
if (CSrplCatNameEx(pOldName, pNewName))
throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysDatum.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysDatum.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysDatum.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -23,7 +23,7 @@
#include "CoordSysDatum.h" //for CCoordinateSystemDatum
#include "CoordSysGeodeticTransformation.h" //for CCoordinateSystemGeodeticTransformation
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for BuildDtDefFromInterface
using namespace CSLibrary;
@@ -149,7 +149,7 @@
}
//Get the ellipsoid name the datum uses
- wchar_t* pwszElName=Convert_Ascii_To_Wide(def.ell_knm);
+ wchar_t* pwszElName=Convert_UTF8_To_Wide(def.ell_knm);
if (!pwszElName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -221,7 +221,7 @@
STRING sCode;
MG_TRY()
- wchar_t* pName = Convert_Ascii_To_Wide(m_DtDef.key_nm);
+ wchar_t* pName = Convert_UTF8_To_Wide(m_DtDef.key_nm);
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -255,7 +255,7 @@
}
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sCode.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sCode.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -373,7 +373,7 @@
}
//Build a wchar_t* from the ellipsoid name
- wchar_t* pStrEl = Convert_Ascii_To_Wide(m_datum.ell_knm);
+ wchar_t* pStrEl = Convert_UTF8_To_Wide(m_datum.ell_knm);
if (NULL == pStrEl)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -503,7 +503,7 @@
STRING sDesc;
MG_TRY()
- wchar_t* pDesc = Convert_Ascii_To_Wide(m_datum.dt_name);
+ wchar_t* pDesc = Convert_UTF8_To_Wide(m_datum.dt_name);
if (NULL == pDesc)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -543,7 +543,7 @@
STRING sGroup;
MG_TRY()
- wchar_t *pGroup = Convert_Ascii_To_Wide(m_DtDef.group);
+ wchar_t *pGroup = Convert_UTF8_To_Wide(m_DtDef.group);
if (NULL == pGroup)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -579,7 +579,7 @@
STRING sSource;
MG_TRY()
- wchar_t *pSource = Convert_Ascii_To_Wide(m_DtDef.source);
+ wchar_t *pSource = Convert_UTF8_To_Wide(m_DtDef.source);
if (NULL == pSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -662,7 +662,7 @@
STRING sLoc;
MG_TRY()
- wchar_t* pLoc = Convert_Ascii_To_Wide(m_DtDef.locatn);
+ wchar_t* pLoc = Convert_UTF8_To_Wide(m_DtDef.locatn);
if (NULL == pLoc)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetLocation", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -699,7 +699,7 @@
STRING sCountryOrState;
MG_TRY()
- wchar_t *pCountryOrState = Convert_Ascii_To_Wide(m_DtDef.cntry_st);
+ wchar_t *pCountryOrState = Convert_UTF8_To_Wide(m_DtDef.cntry_st);
if (NULL == pCountryOrState)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetCountryOrState", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -737,7 +737,7 @@
STRING sEllipsoid;
MG_TRY()
- wchar_t* pEllipsoid = Convert_Ascii_To_Wide(m_DtDef.ell_knm);
+ wchar_t* pEllipsoid = Convert_UTF8_To_Wide(m_DtDef.ell_knm);
if (NULL == pEllipsoid)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -771,7 +771,7 @@
}
//Convert wchar_t* to C++ string
- char *pStr = Convert_Wide_To_Ascii(sEllipsoid.c_str()); //need to delete [] pStr
+ char *pStr = Convert_Wide_To_UTF8(sEllipsoid.c_str()); //need to delete [] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -857,7 +857,7 @@
}
//Convert wchar_t* to C++ string
- char *pStr = Convert_Wide_To_Ascii(sEllipsoid.c_str()); //need to delete [] pStr
+ char *pStr = Convert_Wide_To_UTF8(sEllipsoid.c_str()); //need to delete [] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -984,7 +984,7 @@
}
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sSrc.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysDatumDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysDatumDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysDatumDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -24,7 +24,7 @@
#include "CoordSysEnumDatum.h" //for CCoordinateSystemEnumDatum
#include "CoordSysDatumDictionary.h" //for CCoordinateSystemDatumDictionary
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for OpenDictionaryFile()
#include "MentorDictionary.h"
#include "cs_map.h"
@@ -535,7 +535,7 @@
MG_TRY()
//Get the name to search for
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
//Look in the dictionary
pDef = dtdef(pName);
@@ -599,7 +599,7 @@
MG_TRY()
//Get the name to search for
- char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ char *pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDatumDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -21,7 +21,7 @@
#include "CoordSys.h" //for CCoordinateSystem
#include "CoordSysEnum.h" //for CCoordinateSystemEnum
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii, CsDictionaryOpenMode
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8, CsDictionaryOpenMode
#include "CoordSysDictionary.h" //for CCoordinateSystemDictionary
#include "MentorUtil.h" //for OpenDictionaryFile()
#include "MentorDictionary.h" //for MentorDictionary
@@ -553,7 +553,7 @@
MG_TRY()
//Get the name to search for
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
if (NULL == pName)
{
@@ -630,7 +630,7 @@
MG_TRY()
//Get the name to search for
- char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ char *pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -228,7 +228,7 @@
char *pName = NULL;
//Get the name to search for
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
Ptr<T> pDefinition;
MG_TRY()
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoid.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoid.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoid.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -20,7 +20,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for IsLegalMentorName
#include "CoordSysEllipsoid.h" //for CCoordinateSystemEllipsoid
@@ -77,7 +77,7 @@
}
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sSrc.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -119,7 +119,7 @@
MG_TRY()
- wchar_t *pName = Convert_Ascii_To_Wide(m_def.key_nm);
+ wchar_t *pName = Convert_UTF8_To_Wide(m_def.key_nm);
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -150,7 +150,7 @@
}
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sCode.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sCode.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -328,7 +328,7 @@
STRING sDesc;
MG_TRY()
- wchar_t *pDesc = Convert_Ascii_To_Wide(m_def.name);
+ wchar_t *pDesc = Convert_UTF8_To_Wide(m_def.name);
if (NULL == pDesc)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -366,7 +366,7 @@
STRING sGroup;
MG_TRY()
- wchar_t *pGroup = Convert_Ascii_To_Wide(m_def.group);
+ wchar_t *pGroup = Convert_UTF8_To_Wide(m_def.group);
if (NULL == pGroup)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -403,7 +403,7 @@
STRING sSource;
MG_TRY()
- wchar_t *pSource = Convert_Ascii_To_Wide(m_def.source);
+ wchar_t *pSource = Convert_UTF8_To_Wide(m_def.source);
if (NULL == pSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -24,7 +24,7 @@
#include "CoordSysEnumEllipsoid.h" //for CCoordinateSystemEnumEllipsoid
#include "CoordSysEllipsoidDictionary.h" //for CCoordinateSystemEllipsoidDictionary
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for OpenDictionaryFile()
#include "MentorDictionary.h"
#include "cs_map.h"
@@ -471,7 +471,7 @@
MG_TRY()
//Get the name to search for
- pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
//Look in the dictionary
pDef = eldef(pName);
@@ -529,7 +529,7 @@
MG_TRY()
//Get the name to search for
- char *pName = Convert_Wide_To_Ascii(sName.c_str()); //need to delete [] pName
+ char *pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoidDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysEnum.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysEnum.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysEnum.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -19,7 +19,7 @@
#include "CoordSysCommon.h"
#include "CoordSysEnum.h" //for CCoordinateSystemEnum
-#include "CoordSysUtil.h" //for Convert_Ascii_To_Wide
+#include "CoordSysUtil.h" //for Convert_UTF8_To_Wide
#include "MentorUtil.h" //for IsLegalMentorName()
using namespace CSLibrary;
@@ -133,7 +133,7 @@
return pOutput.Detach();
}
const char *kpName = (*m_iter).first.Name();
- wchar_t* pStr = Convert_Ascii_To_Wide(kpName);
+ wchar_t* pStr = Convert_UTF8_To_Wide(kpName);
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -187,7 +187,7 @@
{
continue;
}
- wchar_t *pwName = Convert_Ascii_To_Wide(kpName);
+ wchar_t *pwName = Convert_UTF8_To_Wide(kpName);
if (NULL == pwName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -222,7 +222,7 @@
continue;
}
const char *kpDecsription = (*m_iter).second.Name();
- wchar_t *pwDecsription = Convert_Ascii_To_Wide(kpDecsription);
+ wchar_t *pwDecsription = Convert_UTF8_To_Wide(kpDecsription);
if (NULL == pwDecsription)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -300,7 +300,7 @@
}
//Get a def from the set for the Filter to work with
- wchar_t* pStr = Convert_Ascii_To_Wide(kpName);
+ wchar_t* pStr = Convert_UTF8_To_Wide(kpName);
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCategory.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCategory.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCategory.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -19,7 +19,7 @@
#include "CoordSysCommon.h"
#include "CoordSysEnumCategory.h" //for CCoordinateSystemEnumCategory
-#include "CoordSysUtil.h" //for Convert_Ascii_To_Wide
+#include "CoordSysUtil.h" //for Convert_UTF8_To_Wide
#include "MentorUtil.h" //for IsLegalMentorName()
using namespace CSLibrary;
@@ -103,7 +103,7 @@
}
//Get a def from the set for the filter to work with
- wchar_t* pStr = Convert_Ascii_To_Wide(kpName);
+ wchar_t* pStr = Convert_UTF8_To_Wide(kpName);
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -176,7 +176,7 @@
//get the category definition for the next name in the list
const char *kpName = (*(m_iter)).Name();
- pStr = Convert_Ascii_To_Wide(kpName);
+ pStr = Convert_UTF8_To_Wide(kpName);
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -234,7 +234,7 @@
continue;
}
- wchar_t *pwName = Convert_Ascii_To_Wide(kpName);
+ wchar_t *pwName = Convert_UTF8_To_Wide(kpName);
if (NULL == pwName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -21,7 +21,7 @@
#include "CoordSysCommon.h"
#include "CoordSysEnumCoordinateSystemInCategory.h" //for CCoordinateSystemEnumCoordinateSystemInCategory
-#include "CoordSysUtil.h" //for Convert_Ascii_To_Wide
+#include "CoordSysUtil.h" //for Convert_UTF8_To_Wide
#include "MentorUtil.h" //for IsLegalMentorName()
using namespace CSLibrary;
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysFormatConverter.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysFormatConverter.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysFormatConverter.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -84,7 +84,7 @@
SmartCriticalClass critical(true);
if (0==CScs2WktEx(csWktBufr,sizeof(csWktBufr),GetWktFlavor(nWktFlavor),pCsDef, pDtDef, pElDef,cs_WKTFLG_MAPNAMES))
{
- wchar_t* pwszWkt=Convert_Ascii_To_Wide(csWktBufr);
+ wchar_t* pwszWkt=Convert_UTF8_To_Wide(csWktBufr);
if (!pwszWkt)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -171,7 +171,7 @@
}
}
- pszWkt = Convert_Wide_To_Ascii(sWkt.c_str());
+ pszWkt = Convert_Wide_To_UTF8(sWkt.c_str());
if (NULL == pszWkt)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -280,18 +280,18 @@
//the system had been loaded from the dictionary file
//So, if one expects to have a description that matches the one in our dictionaries we need
//to updat it here
- wchar_t* pswCsName=Convert_Ascii_To_Wide(csDef.key_nm);
+ wchar_t* pswCsName=Convert_UTF8_To_Wide(csDef.key_nm);
wchar_t* pswDtName=NULL;
wchar_t* pswElName=NULL;
STRING sCsNameFromDict, sDtNameFromDict, sElNameFromDict;
if (dtDef.key_nm[0] != '\0')
{
- pswDtName=Convert_Ascii_To_Wide(dtDef.key_nm);
+ pswDtName=Convert_UTF8_To_Wide(dtDef.key_nm);
}
if (elDef.key_nm[0] != '\0')
{
- pswElName=Convert_Ascii_To_Wide(elDef.key_nm);
+ pswElName=Convert_UTF8_To_Wide(elDef.key_nm);
}
try
{
@@ -486,7 +486,7 @@
}
else if (MgCoordinateSystemCodeFormat::Mentor==nFormatSource)
{
- char *pszCsSource = Convert_Wide_To_Ascii(sCodeSource.c_str());
+ char *pszCsSource = Convert_Wide_To_UTF8(sCodeSource.c_str());
if (!pszCsSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -510,7 +510,7 @@
char csWktBufr [2048];
//is it an arbitrary system, one that uses NERTH projection?
- wchar_t* wszMsiName=Convert_Ascii_To_Wide(szMsiName.c_str());
+ wchar_t* wszMsiName=Convert_UTF8_To_Wide(szMsiName.c_str());
if (!wszMsiName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -535,7 +535,7 @@
SmartCriticalClass critical(true);
if (0==CS_cs2Wkt(csWktBufr,sizeof(csWktBufr),szMsiName.c_str(),GetWktFlavor(nWktFlavor)))
{
- wchar_t* wszWkt=Convert_Ascii_To_Wide(csWktBufr);
+ wchar_t* wszWkt=Convert_UTF8_To_Wide(csWktBufr);
if (!wszWkt)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -580,7 +580,7 @@
cs_Csprm_ csprm;
struct cs_Csdef_ csDef;
- pszWkt = Convert_Wide_To_Ascii(sWkt.c_str());
+ pszWkt = Convert_Wide_To_UTF8(sWkt.c_str());
if (NULL == pszWkt)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.WktToCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -670,7 +670,7 @@
//treat various output formats
if (MgCoordinateSystemCodeFormat::Mentor==nFormatDestination)
{
- wchar_t* pwszCsDestination=Convert_Ascii_To_Wide(pszCsDestination);
+ wchar_t* pwszCsDestination=Convert_UTF8_To_Wide(pszCsDestination);
if (pwszCsDestination)
{
sCsCodeDestination=pwszCsDestination;
@@ -743,7 +743,7 @@
throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
}
- pszCsSource = Convert_Wide_To_Ascii(sCsSource.c_str());
+ pszCsSource = Convert_Wide_To_UTF8(sCsSource.c_str());
if (NULL == pszCsSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -761,7 +761,7 @@
if (MgCoordinateSystemCodeFormat::Mentor==nFormatDestination)
{
//stupid case but better than returning E_INVALIDARG
- wchar_t* pwszCsDestination=Convert_Ascii_To_Wide(pszCsSource);
+ wchar_t* pwszCsDestination=Convert_UTF8_To_Wide(pszCsSource);
if (pwszCsDestination)
{
sCsCodeDestination=pwszCsDestination;
@@ -805,7 +805,7 @@
MG_TRY()
- pszCsSource = Convert_Wide_To_Ascii(sCodeSource.c_str());
+ pszCsSource = Convert_Wide_To_UTF8(sCodeSource.c_str());
if (NULL == pszCsSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -859,7 +859,7 @@
{
assert(!szMsiName.empty());
- wchar_t* wszMsiName=Convert_Ascii_To_Wide(szMsiName.c_str());
+ wchar_t* wszMsiName=Convert_UTF8_To_Wide(szMsiName.c_str());
if (!wszMsiName)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -892,7 +892,7 @@
MG_TRY()
- pszCsSource = Convert_Wide_To_Ascii(sCodeSource.c_str());
+ pszCsSource = Convert_Wide_To_UTF8(sCodeSource.c_str());
if (NULL == pszCsSource)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -931,7 +931,7 @@
bool bIsCoordinateSystem=IsCoordinateSystem(const_cast<char*>(szMsiName.c_str()), NULL);
if (bIsCoordinateSystem)
{
- wchar_t *pwszCsDestination=Convert_Ascii_To_Wide(szMsiName.c_str());
+ wchar_t *pwszCsDestination=Convert_UTF8_To_Wide(szMsiName.c_str());
if (!pwszCsDestination)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1128,7 +1128,7 @@
char* szWkt=CCsArbitraryCoordinateSystemUtil::ConvertCoordinateSystemToWkt(&def);
if (szWkt)
{
- wchar_t* pwszWkt=Convert_Ascii_To_Wide(szWkt);
+ wchar_t* pwszWkt=Convert_UTF8_To_Wide(szWkt);
sWkt=pwszWkt;
delete[] szWkt;
delete[] pwszWkt;
@@ -1152,7 +1152,7 @@
{
//get the description
STRING sDescription=pCsDef->GetDescription();
- *ppCsDescription = Convert_Wide_To_Ascii(sDescription.c_str());
+ *ppCsDescription = Convert_Wide_To_UTF8(sDescription.c_str());
}
return true;
}
@@ -1164,7 +1164,7 @@
{
return false;
}
- wchar_t* wszName=Convert_Ascii_To_Wide(kpCsName);
+ wchar_t* wszName=Convert_UTF8_To_Wide(kpCsName);
STRING sCsName(wszName);
delete[] wszName;
return IsCoordinateSystem(sCsName, ppCsDescription);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -21,7 +21,7 @@
#include "CoordSysCommon.h"
#include "CriticalSection.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for OpenDictionaryFile()
#include "MentorDictionary.h"
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -21,7 +21,7 @@
#include "CoordSysCommon.h"
#include "CriticalSection.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for OpenDictionaryFile()
#include "MentorDictionary.h"
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -23,7 +23,7 @@
#include "CoordSysCommon.h"
#include "CriticalSection.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "MentorUtil.h" //for OpenDictionaryFile()
#include "MentorDictionary.h"
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -18,7 +18,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
#include "CriticalSection.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii, CsDictionaryOpenMode
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8, CsDictionaryOpenMode
#include "MentorUtil.h" //for BuildDtDefFromInterface + various utilities
#include "CoordSysGeodeticTransformDef.h" //for CCoordinateSystemGeodeticTransformDef
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGridGeneric.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGridGeneric.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGridGeneric.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -17,7 +17,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "CriticalSection.h" //for SmartCriticalClass
#include "CoordSysGrids.h"
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -17,7 +17,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "CriticalSection.h" //for SmartCriticalClass
#include "CoordSysGrids.h"
@@ -146,7 +146,7 @@
short sBessel=GetBesselFromLetteringScheme(m_nLetteringScheme);
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sEllipsoidCode.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sEllipsoidCode.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
if (m_bExceptionsOn)
@@ -187,7 +187,7 @@
short sBessel=GetBesselFromLetteringScheme(m_nLetteringScheme);
//Convert to a C++ string, for Mentor's sake
- char *pStr = Convert_Wide_To_Ascii(sDatumCode.c_str()); //need to delete[] pStr
+ char *pStr = Convert_Wide_To_UTF8(sDatumCode.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
if (m_bExceptionsOn)
@@ -738,7 +738,7 @@
if (0==nResult)
{
//success, return the MGRS string
- wchar_t* pMgrs = Convert_Ascii_To_Wide(szMgrs);
+ wchar_t* pMgrs = Convert_UTF8_To_Wide(szMgrs);
if (NULL == pMgrs)
{
if (m_bExceptionsOn)
@@ -861,7 +861,7 @@
}
//Convert to a char*
- char *pMgrs = Convert_Wide_To_Ascii(sMgrs.c_str()); //need to delete[] pStr
+ char *pMgrs = Convert_Wide_To_UTF8(sMgrs.c_str()); //need to delete[] pStr
if (NULL == pMgrs)
{
if (m_bExceptionsOn)
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -17,7 +17,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8
#include "CriticalSection.h" //for SmartCriticalClass
#include "Spatial/MathUtility.h"
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysProjectionInformation.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysProjectionInformation.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysProjectionInformation.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -21,7 +21,7 @@
#include "CoordSysEnumInteger32.h" //for CCoordinateSystemEnumInteger32
#include "CoordSysProjectionInformation.h" //for CCoordinateSystemProjectionInformation
-#include "CoordSysUtil.h" //for Convert_Ascii_To_Wide
+#include "CoordSysUtil.h" //for Convert_UTF8_To_Wide
#include "MentorUtil.h" //for IsLegalMentorName()
using namespace CSLibrary;
@@ -563,7 +563,7 @@
throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
}
- wchar_t* pszTag=Convert_Ascii_To_Wide(StringFromProjection(nProjectionCode));
+ wchar_t* pszTag=Convert_UTF8_To_Wide(StringFromProjection(nProjectionCode));
if (NULL == pszTag)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemProjectionInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysTransform.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysTransform.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysTransform.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -910,7 +910,7 @@
//actually, CSMAP automatically sets a name up for the transformation
//presumably, [xfrmName] is never empty
- pDefinitionName = Convert_Ascii_To_Wide (xfrmDefPtr->xfrmName);
+ pDefinitionName = Convert_UTF8_To_Wide (xfrmDefPtr->xfrmName);
bool hasCatalogDef = (NULL != pDefinitionName && L'\0' != pDefinitionName[0]);
if (hasCatalogDef)
{
@@ -982,7 +982,7 @@
// CS-MAP transformation object.
if (m_pDtcprm->pathName [0] != '\0')
{
- wchar_t* pwszDtName = Convert_Ascii_To_Wide (m_pDtcprm->pathName);
+ wchar_t* pwszDtName = Convert_UTF8_To_Wide (m_pDtcprm->pathName);
pathDefName = pwszDtName;
delete[] pwszDtName;
pCatalog = csFactory.GetCatalog();
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysUnitInformation.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysUnitInformation.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysUnitInformation.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -20,7 +20,7 @@
#include "CoordSysEnumInteger32.h" //for CCoordinateSystemEnumInteger32
#include "CoordSysUnitInformation.h" //for CCoordinateSystemUnitInformation
-#include "CoordSysUtil.h" //for Convert_Ascii_To_Wide
+#include "CoordSysUtil.h" //for Convert_UTF8_To_Wide
#include "MentorUtil.h" //for IsLegalMentorName()
using namespace CSLibrary;
@@ -252,7 +252,7 @@
//
STRING CCoordinateSystemUnitInformation::GetTagString(INT32 unit)
{
- wchar_t* pszTag = Convert_Ascii_To_Wide(StringFromUnit(unit));
+ wchar_t* pszTag = Convert_UTF8_To_Wide(StringFromUnit(unit));
if (NULL == pszTag)
{
throw new MgOutOfMemoryException(L"MgCoordinateSystemUnitInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -293,7 +293,7 @@
if (0 != strcmp(kpAbbrev, " z"))
{
//The unit has an abbreviation.
- wchar_t* pAbbrev = Convert_Ascii_To_Wide(kpAbbrev);
+ wchar_t* pAbbrev = Convert_UTF8_To_Wide(kpAbbrev);
sAbbrev=pAbbrev;
delete[] pAbbrev;
}
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h 2014-11-21 01:05:28 UTC (rev 8453)
@@ -85,6 +85,26 @@
}
inline char *
+Convert_Wide_To_UTF8 (const wchar_t *wstr)
+{
+ // Short circuit null pointer case
+ if (wstr == 0)
+ return 0;
+
+ return MgUtil::WideCharToMultiByte(wstr);
+}
+
+inline wchar_t *
+Convert_UTF8_To_Wide (const char *str)
+{
+ // Short circuit null pointer case
+ if (str == 0)
+ return 0;
+
+ return MgUtil::MultiByteToWideChar(str);
+}
+
+inline char *
Convert_Wide_To_Ascii (const wchar_t *wstr)
{
// Short circuit null pointer case
Modified: trunk/MgDev/Common/CoordinateSystem/MentorDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/MentorDictionary.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/MentorDictionary.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -19,7 +19,7 @@
#include "CoordSysCommon.h"
#include "CriticalSection.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii, CsDictionaryOpenMode
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8, CsDictionaryOpenMode
#include "MentorDictionary.h"
#include "MentorUtil.h" //for OpenDictionaryFile()
Modified: trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h 2014-11-21 01:05:28 UTC (rev 8453)
@@ -615,7 +615,7 @@
const wchar_t* kpName)
{
//Make sure the specified definition is present
- char *pName = Convert_Wide_To_Ascii(kpName); //need to delete [] pName;
+ char *pName = Convert_Wide_To_UTF8(kpName); //need to delete [] pName;
if (NULL == pName)
{
throw new MgOutOfMemoryException(L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"", NULL);
Modified: trunk/MgDev/Common/CoordinateSystem/MentorUtil.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/MentorUtil.cpp 2014-11-20 16:51:51 UTC (rev 8452)
+++ trunk/MgDev/Common/CoordinateSystem/MentorUtil.cpp 2014-11-21 01:05:28 UTC (rev 8453)
@@ -25,7 +25,7 @@
#include "GeometryCommon.h"
#include "CoordSysCommon.h"
#include "CriticalSection.h"
-#include "CoordSysUtil.h" //for Convert_Wide_To_Ascii, CsDictionaryOpenMode
+#include "CoordSysUtil.h" //for Convert_Wide_To_UTF8, CsDictionaryOpenMode
#include "MentorDictionary.h"
#ifdef _WIN32
#include <io.h> //for _dup()
@@ -533,7 +533,7 @@
if (!CS_stricmp (kpStr, cs_Prjtab[i].key_nm))
{
// Found a match!
- wchar_t* pwszDesc = Convert_Ascii_To_Wide(cs_Prjtab[i].descr);
+ wchar_t* pwszDesc = Convert_UTF8_To_Wide(cs_Prjtab[i].descr);
if (NULL != pwszDesc)
{
@@ -1643,7 +1643,7 @@
MG_TRY()
- pString = Convert_Ascii_To_Wide(mentorString);
+ pString = Convert_UTF8_To_Wide(mentorString);
if (NULL == pString) //ABA: this cannot be null, can it?
throw new MgOutOfMemoryException(L"MentorUtil.ReadString", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -1679,7 +1679,7 @@
}
//Convert to a C++ string, for Mentor's sake
- pStr = Convert_Wide_To_Ascii(sSrc.c_str()); //need to delete[] pStr
+ pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
if (NULL == pStr)
{
throw new MgOutOfMemoryException(L"MentorSetString", __LINE__, __WFILE__, NULL, L"", NULL);
More information about the mapguide-commits
mailing list