commit 2025-08-16 34:34
git add ZCppMain/ZMainHead.H git add ZCppMain/ZtCArray.H git add ZCppMain/ZtCObjList.H git add ZCppMain/ZMainAVL.H git add ZCppMain/ZMainHeadEx.H git add ZCppMain/ZMainXhtml.H git add ZCppMain/ZtCLoadDataBlock.H git add ZCppMain/ZtCMainChars.H git add ZCppMain/ZtCObjAVL.H git add ZCppMain/ZtCStringEx.H git add ZCppMain/ZtCTreeData.H
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
|
||||
#ifndef __ZTCARRAY_H__
|
||||
#define __ZTCARRAY_H__
|
||||
#ifndef __ZCPPMAIIN__ZTCARRAY_H__
|
||||
#define __ZCPPMAIIN__ZTCARRAY_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
@ -10,15 +10,17 @@
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
template< typename Type ,
|
||||
typename TypeArg=const Type&,
|
||||
template< typename TType ,
|
||||
typename TTypArg=const TType&,
|
||||
typename TSize =long
|
||||
>
|
||||
class ZtCArray /////////////////////////
|
||||
class ZtCArray //////////////////////////
|
||||
{
|
||||
public:
|
||||
typedef TType Type ;
|
||||
typedef TType TypeData;
|
||||
typedef TTypArg TypeArg ;
|
||||
typedef TSize TypeSize;
|
||||
typedef Type TypeData;
|
||||
typedef ZtCArray ZCArray ;
|
||||
public:
|
||||
class ZCIterator;
|
||||
@ -428,9 +430,8 @@ namespace ZNsMain
|
||||
|
||||
++VP_TypeArr;
|
||||
|
||||
/* ZtCTypeData 으로 인해서, AO_Functor 이 함수일 때 뿐이 아니라,
|
||||
operator() 연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다.
|
||||
*/
|
||||
/* ZtCTypeData 으로 인해서, AO_Functor 이 함수일 때뿐이 아니라,
|
||||
operator() 연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다. */
|
||||
}/*
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
}/*
|
||||
@ -459,10 +460,87 @@ namespace ZNsMain
|
||||
형태를 사용하면 좋을 것 같다. -- 2014-06-16 23:11:00
|
||||
|
||||
|
||||
ZCCheckRef::PassData() 으로 인해, 인수를 ZtCRef 클래스를 이용해 인수를 참조
|
||||
로 넘길 수 있게 되었다. -- 2021-03-10 16:56
|
||||
ZCCheckRef::PassData() 으로 인해, 인수를 ZtCRef 클래스를 이용해 인수를 참조
|
||||
로 넘길 수 있게 되었다. -- 2021-03-10 16:56
|
||||
|
||||
이제는 ZtCRef 과 ZCCheckRef 클래스 템플릿을 사용하면 된다. -- 2021-03-11 11:00
|
||||
이제는 ZtCRef 과 ZCCheckRef 클래스 템플릿을 사용하면 된다. -- 2021-03-11 11:00
|
||||
|
||||
이제는 ZftMCR() 과 ZftMCP() 을 사용하면 된다. -- 2025-08-07 17:55
|
||||
|
||||
■ 예제1 -- 2025-08-07 17:35
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "ZCppMain/ZtCArray.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
int main()
|
||||
{
|
||||
ZtCArray<int> myArray;
|
||||
|
||||
myArray.AddTail(10);
|
||||
myArray.AddTail(20);
|
||||
myArray.AddTail(30);
|
||||
myArray.AddTail(40);
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
}; CHelpObj VO_CHelpObj; cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
|
||||
myArray.IterElement(StFunctor ::ShowElement);
|
||||
myArray.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
myArray.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
myArray.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
myArray.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
myArray.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@ -474,9 +552,9 @@ namespace ZNsMain
|
||||
__for0(TypeSize, i, ml_UseSize)
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
*VP_TypeArr, ZCCheckRef::PassData(AO_TypeHelp)
|
||||
);
|
||||
(
|
||||
*VP_TypeArr, ZCCheckRef::PassData(AO_TypeHelp)
|
||||
);
|
||||
++VP_TypeArr; ///////////////////////////////////////
|
||||
}/*
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
@ -486,8 +564,7 @@ namespace ZNsMain
|
||||
|
||||
|
||||
template<typename TFunctor, typename TTypeHelp1, typename TTypeHelp2>
|
||||
void IterElement(TFunctor AO_Functor,
|
||||
TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2)
|
||||
void IterElement(TFunctor AO_Functor, TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2)
|
||||
{
|
||||
/*/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -531,8 +608,7 @@ namespace ZNsMain
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
}/*
|
||||
template<typename TFunctor, typename TTypeHelp1, typename TTypeHelp2>
|
||||
void IterElement(TFunctor AO_Functor,
|
||||
TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2)*/
|
||||
void IterElement(TFunctor AO_Functor, TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2)*/
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////////////////
|
||||
@ -540,32 +616,92 @@ namespace ZNsMain
|
||||
■ IterElement() 예제.
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCArray.H"
|
||||
#include "ZCppMain/ZtCArray.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std:: ZtCArray<int> myArray;
|
||||
typedef ZtCArray<int> CArray ;
|
||||
typedef CArray::IterEasy IterEasy;
|
||||
|
||||
myArray.AddTail(10);
|
||||
myArray.AddTail(20);
|
||||
myArray.AddTail(30);
|
||||
myArray.AddTail(40);
|
||||
|
||||
CArray VO_Array;
|
||||
|
||||
VO_Array.AddTail(10);
|
||||
VO_Array.AddTail(20);
|
||||
VO_Array.AddTail(30);
|
||||
VO_Array.AddTail(40);
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
}; CHelpObj VO_CHelpObj; cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
|
||||
|
||||
struct StFunctor
|
||||
{
|
||||
static void ShowElement(int ArgiValue){cout<<"# Value="<<ArgiValue<<endl;}
|
||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
||||
};
|
||||
struct StFunctor2
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj)
|
||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
||||
};
|
||||
struct StFunctor3
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
||||
};
|
||||
struct StFunctor4
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
||||
};
|
||||
struct StFunctor5
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
||||
};
|
||||
struct StFunctor6
|
||||
{
|
||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
||||
};
|
||||
|
||||
myArray.IterElement(StFunctor::ShowElement);
|
||||
VO_Array.IterElement(StFunctor ::ShowElement);
|
||||
VO_Array.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_Array.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
|
||||
IterEasy VH_Iter = VO_Array.ItHEasy();
|
||||
|
||||
__for1(int, i, VO_Array.size())
|
||||
{
|
||||
cout<<i<<"th value="<<VO_Array.ItD(VH_Iter)<<endl; VO_Array.ItNext(VH_Iter);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
■ -- 2014-06-16 23:34:00
|
||||
|
||||
■ -- 2025-08-07 18:03:00
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
@ -596,163 +732,77 @@ namespace ZNsMain
|
||||
const IterEasyID GetHeadIterEasyID() const{return (IterEasyID) mp_TypeArr ;}
|
||||
const IterEasyID GetTailIterEasyID() const{return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
IterEasyID ItHead() {return GetHeadIterEasyID();}
|
||||
IterEasyID ItTail() {return GetTailIterEasyID();}
|
||||
void MoveNextIter(Type*& APR_CType ) const{++APR_CType ;}
|
||||
void MoveNextIter(iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void MoveNextIter(IterEasyID& AI_IterEasyID) const
|
||||
{ MoveNextIter((Type*&)AI_IterEasyID); }
|
||||
void MoveNextIter(const Type*& APR_CType ) const{++APR_CType ;}
|
||||
void MoveNextIter(const iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void MoveNextIter(const IterEasyID& AI_IterEasyID)
|
||||
const{ MoveNextIter((const Type*&)AI_IterEasyID); }
|
||||
|
||||
const IterEasyID ItHead() const{return GetHeadIterEasyID();}
|
||||
const IterEasyID ItTail() const{return GetTailIterEasyID();}
|
||||
void MovePrevIter(Type*& APR_CType ) const{--APR_CType ;}
|
||||
void MovePrevIter(iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void MovePrevIter(IterEasyID& AI_IterEasyID) const
|
||||
{ MovePrevIter((Type*&)AI_IterEasyID); }
|
||||
void MovePrevIter(const Type*& APR_CType ) const{--APR_CType ;}
|
||||
void MovePrevIter(const iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void MovePrevIter(const IterEasyID& AI_IterEasyID)
|
||||
const{ MovePrevIter((const Type*&)AI_IterEasyID); }
|
||||
|
||||
|
||||
void MoveNextIter(Type*& APR_CType) const
|
||||
{
|
||||
++APR_CType;
|
||||
}/*
|
||||
void MoveNextIter(Type*& APR_CType) const*/
|
||||
|
||||
void MoveNextIter(iterator& ARR_CIterator) const
|
||||
{
|
||||
++ARR_CIterator;
|
||||
}/*
|
||||
void MoveNextIter(iterator& ARR_CIterator) const*/
|
||||
|
||||
void MoveNextIter(IterEasyID& AI_IterEasyID) const
|
||||
{
|
||||
MoveNextIter((Type*&)AI_IterEasyID);
|
||||
}/*
|
||||
void MoveNextIter(IterEasyID& AI_IterEasyID) const*/
|
||||
|
||||
void MoveNextIter(const Type*& APR_CType) const
|
||||
{
|
||||
++APR_CType;
|
||||
}/*
|
||||
void MoveNextIter(const Type*& APR_CType) const*/
|
||||
|
||||
void MoveNextIter(const iterator& ARR_CIterator) const
|
||||
{
|
||||
++ARR_CIterator;
|
||||
}/*
|
||||
void MoveNextIter(const iterator& ARR_CIterator) const*/
|
||||
|
||||
void MoveNextIter(const IterEasyID& AI_IterEasyID) const
|
||||
{
|
||||
MoveNextIter((const Type*&)AI_IterEasyID);
|
||||
}/*
|
||||
void MoveNextIter(const IterEasyID& AI_IterEasyID) const*/
|
||||
|
||||
|
||||
void MovePrevIter(Type*& APR_CType) const
|
||||
{
|
||||
--APR_CType;
|
||||
}/*
|
||||
void MovePrevIter(Type*& APR_CType) const*/
|
||||
|
||||
void MovePrevIter(iterator& ARR_CIterator) const
|
||||
{
|
||||
--ARR_CIterator;
|
||||
}/*
|
||||
void MovePrevIter(iterator& ARR_CIterator) const*/
|
||||
|
||||
void MovePrevIter(IterEasyID& AI_IterEasyID) const
|
||||
{
|
||||
MovePrevIter((Type*&)AI_IterEasyID);
|
||||
}/*
|
||||
void MovePrevIter(IterEasyID& AI_IterEasyID) const*/
|
||||
|
||||
void MovePrevIter(const Type*& APR_CType) const
|
||||
{
|
||||
--APR_CType;
|
||||
}/*
|
||||
void MovePrevIter(const Type*& APR_CType)*/
|
||||
|
||||
void MovePrevIter(const iterator& ARR_CIterator) const
|
||||
{
|
||||
--ARR_CIterator;
|
||||
}/*
|
||||
void MovePrevIter(const iterator& ARR_CIterator) const*/
|
||||
|
||||
void MovePrevIter(const IterEasyID& AI_IterEasyID) const
|
||||
{
|
||||
MovePrevIter((const Type*&)AI_IterEasyID);
|
||||
}/*
|
||||
void MovePrevIter(const IterEasyID& AI_IterEasyID) const*/
|
||||
|
||||
|
||||
Type& GetDataInIter(Type* AP_CType)
|
||||
{
|
||||
return *AP_CType;
|
||||
}/*
|
||||
Type& GetDataInIter(Type* AP_CType)*/
|
||||
|
||||
Type& GetDataInIter(iterator& ARR_CIterator)
|
||||
{
|
||||
return *ARR_CIterator;
|
||||
}/*
|
||||
Type& GetDataInIter(iterator& ARR_CIterator)*/
|
||||
|
||||
Type& GetDataInIter(IterEasyID AI_IterEasyID)
|
||||
{
|
||||
return *(Type*)AI_IterEasyID;
|
||||
}/*
|
||||
Type& GetDataInIter(IterEasyID AI_IterEasyID)*/
|
||||
|
||||
const Type& GetDataInIter(const Type* AP_CType) const
|
||||
{
|
||||
return *AP_CType;
|
||||
}/*
|
||||
const Type& GetDataInIter(const Type* AP_CType) const*/
|
||||
|
||||
const Type& GetDataInIter(const iterator& ARR_CIterator) const
|
||||
{
|
||||
return *ARR_CIterator;
|
||||
}/*
|
||||
const Type& GetDataInIter(const iterator& ARR_CIterator) const*/
|
||||
Type& GetDataInIter(Type* AP_CType ){return *AP_CType ;}
|
||||
Type& GetDataInIter(iterator& ARR_CIterator){return *ARR_CIterator ;}
|
||||
Type& GetDataInIter(IterEasyID AI_IterEasyID){return *(Type*)AI_IterEasyID;}
|
||||
|
||||
const Type& GetDataInIter(const Type* AP_CType ) const{return *AP_CType;}
|
||||
const Type& GetDataInIter(const iterator& ARR_CIterator) const{return *ARR_CIterator;}
|
||||
const Type& GetDataInIter(const IterEasyID AI_IterEasyID) const
|
||||
{
|
||||
return *(const Type*)AI_IterEasyID;
|
||||
}/*
|
||||
const Type& GetDataInIter(const IterEasyID AI_IterEasyID) const*/
|
||||
{ return *(const Type*)AI_IterEasyID; }
|
||||
|
||||
|
||||
Type& GetDataInIter(Type* AP_Type, TypeSize AI_FarNum)
|
||||
{
|
||||
return *(AP_Type + AI_FarNum);
|
||||
}/*
|
||||
Type& GetDataInIter(Type* AP_Type, TypeSize AI_FarNum)*/
|
||||
|
||||
Type& GetDataInIter(iterator& ARR_CIterator, TypeSize AI_FarNum)
|
||||
{
|
||||
return *(ARR_CIterator+AI_FarNum);
|
||||
}/*
|
||||
Type& GetDataInIter(iterator& ARR_CIterator, TypeSize AI_FarNum)*/
|
||||
|
||||
Type& GetDataInIter(Type* AP_Type , TypeSize AI_FarNum)
|
||||
{ return *(AP_Type + AI_FarNum) ; }
|
||||
Type& GetDataInIter(iterator& ARR_CIterator , TypeSize AI_FarNum)
|
||||
{ return *(ARR_CIterator+AI_FarNum) ; }
|
||||
Type& GetDataInIter(IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum)
|
||||
{
|
||||
return GetDataInIter((Type*)ARRI_IterEasyID, AI_FarNum);
|
||||
}/*
|
||||
Type& GetDataInIter(IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum)*/
|
||||
|
||||
|
||||
const Type& GetDataInIter(const Type* AP_Type, TypeSize AI_FarNum) const
|
||||
{
|
||||
return *(AP_Type + AI_FarNum);
|
||||
}/*
|
||||
const Type& GetDataInIter(const Type* AP_Type, TypeSize AI_FarNum) const*/
|
||||
{ return GetDataInIter((Type*)ARRI_IterEasyID, AI_FarNum); }
|
||||
|
||||
const Type& GetDataInIter(const Type* AP_Type , TypeSize AI_FarNum) const
|
||||
{ return *(AP_Type + AI_FarNum); }
|
||||
const Type& GetDataInIter(iterator& ARR_CIterator, TypeSize AI_FarNum) const
|
||||
{
|
||||
return *(ARR_CIterator+AI_FarNum);
|
||||
}/*
|
||||
const Type& GetDataInIter(iterator& ARR_CIterator, TypeSize AI_FarNum) const*/
|
||||
|
||||
{ return *(ARR_CIterator+AI_FarNum); }
|
||||
const Type& GetDataInIter(const IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum) const
|
||||
{
|
||||
return GetDataInIter((const Type*)ARRI_IterEasyID, AI_FarNum);
|
||||
}/*
|
||||
const Type& GetDataInIter(const IterEasyID ARRI_IterEasyID, TypeSize AI_FarNum) const*/
|
||||
{ return GetDataInIter((const Type*)ARRI_IterEasyID, AI_FarNum); }
|
||||
|
||||
|
||||
// 아래 ItD() 함수는 GetDataInIter() 를 짧게 줄인 것이다.
|
||||
Type* ItHEasy (){return mp_TypeArr ;}
|
||||
Type* ItTEasy (){return mp_TypeArr+ml_UseSize-1 ;}
|
||||
IterEasyID ItHID(){return (IterEasyID) mp_TypeArr ;}
|
||||
IterEasyID ItTID(){return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
const Type* ItHEasy () const{return mp_TypeArr ;}
|
||||
const Type* ItTEasy () const{return mp_TypeArr+ml_UseSize-1 ;}
|
||||
const IterEasyID ItHID() const{return (IterEasyID) mp_TypeArr ;}
|
||||
const IterEasyID ItTID() const{return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
void ItNext(Type*& APR_CType ) const{++APR_CType ;}
|
||||
void ItNext(iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void ItNext(IterEasyID& AI_IterEasyID) const
|
||||
{ ItNext((Type*&)AI_IterEasyID); }
|
||||
void ItNext(const Type*& APR_CType ) const{++APR_CType ;}
|
||||
void ItNext(const iterator& ARR_CIterator) const{++ARR_CIterator;}
|
||||
void ItNext(const IterEasyID& AI_IterEasyID)
|
||||
const{ ItNext((const Type*&)AI_IterEasyID); }
|
||||
|
||||
void ItPrev(Type*& APR_CType ) const{--APR_CType ;}
|
||||
void ItPrev(iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void ItPrev(IterEasyID& AI_IterEasyID) const
|
||||
{ ItPrev((Type*&)AI_IterEasyID); }
|
||||
void ItPrev(const Type*& APR_CType ) const{--APR_CType ;}
|
||||
void ItPrev(const iterator& ARR_CIterator) const{--ARR_CIterator;}
|
||||
void ItPrev(const IterEasyID& AI_IterEasyID)
|
||||
const{ ItPrev((const Type*&)AI_IterEasyID); }
|
||||
|
||||
Type& ItD(Type* AP_Type ){return GetDataInIter(AP_Type );}
|
||||
Type& ItD(iterator& ARR_CIterator ){return GetDataInIter(ARR_CIterator );}
|
||||
@ -770,11 +820,11 @@ namespace ZNsMain
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename Type ,
|
||||
typename TypeArg=const Type&,
|
||||
template< typename TType ,
|
||||
typename TTypArg=const TType&,
|
||||
typename TSize =long
|
||||
>
|
||||
class ZtCArray ////////////////////////*/
|
||||
class ZtCArray /////////////////////////*/
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
@ -787,21 +837,22 @@ namespace ZNsMain
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ class ZtCArrayFixed<> 는 배열 메모리를 자체 할당하지 않고,
|
||||
■ class ZtCArrayOut<> 는 배열 메모리를 자체 할당하지 않고,
|
||||
이미 외부에서 new 나 정적으로 선언되어 있는 배열을 사용한다.
|
||||
따라서 ZtCArrayFixed<> 내부에서 임의로 배열 크기를 조절할 수 없다.
|
||||
따라서 ZtCArrayOut<> 내부에서 임의로 배열 크기를 조절할 수 없다.
|
||||
|
||||
-- 2011-08-05 20:40:00
|
||||
|
||||
////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template< typename Type,
|
||||
template< typename TType,
|
||||
typename TSize=long
|
||||
>
|
||||
class ZtCArrayFixed ///////////
|
||||
class ZtCArrayOut /////////////
|
||||
{
|
||||
public:
|
||||
typedef Type TypeData;
|
||||
typedef TType Type ;
|
||||
typedef Type TypeData;
|
||||
public:
|
||||
typedef const Type* const_iterator;
|
||||
typedef Type* iterator;
|
||||
@ -810,11 +861,11 @@ namespace ZNsMain
|
||||
TSize ml_UseSize;
|
||||
public:
|
||||
|
||||
ZtCArrayFixed()
|
||||
ZtCArrayOut()
|
||||
{
|
||||
Init(0, 0);
|
||||
}
|
||||
ZtCArrayFixed(TypeData* AP_DataArr, TSize AL_ArrSize)
|
||||
ZtCArrayOut(TypeData* AP_DataArr, TSize AL_ArrSize)
|
||||
{
|
||||
Init(AP_DataArr, AL_ArrSize);
|
||||
}
|
||||
@ -985,13 +1036,134 @@ namespace ZNsMain
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename Type,
|
||||
template< typename TType,
|
||||
typename TSize=long
|
||||
>
|
||||
class ZtCArrayFixed /////////*/
|
||||
class ZtCArrayOut ///////////*/
|
||||
|
||||
|
||||
template< typename TTypeOjb, ZTypLong ATI_Length=1
|
||||
>
|
||||
class ZtCArrayStack //////////////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TTypeOjb TypeData ;
|
||||
typedef ZTypLong TypeSize ;
|
||||
public :
|
||||
enum{ EAllSize=ATI_Length } ;
|
||||
private:
|
||||
TypeData moa_Data[ATI_Length] ;
|
||||
TypeSize ml_UseSize ; // moa_Data 의 실제 사용 길이
|
||||
public :
|
||||
|
||||
ZtCArrayStack(TypeSize AL_StackSize)
|
||||
{
|
||||
ml_UseSize = 0;
|
||||
}/*
|
||||
ZtCArrayStack(TypeSize AL_StackSize)*/
|
||||
|
||||
ZtCArrayStack& operator=(const ZtCArrayStack& rhs)
|
||||
{
|
||||
clear(); return (*this)(rhs.data(),rhs.size());
|
||||
}/*
|
||||
ZtCArrayStack& operator=(const ZtCArrayStack& rhs)*/
|
||||
|
||||
ZtCArrayStack& operator()(const TypeData* AP_Data, TypeSize AL_Length)
|
||||
{
|
||||
if(AL_Length<1){ return *this; }
|
||||
|
||||
if(AL_Length+ml_UseSize > EAllSize)
|
||||
{
|
||||
AL_Length = EAllSize - ml_UseSize;
|
||||
|
||||
if(AL_Length<1) return *this;
|
||||
}/*
|
||||
if(AL_Length+ml_UseSize > EAllSize)*/
|
||||
|
||||
TypeData* VP_Dest= moa_Data+ml_UseSize; const
|
||||
TypeData* VP_Src = AP_Data ;
|
||||
|
||||
ml_UseSize += AL_Length ;
|
||||
|
||||
while(--AL_Length>=0)
|
||||
*VP_Dest++ = *VP_Src++ ;
|
||||
|
||||
*VP_Dest=0; return *this;
|
||||
}/*
|
||||
ZtCArrayStack& operator()(const TypeData* AP_Data, TypeSize AL_Length)*/
|
||||
|
||||
|
||||
TypeSize GetSize() const
|
||||
{
|
||||
return ml_UseSize;
|
||||
}/*
|
||||
TypeSize GetSize() const*/
|
||||
|
||||
TypeSize GetEmptySize() const
|
||||
{
|
||||
return EAllSize - ml_UseSize ;
|
||||
}/*
|
||||
TypeSize GetEmptySize() const*/
|
||||
|
||||
TypeData* GetData()
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
TypeData* GetData()*/
|
||||
|
||||
const TypeData* GetData() const
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
const TypeData* GetData() const*/
|
||||
|
||||
|
||||
void MemCopy(TypeData* AP_Data, TypeSize AL_Length)
|
||||
{
|
||||
if(AL_Length<1 || ml_UseSize<1)
|
||||
return;
|
||||
if(AL_Length>=ml_UseSize )
|
||||
::memcpy(AP_Data, moa_Data, sizeof(TypeData)*ml_UseSize);
|
||||
else
|
||||
::memcpy(AP_Data, moa_Data, sizeof(TypeData)*AL_Length );
|
||||
//else
|
||||
}/*
|
||||
void MemCopy(TypeData* AP_Data, TypeSize AL_Length)*/
|
||||
|
||||
|
||||
TypeSize size() const
|
||||
{
|
||||
return ml_UseSize;
|
||||
}/*
|
||||
TypeSize size() const*/
|
||||
|
||||
TypeData* data()
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
TypeData* data()*/
|
||||
|
||||
const TypeData* data() const
|
||||
{
|
||||
return moa_Data;
|
||||
}/*
|
||||
const TypeData* data() const*/
|
||||
|
||||
void clear()
|
||||
{
|
||||
// add codes
|
||||
}/*
|
||||
void clear()*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TTypeOjb, typename ZTypLong ATI_Length=1
|
||||
>
|
||||
class ZtCArrayStack /////////////////////////////////////*/
|
||||
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
#endif //__ZTCARRAY_H__
|
||||
#endif //__ZCPPMAIIN__ZTCARRAY_H__
|
||||
|
Reference in New Issue
Block a user