diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index 4f6386c..2a650e0 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -4227,6 +4227,272 @@ namespace ZNsMain class ZtCList /*######################################*/ + + namespace ZNsChars + { + + template class ZtCMainChars; + + }/* + namespace ZNsChars*/ + + + + template< typename TTypeChar, typename TTypeLength=ZTypLength + > + class ZtCChars /**#########################################*/ + { + public : + template + friend class ZNsChars::ZtCMainChars ; + public : + typedef TTypeChar TypeChar ; + typedef TTypeLength TypeLength ; + public: + typedef const TTypeChar TypeCharC ; + typedef const TTypeChar* TypeCharCP ; + private: + TypeChar* mp_TypeChar ; + TypeLength ml_TypeLength; + public : + + ZtCChars() + { + mp_TypeChar =0; + ml_TypeLength=0; + }/* + ZtCChars()*/ + + ZtCChars(TypeCharC* APC_TypeChar) + { + mp_TypeChar = + const_cast (APC_TypeChar); + ml_TypeLength = ZftGetLength(mp_TypeChar ); + }/* + ZtCChars(TypeCharC* APC_TypeChar)*/ + + ZtCChars(TypeCharC* APC_TypeChar, TypeLength AL_Length) + { + mp_TypeChar = const_cast + (APC_TypeChar) ; + ml_TypeLength= AL_Length ; + }/* + ZtCChars(TypeCharC* APC_TypeChar, TypeLength AL_Length)*/ + + + void Init() + { + mp_TypeChar = 0; + ml_TypeLength= 0; + }/* + void Init()*/ + + void Init(TypeCharC* APC_TypeChar) + { + mp_TypeChar = + const_cast (APC_TypeChar); + ml_TypeLength= ZftGetLength(mp_TypeChar ); + }/* + void Init(TypeCharC* APC_TypeChar)*/ + + void Init(TypeCharC* APC_TypeChar, TypeLength AL_Length) + { + mp_TypeChar =const_cast + (APC_TypeChar) ; + ml_TypeLength=AL_Length ; + }/* + void Init(TypeCharC* APC_TypeChar, TypeLength AL_Length)*/ + + + void InitData(TypeCharC* APC_TypeChar) + { + mp_TypeChar=const_cast(APC_TypeChar); + }/* + void InitData(TypeCharC* APC_TypeChar)*/ + + void InitLength(TypeLength AL_Length) + { + ml_TypeLength=AL_Length; + }/* + void InitLength(TypeLength AL_Length)*/ + + TypeChar* data() {return mp_TypeChar ;} + TypeCharC* data() const{return mp_TypeChar ;} + TypeLength size() const{return ml_TypeLength;} + + ZtCChars& operator+=(TypeLength AI_MovePos) + { + return MoveChar(AI_MovePos); + }/* + ZtCChars& operator+=(TypeLength AI_MovePos)*/ + + int operator-(const ZtCChars& rhs) const + { + // 두 문자열이 같으면 0 + // 왼쪽 문자열이 크면 0 보다 큰 어떤 수 + // 오른쪽 문자열이 크면 0 보다 작은 어떤 수를 반환 + + TypeCharC* VP_Left = mp_TypeChar; + TypeCharC* VP_Right=rhs.mp_TypeChar; + + #if(_CODE_OLD_) + TypeChar VC_Minus=0; + #else + int VI_Minus=0; // 페이지 하단의 'char 의 int 확장에 따른 문제의 코드' 참고. + #endif + TypeLength VL_Index=0; + TypeLength VL_Loop =(ml_TypeLength<=rhs.ml_TypeLength ? ml_TypeLength : rhs.ml_TypeLength) ; + + while(VL_Index (const ZtCChars& rhs) const{return (*this)-rhs > 0 ;} + bool operator< (const ZtCChars& rhs) const{return (*this)-rhs < 0 ;} + bool operator>=(const ZtCChars& rhs) const{return (*this)-rhs >= 0 ;} + bool operator<=(const ZtCChars& rhs) const{return (*this)-rhs <= 0 ;} + + ZtCChars& MoveChar(TypeLength AI_MovePos) + { + mp_TypeChar += AI_MovePos ; + ml_TypeLength -= AI_MovePos ; + + return *this; + }/* + ZtCChars& MoveChar(TypeLength AI_MovePos)*/ + + + ZTypIntI GetInt(bool AB_IsBigEndian=true) const + { + const ZTypIntI CI_IntByte = sizeof(ZTypIntI); + const ZTypIntI CI_SearchSize = + (ml_TypeLength=0; --i) + { + VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; + VI_TempInt*= 256 ; + }/* + for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ + + return VI_Result; + }/* + if(AB_IsBigEndian)*/ + + for(ZTypIntI i=0; i=0; --i) + { + VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; + VI_TempInt *= 256 ; + }/* + for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ + + return VI_Result; + }/* + if(AB_IsBigEndian)*/ + + for(ZTypIntI i=0; i=0; --i) + { + VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; + VI_TempInt *= 256 ; + }/* + for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ + + return VI_Result; + }/* + if(AB_IsBigEndian)*/ + + for(ZTypIntI i=0; i + class ZtCChars /**#########################################*/ + + + namespace ZNsView { diff --git a/ZCppMain/ZtCMainChars.H b/ZCppMain/ZtCMainChars.H index a2d0cca..f45db01 100644 --- a/ZCppMain/ZtCMainChars.H +++ b/ZCppMain/ZtCMainChars.H @@ -193,11 +193,13 @@ namespace ZNsMain class ZtCTypeChars /*////////////////////*/ { public: - typedef TTypeChar TypeChar ; - typedef TTypeLength TypeLength; // signed 형이어야 한다. + typedef TTypeChar TypeChar ; + typedef TTypeLength TypeLength; // signed 형이어야 한다. public: - typedef const TypeChar TypeCharC ; - typedef const TypeChar* TypeCharCP; + typedef const TypeChar TypeCharC ; + typedef const TypeChar* TypeCharCP; + public: + typedef ZNsMain::ZtCChars ZCChars; public: static TypeChar GetCharOfAnsi(char AC_AnsiChar) @@ -223,15 +225,7 @@ namespace ZNsMain static TypeLength GetLength(TypeCharC* APC_TypeChar) { - if(APC_TypeChar==0) return 0; TypeLength VL_Length=0; - - while(*(APC_TypeChar+VL_Length)!=ZtCTypeChars::GetCharOfAnsi('\0')) - { - ++VL_Length; - }/* - while(*(APC_TypeChar+VL_Length)!=ZtCTypeChars::GetCharOfAnsi('\0'))*/ - - return VL_Length; + return ZNsMain::ZftGetLengthType(APC_TypeChar); }/* static TypeLength GetLength(TypeCharC* APC_TypeChar) @@ -240,287 +234,6 @@ namespace ZNsMain public: - class ZCChars - { - public : - template friend class ZtCMainChars; - public : - typedef ZtCTypeChars ZCTypeChars; - typedef TTypeChar TypeChar ; - typedef TTypeLength TypeLength ; - public: - typedef const TTypeChar TypeCharC ; - typedef const TTypeChar* TypeCharCP ; - private: - TypeChar* mp_TypeChar ; - TypeLength ml_TypeLength; - public : - - ZCChars() - { - mp_TypeChar =0; - ml_TypeLength=0; - }/* - ZCChars()*/ - - ZCChars(TypeCharC* APC_TypeChar) - { - mp_TypeChar =const_cast (APC_TypeChar); - ml_TypeLength=ZtCTypeChars::GetLength(mp_TypeChar ); - }/* - ZCChars(TypeCharC* APC_TypeChar)*/ - - ZCChars(TypeCharC* APC_TypeChar, TypeLength AL_Length) - { - mp_TypeChar = const_cast - (APC_TypeChar) ; - ml_TypeLength=AL_Length ; - }/* - ZCChars(TypeCharC* APC_TypeChar, TypeLength AL_Length)*/ - - - void Init() - { - mp_TypeChar = 0; - ml_TypeLength= 0; - }/* - void Init()*/ - - void Init(TypeCharC* APC_TypeChar) - { - mp_TypeChar = const_cast (APC_TypeChar); - ml_TypeLength= ZtCTypeChars::GetLength(mp_TypeChar ); - }/* - void Init(TypeCharC* APC_TypeChar)*/ - - void Init(TypeCharC* APC_TypeChar, TypeLength AL_Length) - { - mp_TypeChar =const_cast - (APC_TypeChar) ; - ml_TypeLength=AL_Length ; - }/* - void Init(TypeCharC* APC_TypeChar, TypeLength AL_Length)*/ - - - void InitData(TypeCharC* APC_TypeChar) - { - mp_TypeChar=const_cast(APC_TypeChar); - }/* - void InitData(TypeCharC* APC_TypeChar)*/ - - void InitLength(TypeLength AL_Length) - { - ml_TypeLength=AL_Length; - }/* - void InitLength(TypeLength AL_Length)*/ - - TypeChar* data() {return mp_TypeChar ;} - TypeCharC* data() const{return mp_TypeChar ;} - TypeLength size() const{return ml_TypeLength;} - - ZCChars& operator+=(TypeLength AI_MovePos) - { - return MoveChar(AI_MovePos); - }/* - ZCChars& operator+=(TypeLength AI_MovePos)*/ - - int operator-(const ZCChars& rhs) const - { - // 두 문자열이 같으면 0 - // 왼쪽 문자열이 크면 0 보다 큰 어떤 수 - // 오른쪽 문자열이 크면 0 보다 작은 어떤 수를 반환 - - TypeCharC* VP_Left = mp_TypeChar; - TypeCharC* VP_Right=rhs.mp_TypeChar; - - #if(_CODE_OLD_) - TypeChar VC_Minus=0; - #else - int VI_Minus=0; // 페이지 하단의 'char 의 int 확장에 따른 문제의 코드' 참고. - #endif - TypeLength VL_Index=0; - TypeLength VL_Loop =(ml_TypeLength<=rhs.ml_TypeLength ? ml_TypeLength : rhs.ml_TypeLength) ; - - while(VL_Index (const ZCChars& rhs) const{return (*this)-rhs > 0 ;} - bool operator< (const ZCChars& rhs) const{return (*this)-rhs < 0 ;} - bool operator>=(const ZCChars& rhs) const{return (*this)-rhs >= 0 ;} - bool operator<=(const ZCChars& rhs) const{return (*this)-rhs <= 0 ;} - - ZCChars& MoveChar(TypeLength AI_MovePos) - { - mp_TypeChar +=AI_MovePos; - ml_TypeLength-=AI_MovePos; - - return *this; - }/* - ZCChars& MoveChar(TypeLength AI_MovePos)*/ - - - ZTypIntI GetInt(bool AB_IsBigEndian=true) const - { - const ZTypIntI CI_IntByte = sizeof(ZTypIntI); - const ZTypIntI CI_SearchSize = - (ml_TypeLength=0; --i) - { - VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; - VI_TempInt*= 256 ; - }/* - for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ - - return VI_Result; - }/* - if(AB_IsBigEndian)*/ - - for(ZTypIntI i=0; i=0; --i) - { - VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; - VI_TempInt *= 256 ; - }/* - for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ - - return VI_Result; - }/* - if(AB_IsBigEndian)*/ - - for(ZTypIntI i=0; i=0; --i) - { - VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; - VI_TempInt *= 256 ; - }/* - for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ - - return VI_Result; - }/* - if(AB_IsBigEndian)*/ - - for(ZTypIntI i=0; i TypeInt GetIntType(bool AB_IsBigEndian=true) const - { - const ZTypIntI CI_IntByte = sizeof(TypeInt); - const ZTypIntI CI_SearchSize = - (ml_TypeLength=0; --i) - { - VI_Result += (ZTypIntI)(ZTypUChar)(mp_TypeChar[i]) * VI_TempInt ; - VI_TempInt *= 256 ; - }/* - for(ZTypIntI i=CI_SearchSize-1; i>=0; --i)*/ - - return VI_Result; - }/* - if(AB_IsBigEndian)*/ - - for(ZTypIntI i=0; i TypeInt GetIntType(bool AB_IsBigEndian=true) const*/ - - public: - };/* - class ZCChars*/ - - static TypeChar GetUpperChar(TypeChar AC_TypeChar) { const int CI_Distance='a'-'A'; return @@ -707,9 +420,10 @@ namespace ZNsMain }/* static TypeChar* Trim(TypeChar* APC_Char,TypeLength& ARRL_Length)*/ + static ZCChars& Trim(ZCChars& ARR_CChars) { - ZtCMainChars::Trim(ARR_CChars.mp_TypeChar, RR(ARR_CChars.ml_TypeLength)); return ARR_CChars; + ZtCMainChars::Trim(ARR_CChars.data(), RR(ARR_CChars.ml_TypeLength)); return ARR_CChars; }/* static ZCChars& Trim(ZCChars& ARR_CChars)*/ @@ -4320,7 +4034,7 @@ namespace ZNsMain TypeLength VL_PermitLength=AL_PermitLength/2; TypeLength j =0; - for(TypeLength i=0;i