commit 2025-08-21 13:57 edit a bit ZMainHead.H
This commit is contained in:
@ -2338,14 +2338,14 @@ namespace ZNsMain
|
|||||||
|
|
||||||
// 절대값을 가져온다.
|
// 절대값을 가져온다.
|
||||||
|
|
||||||
template<typename TLong> TLong ABS(TLong AL_Value)
|
template<typename TLong> TLong ZfABS(TLong AL_Value)
|
||||||
{
|
{
|
||||||
if(AL_Value<0) return -AL_Value; return AL_Value;
|
if(AL_Value<0) return -AL_Value; return AL_Value;
|
||||||
}/*
|
}/*
|
||||||
template<typename TLong> TLong ABS(TLong AL_Value) */
|
template<typename TLong> TLong ZfABS(TLong AL_Value) */
|
||||||
|
|
||||||
template<typename TypeInt>
|
template<typename TypeInt>
|
||||||
TypeInt AToInt(const char* ApcChar, ZTypIntI AI_Length)
|
TypeInt ZfAToInt(const char* ApcChar, ZTypIntI AI_Length)
|
||||||
{
|
{
|
||||||
if(AI_Length<1) return 0;
|
if(AI_Length<1) return 0;
|
||||||
|
|
||||||
@ -2371,64 +2371,80 @@ namespace ZNsMain
|
|||||||
return VL_Result;
|
return VL_Result;
|
||||||
}/*
|
}/*
|
||||||
template<typename TypeInt>
|
template<typename TypeInt>
|
||||||
TypeInt AToInt(const char* ApcChar, ZTypIntI AI_Length) */
|
TypeInt ZfAToInt(const char* ApcChar, ZTypIntI AI_Length) */
|
||||||
|
|
||||||
#ifdef _WIN
|
#ifdef _WIN
|
||||||
|
|
||||||
inline ZTypLLong ATOLL(const char* ApcChar)
|
inline ZTypLLong ZfATOLL(const char* ApcChar)
|
||||||
{
|
{
|
||||||
if(ApcChar==0) return 0; return ::_atoi64(ApcChar);
|
if(ApcChar==0) return 0; return ::_atoi64(ApcChar);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypLLong ATOLL(const char* ApcChar)*/
|
inline ZTypLLong ZfATOLL(const char* ApcChar)*/
|
||||||
|
|
||||||
#else // !defined(_WIN)
|
#else // !defined(_WIN)
|
||||||
|
|
||||||
inline ZTypLLong ATOLL(const char* ApcChar)
|
inline ZTypLLong ZfATOLL(const char* ApcChar)
|
||||||
{
|
{
|
||||||
if(ApcChar==0) return 0; return ::atoll(ApcChar);
|
if(ApcChar==0) return 0; return ::atoll(ApcChar);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypLLong ATOLL(const char* ApcChar)*/
|
inline ZTypLLong ZfATOLL(const char* ApcChar)*/
|
||||||
|
|
||||||
#endif // !defined(_WIN)
|
#endif // !defined(_WIN)
|
||||||
|
|
||||||
|
|
||||||
inline ZTypLLong ATOLL(const char* ApcChar, ZTypIntI AI_Length)
|
inline ZTypLLong ZfATOLL(const char* ApcChar, ZTypIntI AI_Length)
|
||||||
{
|
{
|
||||||
return AToInt<ZTypLLong>(ApcChar, AI_Length);
|
return ZfAToInt<ZTypLLong>(ApcChar, AI_Length);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypLLong ATOL(const char* ApcChar, ZTypIntI AI_Length)*/
|
inline ZTypLLong ZfATOL(const char* ApcChar, ZTypIntI AI_Length)*/
|
||||||
|
|
||||||
|
|
||||||
inline ZTypLong ATOL(const char* ApcChar)
|
inline ZTypLong ZfATOL(const char* ApcChar)
|
||||||
{
|
{
|
||||||
if(ApcChar==0) return 0; return atol(ApcChar);
|
if(ApcChar==0) return 0; return ::atol(ApcChar);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypLong ATOL(const char* ApcChar)*/
|
inline ZTypLong ZfATOL(const char* ApcChar)*/
|
||||||
|
|
||||||
inline ZTypLong ATOL(const char* ApcChar, ZTypIntI AI_Length)
|
inline ZTypLong ZfATOL(const char* ApcChar, ZTypIntI AI_Length)
|
||||||
{
|
{
|
||||||
return AToInt<ZTypLong>(ApcChar, AI_Length);
|
return ZfAToInt<ZTypLong>(ApcChar, AI_Length);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypLong ATOL(const char* ApcChar, ZTypIntI AI_Length)*/
|
inline ZTypLong ZfATOL(const char* ApcChar, ZTypIntI AI_Length)*/
|
||||||
|
|
||||||
|
|
||||||
inline ZTypIntI ATOI(const char* ApcChar)
|
inline ZTypIntI ZfATOI(const char* ApcChar)
|
||||||
{
|
{
|
||||||
if(ApcChar==0) return 0; return atoi(ApcChar);
|
if(ApcChar==0) return 0; return ::atoi(ApcChar);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypIntI ATOI(const char* ApcChar)*/
|
inline ZTypIntI ZfATOI(const char* ApcChar)*/
|
||||||
|
|
||||||
inline ZTypIntI ATOI(const char* ApcChar, ZTypIntI AI_Length)
|
inline ZTypIntI ZfATOI(const char* ApcChar, ZTypIntI AI_Length)
|
||||||
{
|
{
|
||||||
return AToInt<ZTypIntI>(ApcChar, AI_Length);
|
return ZfAToInt<ZTypIntI>(ApcChar, AI_Length);
|
||||||
}/*
|
}/*
|
||||||
inline ZTypIntI ATOI(const char* ApcChar, ZTypIntI AI_Length)*/
|
inline ZTypIntI ZfATOI(const char* ApcChar, ZTypIntI AI_Length)*/
|
||||||
|
|
||||||
inline double ATOD(const char* ApcChar)
|
inline double ZfATOD(const char* ApcChar)
|
||||||
{
|
{
|
||||||
return ApcChar==0 ? 0 : ::atof(ApcChar) ;
|
return ApcChar==0 ? 0 : ::atof(ApcChar) ;
|
||||||
}/*
|
}/*
|
||||||
inline double ATOD(const char* ApcChar)*/
|
inline double ZfATOD(const char* ApcChar)*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline ZTypLLong ATOLL(const char* ApcChar){return ZfATOLL(ApcChar);}
|
||||||
|
inline ZTypLong ATOL (const char* ApcChar){return ZfATOL (ApcChar);}
|
||||||
|
inline ZTypIntI ATOI (const char* ApcChar){return ZfATOI (ApcChar);}
|
||||||
|
inline double ATOD (const char* ApcChar){return ZfATOD (ApcChar);}
|
||||||
|
|
||||||
|
inline ZTypLLong ATOLL(const char* ApcChar, ZTypIntI AI_Length)
|
||||||
|
{ return ZfAToInt<ZTypLLong>(ApcChar, AI_Length); }
|
||||||
|
inline ZTypLong ATOL (const char* ApcChar, ZTypIntI AI_Length)
|
||||||
|
{ return ZfAToInt<ZTypLong >(ApcChar, AI_Length); }
|
||||||
|
inline ZTypIntI ATOI (const char* ApcChar, ZTypIntI AI_Length)
|
||||||
|
{ return ZfAToInt<ZTypIntI >(ApcChar, AI_Length); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TTypeCh>
|
template<typename TTypeCh>
|
||||||
|
@ -1410,108 +1410,6 @@ namespace ZNsMain
|
|||||||
TypeLength AL_AddSize, TypeCharC* APC_Format, ...)*/
|
TypeLength AL_AddSize, TypeCharC* APC_Format, ...)*/
|
||||||
|
|
||||||
|
|
||||||
ZCStringBase& AddInt4Byte(ZNsMain::ZTypLong AUL_LongType)
|
|
||||||
{
|
|
||||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
■ ULongType 을 4 바이트의 비트 그대로 붙인다. 붙일때 big endian 으로 한다. big endian 이
|
|
||||||
인간의 표현과 일치한다. 즉 주소가 증가하는 순서로 메모리에 저장된다.
|
|
||||||
|
|
||||||
little endian 의 경우 4 바이트 정수형의 주소를 p 라 하면 p[3],p[2],p[1],p[0] 의 순서다.
|
|
||||||
|
|
||||||
■ AddInt~Byte 류의 멤버함수는 최적화의 여지가 있다.
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
const int CI_AddSize =4;
|
|
||||||
const int CI_BitOfByte=8;
|
|
||||||
const int CI_LongByte =sizeof(ZNsMain::ZTypLong);
|
|
||||||
|
|
||||||
const bool CB_DoKeepString= true; ReAllocAdd
|
|
||||||
( CI_AddSize, CB_DoKeepString );
|
|
||||||
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
|
||||||
|
|
||||||
TypeChar* VPC_Start=mpc_Data+ml_UseLen;
|
|
||||||
|
|
||||||
int i=CI_AddSize; /////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
while(i>CI_LongByte)
|
|
||||||
{
|
|
||||||
*VPC_Start++ = 0 ; --i; // CI_AddSize>sizeof(TypeLength) 일 때는 대비.
|
|
||||||
}/*
|
|
||||||
while(i>CI_LongByte)*/
|
|
||||||
|
|
||||||
while(i>=1)
|
|
||||||
{
|
|
||||||
*VPC_Start++ = ////////////////////////////
|
|
||||||
(
|
|
||||||
( AUL_LongType << ((CI_LongByte-i)*CI_BitOfByte) ) >>
|
|
||||||
( (CI_LongByte-1)*CI_BitOfByte)
|
|
||||||
) ;
|
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
--i;
|
|
||||||
}/*
|
|
||||||
while(i>=1)*/
|
|
||||||
|
|
||||||
*VPC_Start=0; ml_UseLen += CI_AddSize ; return *this;
|
|
||||||
}/*
|
|
||||||
ZCStringBase& AddInt4Byte(ZNsMain::ZTypLong AUL_LongType)*/
|
|
||||||
|
|
||||||
ZCStringBase& AddInt8Byte(ZNsMain::ZTypLLong ALL_LLongType)
|
|
||||||
{
|
|
||||||
// ULongType 을 8 바이트의 비트 그대로 붙인다.
|
|
||||||
// 붙일 때 big endian 으로 한다.
|
|
||||||
|
|
||||||
const int CI_AddSize =8;
|
|
||||||
const int CI_BitOfByte =8;
|
|
||||||
const int CI_LLongByte =sizeof(ZNsMain::ZTypLLong);
|
|
||||||
|
|
||||||
ReAllocAdd(CI_AddSize, true); /*>>>>>>>>>>>>>>>>>>>>>>>>*/
|
|
||||||
|
|
||||||
TypeChar* VPC_Start=mpc_Data+ml_UseLen; int i=CI_AddSize;
|
|
||||||
|
|
||||||
while(i>CI_LLongByte)
|
|
||||||
{
|
|
||||||
*VPC_Start++ = 0 ; --i;
|
|
||||||
}/*
|
|
||||||
while(i>CI_LLongByte)*/
|
|
||||||
|
|
||||||
while(i>=1)
|
|
||||||
{
|
|
||||||
*VPC_Start++ = //////////////////////////////
|
|
||||||
(
|
|
||||||
( ALL_LLongType << ((CI_LLongByte-i)*CI_BitOfByte) ) >>
|
|
||||||
( (CI_LLongByte-1)*CI_BitOfByte )
|
|
||||||
) ;
|
|
||||||
/////////////////////////////////////////////
|
|
||||||
|
|
||||||
--i;
|
|
||||||
}/*
|
|
||||||
while(i>=1)*/
|
|
||||||
|
|
||||||
*VPC_Start=0; ml_UseLen += CI_AddSize; return *this;
|
|
||||||
}/*
|
|
||||||
ZCStringBase& AddInt8Byte(TypeLength ALL_LLongType)*/
|
|
||||||
|
|
||||||
ZCStringBase& AddInt2Byte(ZNsMain::ZTypInt AI_IntType)
|
|
||||||
{
|
|
||||||
const int CI_AddSize =2;
|
|
||||||
const int CI_BitOfByte=8;
|
|
||||||
const int CI_IntByte =sizeof(ZNsMain::ZTypInt);
|
|
||||||
|
|
||||||
ReAllocAdd(CI_AddSize,true);
|
|
||||||
|
|
||||||
TypeChar* VPC_Start=mpc_Data+ml_UseLen;
|
|
||||||
|
|
||||||
*VPC_Start++ = ( ( AI_IntType << ((CI_IntByte-2)*CI_BitOfByte) ) >> ((CI_IntByte-1)*CI_BitOfByte) ) ;
|
|
||||||
*VPC_Start++ = ( ( AI_IntType << ((CI_IntByte-1)*CI_BitOfByte) ) >> ((CI_IntByte-1)*CI_BitOfByte) ) ;
|
|
||||||
|
|
||||||
*VPC_Start=0; ml_UseLen += CI_AddSize; return *this;
|
|
||||||
}/*
|
|
||||||
ZCStringBase& AddInt2Byte(ZNsMain::ZTypInt AI_IntType)*/
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TObject> ZCStringBase& AddObject(TObject& AR_CObject)
|
template<typename TObject> ZCStringBase& AddObject(TObject& AR_CObject)
|
||||||
{
|
{
|
||||||
@ -1740,11 +1638,11 @@ namespace ZNsMain
|
|||||||
}/*
|
}/*
|
||||||
bool IsEmpty() const*/
|
bool IsEmpty() const*/
|
||||||
|
|
||||||
int GetInt () const{return ZNsMain::ATOI (mpc_Data);}
|
int GetInt () const{return ZNsMain::ZfATOI (mpc_Data);}
|
||||||
ZTypLong GetLong () const{return ZNsMain::ATOL (mpc_Data);}
|
ZTypLong GetLong () const{return ZNsMain::ZfATOL (mpc_Data);}
|
||||||
ZTypLLong GetLongLong() const{return ZNsMain::ATOLL(mpc_Data);}
|
ZTypLLong GetLongLong() const{return ZNsMain::ZfATOLL(mpc_Data);}
|
||||||
ZTypLLong GetLLong () const{return ZNsMain::ATOLL(mpc_Data);}
|
ZTypLLong GetLLong () const{return ZNsMain::ZfATOLL(mpc_Data);}
|
||||||
double GetDouble () const{return ZNsMain::ATOD (mpc_Data);}
|
double GetDouble () const{return ZNsMain::ZfATOD (mpc_Data);}
|
||||||
|
|
||||||
ZCStringBase& ConvertLLong()
|
ZCStringBase& ConvertLLong()
|
||||||
{
|
{
|
||||||
@ -7897,7 +7795,6 @@ namespace ZNsMain
|
|||||||
// TyUInt 은 unsigned 형이어야 한다.
|
// TyUInt 은 unsigned 형이어야 한다.
|
||||||
|
|
||||||
const int CI_Byte = sizeof(TyUInt)*8 ;
|
const int CI_Byte = sizeof(TyUInt)*8 ;
|
||||||
|
|
||||||
TyUInt VUI_Value = (0x01)<<(CI_Byte-1);
|
TyUInt VUI_Value = (0x01)<<(CI_Byte-1);
|
||||||
|
|
||||||
for(int i=1; i<CI_Byte; ++i)
|
for(int i=1; i<CI_Byte; ++i)
|
||||||
|
Reference in New Issue
Block a user