commit 2025-10-09 10:41 bug fix about wchar_t in ZCppMain/ZtCStringEx.H and add ZftAtoI(), ZftAotL() etc in ZCppMain/ZMainHead.H

This commit is contained in:
2025-10-09 10:41:59 +09:00
parent f2a67017c8
commit ce0d364102
4 changed files with 165 additions and 55 deletions

View File

@ -193,6 +193,7 @@
#include <string>
#include <climits>
#include <typeinfo>
#include <wchar.h>
#define _CODE_OLD_ 0
@ -817,22 +818,11 @@ namespace ZNsMain
template<typename TTypChar> class ZtCCharInt
{
public: typedef typename ZtCCharIntBySize<sizeof(TTypChar)>::TypeInte TypeInt;
};/*
template<typename TTypChar> class ZtCCharInt*/
template<> class ZtCCharInt<char>
{
public: typedef typename ZtCCharIntBySize<sizeof(char) >::TypeInt TypeInt;
};/*
template<> class ZtCCharInt<char>*/
template<> class ZtCCharInt<wchar_t>
{
public: typedef typename ZtCCharIntBySize<sizeof(wchar_t) >::TypeInt TypeInt;
};/*
template<> class ZtCCharInt<wchar_t>*/
{ public: typedef typename ZtCCharIntBySize<sizeof(TTypChar)>::TypeInt TypeInt; };
template<> class ZtCCharInt<char >
{ public: typedef typename ZtCCharIntBySize<sizeof(char) >::TypeInt TypeInt; };
template<> class ZtCCharInt<wchar_t>
{ public: typedef typename ZtCCharIntBySize<sizeof(wchar_t) >::TypeInt TypeInt; };
template<typename TTyChar, typename TTyiLength> ZTypIntE ZftGetCompareCode
@ -3814,6 +3804,78 @@ namespace ZNsMain
inline double ZfAtoD(const char* ApcChar)*/
/*#############################################################################
■ #include <wchar.h>
long int wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
#include <wchar.h>
long long int wcstoll(const wchar_t *nptr, wchar_t **endptr, int base);
float wcstof ( const wchar_t* str, wchar_t** str_end ); (since C++11)
double wcstod ( const wchar_t* str, wchar_t** str_end );
long double wcstold( const wchar_t* str, wchar_t** str_end ); (since C++11)
-- 2025-10-08 09:23
#############################################################################*/
template<typename TTypChar> inline
ZTypInt ZftAtoI (const TTypChar* ApcChar){ return 0; }
template<> inline
ZTypInt ZftAtoI (const char* ApcChar){ return ZfAtoI(ApcChar); }
template<> inline
ZTypInt ZftAtoI (const wchar_t* ApcChar){ return (ZTypInt)::wcstol(ApcChar, 0, 0) ; }
template<typename TTypChar> inline
ZTypLong ZftAtoL (const TTypChar* ApcChar){ return 0; }
template<> inline
ZTypLong ZftAtoL (const char* ApcChar){ return ZfAtoI(ApcChar); }
template<> inline
ZTypLong ZftAtoL (const wchar_t* ApcChar){ return ::wcstol(ApcChar, 0, 0) ; }
template<typename TTypChar> inline
ZTypLLong ZftAtoLL(const TTypChar* ApcChar){ return 0; }
template<> inline
ZTypLLong ZftAtoLL(const char* ApcChar){ return ZfAtoLL(ApcChar); }
template<> inline
ZTypLLong ZftAtoLL(const wchar_t* ApcChar){ return ::wcstoll(ApcChar, 0, 0) ; }
template<typename TTypChar> inline
double ZftAtoD (const TTypChar* ApcChar){ return 0; }
template<> inline
double ZftAtoD (const char* ApcChar){ return ZfAtoD(ApcChar); }
template<> inline
double ZftAtoD (const wchar_t* ApcChar){ return ::wcstod(ApcChar, 0) ; }
template<typename TTypChar> inline
ZTypInt ZftAtoI (const TTypChar* ApcChar, ZTypInt AI_Length){ return 0; }
template<> inline
ZTypInt ZftAtoI (const char* ApcChar, ZTypInt AI_Length){ return ZfAtoI(ApcChar); }
template<> inline
ZTypInt ZftAtoI (const wchar_t* ApcChar, ZTypInt AI_Length){ return (ZTypInt)::wcstol(ApcChar, 0, 0) ; }
template<typename TTypChar> inline
ZTypLong ZftAtoL (const TTypChar* ApcChar, ZTypInt AI_Length){ return 0; }
template<> inline
ZTypLong ZftAtoL (const char* ApcChar, ZTypInt AI_Length){ return ZfAtoI(ApcChar); }
template<> inline
ZTypLong ZftAtoL (const wchar_t* ApcChar, ZTypInt AI_Length){ return ::wcstol(ApcChar, 0, 0) ; }
template<typename TTypChar> inline
ZTypLLong ZftAtoLL(const TTypChar* ApcChar, ZTypInt AI_Length){ return 0; }
template<> inline
ZTypLLong ZftAtoLL(const char* ApcChar, ZTypInt AI_Length){ return ZfAtoLL(ApcChar); }
template<> inline
ZTypLLong ZftAtoLL(const wchar_t* ApcChar, ZTypInt AI_Length){ return ::wcstoll(ApcChar, 0, 0) ; }
template<typename TTypChar> inline
double ZftAtoD (const TTypChar* ApcChar, ZTypInt AI_Length){ return 0; }
template<> inline
double ZftAtoD (const char* ApcChar, ZTypInt AI_Length){ return ZfAtoD(ApcChar); }
template<> inline
double ZftAtoD (const wchar_t* ApcChar, ZTypInt AI_Length){ return ::wcstod(ApcChar, 0) ; }
inline ZTypLLong AtoLL(const char* ApcChar){return ZfAtoLL(ApcChar);}
@ -3837,9 +3899,9 @@ namespace ZNsMain
ZTypLength VL_Length=0;
while(*(ApcChar+VL_Length)!=_T('\0'))
while(*(ApcChar+VL_Length)!=TTypeCh('\0'))
++VL_Length;
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
return VL_Length;
}/*