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:
360
ZCppMain/ZMainAVL.H
Normal file
360
ZCppMain/ZMainAVL.H
Normal file
@ -0,0 +1,360 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIN_ZMAINAVL_H__
|
||||
#define __ZCPPMAIN_ZMAINAVL_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsEnum
|
||||
{
|
||||
|
||||
enum ZEAVL_INSERT
|
||||
{
|
||||
ZEAVL_INSERT_RIGHT = +1,
|
||||
ZEAVL_INSERT_OK = 0, /* <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̴<EFBFBD>. */
|
||||
ZEAVL_INSERT_LEFT = -1,
|
||||
ZEAVL_INSERT_NONE = -2 /* <20><><EFBFBD><EFBFBD> <20><> <20><> */
|
||||
};/*
|
||||
enum ZEAVL_INSERT*/
|
||||
|
||||
}/*
|
||||
namespace ZNsEnum*/
|
||||
|
||||
|
||||
namespace ZNsInterface
|
||||
{
|
||||
|
||||
template<typename TypeArg> class ZtCAVL_BASE
|
||||
{
|
||||
protected:
|
||||
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node)
|
||||
{
|
||||
}/*
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node) */
|
||||
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node)
|
||||
{
|
||||
}/*
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node) */
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TypeArg> class ZtCAVL_BASE*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> <20>Ʒ<EFBFBD> ZtCAVL_NodeBase<> <20><> <20><> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD> ZtCAVL_BASE<> <20><> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20>μ<EFBFBD><CEBC><EFBFBD> <20>ϳ<EFBFBD> <20>پ<EFBFBD><D9BE><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><> <20>ִ<EFBFBD>. ZtCAVL_BASE<> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD>
|
||||
<20>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD><EFBFBD> <20><> <20>ְ<EFBFBD> <20><> <20><><EFBFBD>̴<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ZtCAVL_BASE<> <20><> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD>
|
||||
<20><>, AP_Node->OnEqual() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ZtCAVL_NodeBase<> <20><> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD> ȣ<><C8A3><EFBFBD><EFBFBD> <20><>
|
||||
<20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, ZtCAVL_NodeBase<> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><F0BFA1BC><EFBFBD> ȣ<><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>. <20><> <20><><EFBFBD><EFBFBD>
|
||||
<20><> <20>̷<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ߴµ<DFB4>, <20>Ƹ<EFBFBD> ZtCAVL_Multi_BASE<> <20><>
|
||||
ZtCAVL_Multi_NodeBase<> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ҷ<EFBFBD><D2B7><EFBFBD> <20><EFBFBD><D7B7><EFBFBD> <20><><EFBFBD>̴<EFBFBD>.
|
||||
|
||||
-- 2012-09-03 19:20:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TNodeArg> class ZtCAVL_NodeBase
|
||||
{
|
||||
protected:
|
||||
|
||||
void OnEqual(TNodeArg AR_Data)
|
||||
{
|
||||
}/*
|
||||
void OnEqual(TNodeArg AR_Data)*/
|
||||
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key)
|
||||
{
|
||||
}/*
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key)*/
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TNodeArg> class ZtCAVL_NodeBase*/
|
||||
|
||||
|
||||
template<typename TypeArg> class ZtCAVL_Multi_BASE
|
||||
{
|
||||
protected:
|
||||
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node)
|
||||
{
|
||||
AP_Node->OnEqual(AR_Data);
|
||||
}/*
|
||||
template<typename TNode> void OnEqual(TypeArg AR_Data, TNode* AP_Node) */
|
||||
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node)
|
||||
{
|
||||
AP_Node->OnEqualKey(AR_Key);
|
||||
}/*
|
||||
template<typename TKey, typename TNode> void OnEqualKey(TKey AR_Key, TNode* AP_Node) */
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TypeArg> class ZtCAVL_Multi_BASE*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> ZtCAVL_Multi_NodeBase template <20><> multi set/map <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD>,
|
||||
ZtCAVL_Multi_NodeBase::TypeEqual <20>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><>.
|
||||
|
||||
class CTypeMy
|
||||
{
|
||||
public:
|
||||
typedef CLargeAVL<some param> CLargeMap;
|
||||
typedef typename CLargeMap::ZCNode::TypeEqual TypeEqual;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////*/
|
||||
|
||||
template< typename TNodeArg, typename TEqualList
|
||||
>
|
||||
class ZtCAVL_Multi_NodeBase ////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TEqualList TypeEqual;
|
||||
protected:
|
||||
TEqualList mo_EqualList;
|
||||
public :
|
||||
|
||||
void OnEqual(TNodeArg AR_Data)
|
||||
{
|
||||
mo_EqualList.push_back(AR_Data);
|
||||
}/*
|
||||
void OnEqual(TNodeArg AR_Data)*/
|
||||
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key)
|
||||
{
|
||||
mo_EqualList.push_back(AR_Key);
|
||||
}/*
|
||||
template<typename TKey> void OnEqualKey(TKey AR_Key) */
|
||||
|
||||
const TEqualList& GetCEqualList() const
|
||||
{
|
||||
return mo_EqualList;
|
||||
}/*
|
||||
const TEqualList& GetCEqualList() const*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TNodeArg, typename TEqualList
|
||||
>
|
||||
class ZtCAVL_Multi_NodeBase //////////////////*/
|
||||
|
||||
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> AVL Ʈ<><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ÿ Ÿ<><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20>ٷ<EFBFBD><D9B7>
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD> <20><><EFBFBD>ø<EFBFBD><C3B8>̴<EFBFBD>.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TData> class ZtCAVL_PtrLongData
|
||||
{
|
||||
public :
|
||||
typedef TData* TypeData;
|
||||
protected:
|
||||
TData* mp_CData;
|
||||
public :
|
||||
|
||||
ZtCAVL_PtrLongData()
|
||||
{
|
||||
mp_CData=0;
|
||||
}/*
|
||||
ZtCAVL_PtrLongData()*/
|
||||
|
||||
TData* GetDataPtr() const
|
||||
{
|
||||
return mp_CData;
|
||||
}/*
|
||||
TData* GetDataPtr() const*/
|
||||
|
||||
void SetDataPtr(TData* AP_CData)
|
||||
{
|
||||
mp_CData=AP_CData;
|
||||
}/*
|
||||
void SetDataPtr(TData* AP_CData)*/
|
||||
|
||||
operator ZNsMain::ZTypIntPtr() const
|
||||
{
|
||||
return mp_CData;
|
||||
}/*
|
||||
operator ZNsMain::ZTypIntPtr() const*/
|
||||
|
||||
|
||||
ZtCAVL_PtrLongData& operator=(const ZtCAVL_PtrLongData& rhs)
|
||||
{
|
||||
mp_CData=rhs.mp_CData; return *this;
|
||||
}/*
|
||||
ZtCAVL_PtrLongData& operator=(const ZtCAVL_PtrLongData& rhs)*/
|
||||
|
||||
ZtCAVL_PtrLongData& operator=(const TData* AP_CData)
|
||||
{
|
||||
mp_CData=const_cast<TData*>(AP_CData); return *this;
|
||||
}/*
|
||||
ZtCAVL_PtrLongData& operator=(const TData* AP_CData)*/
|
||||
|
||||
bool operator==(const ZtCAVL_PtrLongData& rhs) const{return mp_CData==rhs.mp_CData;}
|
||||
bool operator> (const ZtCAVL_PtrLongData& rhs) const{return (ZNsMain::ZTypIntPtr)mp_CData > (ZNsMain::ZTypIntPtr)rhs.mp_CData;}
|
||||
bool operator< (const ZtCAVL_PtrLongData& rhs) const{return (ZNsMain::ZTypIntPtr)mp_CData < (ZNsMain::ZTypIntPtr)rhs.mp_CData;}
|
||||
|
||||
bool operator==(const TData* AP_CData) const{return mp_CData==AP_CData;}
|
||||
bool operator> (const TData* AP_CData) const{return (ZNsMain::ZTypIntPtr)mp_CData > (ZNsMain::ZTypIntPtr)AP_CData;}
|
||||
bool operator< (const TData* AP_CData) const{return (ZNsMain::ZTypIntPtr)mp_CData < (ZNsMain::ZTypIntPtr)AP_CData;}
|
||||
|
||||
protected:
|
||||
};/*
|
||||
template<typename TData> class ZtCAVL_PtrLongData*/
|
||||
|
||||
|
||||
/* int, long <20><><EFBFBD><EFBFBD> <20><EFBFBD><F1B1B3BF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> primitive Ÿ<><C5B8><EFBFBD>̳<EFBFBD> object <20><>
|
||||
key <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD>쿡, <20>ش<EFBFBD> AVL Ʈ<><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8> <20>ٷ<EFBFBD>
|
||||
<20><> <20><> <20>ֵ<EFBFBD><D6B5><EFBFBD> wrap <20><> Ŭ<><C5AC><EFBFBD><EFBFBD> <20><><EFBFBD>ø<EFBFBD> */
|
||||
|
||||
template< typename TKeyData ,
|
||||
typename TMainData,
|
||||
typename TKeyArg =const TKeyData &,
|
||||
typename TMainArg=const TMainData&
|
||||
>
|
||||
class ZtCAVL_KeyData //////////////////////////
|
||||
{
|
||||
public :
|
||||
typedef TKeyData TypeKey ;
|
||||
typedef TMainData TypeData;
|
||||
protected:
|
||||
TKeyData mo_CKeyData ; mutable
|
||||
TMainData mo_CMainData;
|
||||
public :
|
||||
|
||||
ZtCAVL_KeyData(){}
|
||||
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg)
|
||||
{
|
||||
mo_CKeyData=AO_TKeyArg;
|
||||
}/*
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg)*/
|
||||
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg, TMainArg AO_TMainArg)
|
||||
{
|
||||
mo_CKeyData =AO_TKeyArg ;
|
||||
mo_CMainData=AO_TMainArg;
|
||||
}/*
|
||||
ZtCAVL_KeyData(TKeyArg AO_TKeyArg, TMainArg AO_TMainArg)*/
|
||||
|
||||
TKeyArg GetCKeyData () const{return mo_CKeyData ;}
|
||||
TMainArg GetCMainData () const{return mo_CMainData;}
|
||||
TMainData& GetCMainDataRef() const{return mo_CMainData;}
|
||||
|
||||
void SetCMainData(TMainArg AO_TRealArg) const
|
||||
{
|
||||
mo_CMainData=AO_TRealArg;
|
||||
}/*
|
||||
void SetCMainData(TMainArg AO_TRealArg) const*/
|
||||
|
||||
void SetKeyData(TKeyArg AO_TKeylArg)
|
||||
{
|
||||
mo_CKeyData=AO_TKeylArg;
|
||||
}/*
|
||||
void SetKeyData(TKeyArg AO_TKeylArg)*/
|
||||
|
||||
bool operator==(const ZtCAVL_KeyData& rhs) const{return mo_CKeyData==rhs.mo_CKeyData;}
|
||||
bool operator> (const ZtCAVL_KeyData& rhs) const{return mo_CKeyData> rhs.mo_CKeyData;}
|
||||
bool operator< (const ZtCAVL_KeyData& rhs) const{return mo_CKeyData< rhs.mo_CKeyData;}
|
||||
|
||||
bool operator==(TKeyArg AO_TPrimitive) const{return mo_CKeyData==AO_TPrimitive;}
|
||||
bool operator> (TKeyArg AO_TPrimitive) const{return mo_CKeyData> AO_TPrimitive;}
|
||||
bool operator< (TKeyArg AO_TPrimitive) const{return mo_CKeyData< AO_TPrimitive;}
|
||||
|
||||
ZtCAVL_KeyData& operator=(const ZtCAVL_KeyData& rhs)
|
||||
{
|
||||
if(this==&rhs) return *this;
|
||||
|
||||
mo_CKeyData =rhs.mo_CKeyData ;
|
||||
mo_CMainData=rhs.mo_CMainData; return *this;
|
||||
}/*
|
||||
ZtCAVL_KeyData& operator=(const ZtCAVL_KeyData& rhs)*/
|
||||
|
||||
ZtCAVL_KeyData& operator=(TKeyArg AO_TPrimitive)
|
||||
{
|
||||
mo_CKeyData=AO_TPrimitive; return *this;
|
||||
}/*
|
||||
ZtCAVL_KeyData& operator=(TKeyArg AO_TPrimitive)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TKeyData ,
|
||||
typename TMainData,
|
||||
typename TKeyArg =const TKeyData &,
|
||||
typename TMainArg=const TMainData&
|
||||
>
|
||||
class ZtCAVL_KeyData ////////////////////////*/
|
||||
|
||||
}/*
|
||||
namespace ZNsInterface*/
|
||||
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> mulit set <20><><EFBFBD><EFBFBD> Ȱ<><C8B0><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
||||
|
||||
ZNsMain::CLargeAVL ///////////////////////////////////
|
||||
<
|
||||
int,
|
||||
int,
|
||||
ZNsMain::ZNsInterface::ZtCAVL_Multi_BASE<int>,
|
||||
ZNsMain::ZNsInterface::ZtCAVL_Multi_NodeBase<int, ZNsMain::ZtCDoubleList<int> >
|
||||
>
|
||||
VO_CLargeAvl_Multi; //////////////////////////////////
|
||||
|
||||
VO_CLargeAvl_Multi.AddData(1);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
VO_CLargeAvl_Multi.AddData(2);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
namespace NsType
|
||||
{
|
||||
|
||||
template< typename TStringData, //= ZNsMain::ZtCStringBase<char> ,
|
||||
typename TEnvVar , //= ZNsMain::ZNsCGI::ZNsBase::ZtCEnvVar<TStringData>,
|
||||
typename TEnvVarSet //= ZNsMain::ZtCObjAVL<TEnvVar>
|
||||
>
|
||||
class ZtCTypeEnvVarSet /*############################################################*/
|
||||
{
|
||||
public:
|
||||
typedef TStringData ZCStringData;
|
||||
typedef TEnvVar ZCEnvVar ;
|
||||
typedef TEnvVarSet ZCEnvVarSet ;
|
||||
typedef typename ZCEnvVarSet ::ZCNode ZCEnvVarNode;
|
||||
typedef typename ZCStringData::ZCMainChars ZCMainChars ;
|
||||
typedef typename ZCStringData::TypeChar TypeChar ;
|
||||
typedef typename ZCStringData::TypeLength TypeLength ;
|
||||
public:
|
||||
};/*
|
||||
template< typename TStringData, //= ZNsMain::ZtCStringBase<char> ,
|
||||
typename TEnvVar , //= ZNsMain::ZNsCGI::ZNsBase::ZtCEnvVar<TStringData>,
|
||||
typename TEnvVarSet //= NsCPP::ZtCObjAVL<TEnvVar>
|
||||
>
|
||||
class ZtCTypeEnvVarSet /*############################################################*/
|
||||
|
||||
}/*
|
||||
namespace NsType*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain */
|
||||
|
||||
|
||||
#endif // __ZCPPMAIN_ZMAINAVL_H__
|
File diff suppressed because it is too large
Load Diff
7194
ZCppMain/ZMainHeadEx.H
Normal file
7194
ZCppMain/ZMainHeadEx.H
Normal file
File diff suppressed because it is too large
Load Diff
38
ZCppMain/ZMainXhtml.H
Normal file
38
ZCppMain/ZMainXhtml.H
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIIN__ZMAINXHTML_H__
|
||||
#define __ZCPPMAIIN__ZMAINXHTML_H__
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
template<typename TStringData> TStringData& ZftConvertXhtml(TStringData& ARR_CString)
|
||||
{
|
||||
/* <20><><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8> <20>״<EFBFBD><D7B4><EFBFBD> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>
|
||||
HTML <20>±<C2B1> ȥ<><C8A5><EFBFBD><EFBFBD> <20><> <20>ִµ<D6B4> <20≯<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD><DAB5>Ѵ<EFBFBD>.
|
||||
*/
|
||||
return ARR_CString.
|
||||
Replace("&" ,"&" ). Replace("<" ,"<" ).
|
||||
Replace(">" ,">" ). Replace(" " ," " ).
|
||||
Replace("\n","<br />" );
|
||||
}/*
|
||||
template<typename TStringData> static TStringData& ConvertXhtml(TStringData& ARR_CString) */
|
||||
|
||||
template<typename TStringData> TStringData& ZftConvertXhtmlAtt(TStringData& ARR_CString)
|
||||
{
|
||||
// X(H)TML <20><> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD><DAB5>Ѵ<EFBFBD>.
|
||||
|
||||
return ARR_CString.
|
||||
Replace("&" ,"&" ). Replace("<" ,"<" ).
|
||||
Replace(">" ,">" ). Replace("\"",""" ).
|
||||
Replace("\r","
" ). Replace("\n","
" );
|
||||
}/*
|
||||
template<typename TStringData> TStringData& ZftConvertXhtmlAtt(TStringData& ARR_CString) */
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
#endif // __ZCPPMAIIN__ZMAINXHTML_H__
|
@ -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)*/
|
||||
}/*
|
||||
@ -464,6 +465,83 @@ namespace ZNsMain
|
||||
|
||||
이제는 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;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
typedef ZNsMain::
|
||||
@ -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,31 +616,91 @@ 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();}
|
||||
|
||||
const IterEasyID ItHead() const{return GetHeadIterEasyID();}
|
||||
const IterEasyID ItTail() const{return GetTailIterEasyID();}
|
||||
|
||||
|
||||
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(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(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*/
|
||||
{ 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); }
|
||||
|
||||
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(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*/
|
||||
{ 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); }
|
||||
|
||||
|
||||
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,20 +837,21 @@ 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 TType Type ;
|
||||
typedef Type TypeData;
|
||||
public:
|
||||
typedef const Type* const_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__
|
||||
|
1862
ZCppMain/ZtCLoadDataBlock.H
Normal file
1862
ZCppMain/ZtCLoadDataBlock.H
Normal file
File diff suppressed because it is too large
Load Diff
7212
ZCppMain/ZtCMainChars.H
Normal file
7212
ZCppMain/ZtCMainChars.H
Normal file
File diff suppressed because it is too large
Load Diff
2483
ZCppMain/ZtCObjAVL.H
Normal file
2483
ZCppMain/ZtCObjAVL.H
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
8276
ZCppMain/ZtCStringEx.H
Normal file
8276
ZCppMain/ZtCStringEx.H
Normal file
File diff suppressed because it is too large
Load Diff
993
ZCppMain/ZtCTreeData.H
Normal file
993
ZCppMain/ZtCTreeData.H
Normal file
@ -0,0 +1,993 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIN__ZCTREEDATA_H__
|
||||
#define __ZCPPMAIN__ZCTREEDATA_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZtCObjList.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsView
|
||||
{
|
||||
|
||||
template< typename TypeData, typename TypeSize=int
|
||||
>
|
||||
class ZtCViewTreeData ////////////////////////////
|
||||
{
|
||||
private:
|
||||
|
||||
void ShowDepth(TypeSize AI_Depth)
|
||||
{
|
||||
__for1(TypeSize, i, AI_Depth) cout<<" ";
|
||||
}/*
|
||||
void ShowDepth(TypeSize AI_Depth)*/
|
||||
|
||||
public :
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnDataStart(TypeSize AI_Depth)
|
||||
{
|
||||
ShowDepth(AI_Depth); cout<<"<EFBFBD><EFBFBD> OnDataStart:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnDataBody(TypeData& AR_TypeData, TypeSize AI_Depth, TypeSize AI_Index=0)
|
||||
{
|
||||
ShowDepth(AI_Depth); cout<<" <20><> Index="<<AI_Index<<": "<<AR_TypeData<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnDataClose(TypeSize AI_Depth)
|
||||
{
|
||||
ShowDepth(AI_Depth); cout<<"<EFBFBD><EFBFBD> OnDataClose:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeStart(TypeSize AI_Depth, TypeSize AI_NodeCnt)
|
||||
{
|
||||
if(AI_NodeCnt<1){ return ZNsMain::ZNsEnum::ZERun_OK; }
|
||||
|
||||
ShowDepth(AI_Depth); cout<<"<EFBFBD><EFBFBD> OnSubNodeStart:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(TypeSize AI_Depth, TypeSize AI_NodeCnt)
|
||||
{
|
||||
if(AI_NodeCnt<1){ return ZNsMain::ZNsEnum::ZERun_OK; }
|
||||
|
||||
ShowDepth(AI_Depth); cout<<"<EFBFBD><EFBFBD> OnSubNodeClose:"<<endl;
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(TypeSize AI_Depth, TypeSize AI_NodeCnt)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TypeData, typename TypeSize=int
|
||||
>
|
||||
class ZtCViewTreeData //////////////////////////*/
|
||||
|
||||
}/*
|
||||
namespace ZNsView*/
|
||||
|
||||
|
||||
namespace ZNsType
|
||||
{
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> class ZtCTypeTreeData <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD> <20><><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD> <20><> <20>ٸ<EFBFBD> <20><><EFBFBD>ø<EFBFBD>(list <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD> <20><><EFBFBD>ø<EFBFBD>)<29><>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20>̰<EFBFBD><CCB0><EFBFBD> ZtCTreeData<> <20><><EFBFBD><EFBFBD> Ȱ<><C8B0><EFBFBD>ϴ<EFBFBD> <20>κ<EFBFBD><CEBA><EFBFBD> <20>Ʒ<EFBFBD>ó<EFBFBD><C3B3>
|
||||
|
||||
typedef typename TTypeTreeData::template ZtCTypeClass<ZCNode1>::TypeData ZCNode1List;
|
||||
typedef typename TTypeTreeData::template ZtCTypeClass<ZCNode2>::TypeData ZCNode2List;
|
||||
|
||||
<20>ټ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>δ<EFBFBD>.
|
||||
|
||||
-- 2011-11-01 14:39:00
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TTypeSize=long> class ZtCTypeTreeData
|
||||
{
|
||||
public:
|
||||
typedef TTypeSize TypeSize;
|
||||
public:
|
||||
|
||||
template< typename TType ,
|
||||
typename TTypeArg =const TType& ,
|
||||
typename TTypeAlloc=ZNsMain::ZCAllocator,
|
||||
typename TTypeInit =ZNsMain::ZtCInit<TType>
|
||||
>
|
||||
class ZtCTypeClass /////////////////////////////////
|
||||
{
|
||||
public:
|
||||
typedef TTypeAlloc TypeAlloc;
|
||||
typedef TTypeInit TypeInit ;
|
||||
public:
|
||||
typedef ZNsMain::ZtCObjList
|
||||
<TType, TTypeArg, TTypeAlloc, TTypeInit, TTypeSize>
|
||||
TypeList; /////////////////
|
||||
public:
|
||||
};/*
|
||||
template< typename TType ,
|
||||
typename TTypeArg =const TType& ,
|
||||
typename TTypeAlloc=ZNsMain::ZCAllocator,
|
||||
typename TTypeInit =ZNsMain::ZtCInit<TType>
|
||||
>
|
||||
class ZtCTypeClass ///////////////////////////////*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TTypeSize=long> class ZtCTypeTreeData*/
|
||||
|
||||
}/*
|
||||
namespace ZNsType*/
|
||||
|
||||
|
||||
template< typename TType ,
|
||||
typename TTypeInit =ZNsMain::ZtCInit<TType>,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
class ZtCTreeData /*###########################################*/
|
||||
{
|
||||
public:
|
||||
class ZCNode1; class ZCNode2; class ZCNodeInfo;
|
||||
public:
|
||||
typedef TType TypeData ;
|
||||
typedef TTypeInit ZCTypeInit ;
|
||||
typedef TTypeTreeData ZCTypeTreeData;
|
||||
public:
|
||||
typedef typename TTypeTreeData::TypeSize TypeSize ;
|
||||
typedef typename TTypeTreeData::template
|
||||
ZtCTypeClass<ZCNode1>::TypeList ZCNode1List ;
|
||||
typedef typename TTypeTreeData::template
|
||||
ZtCTypeClass<ZCNode2>::TypeList ZCNode2List ;
|
||||
public:
|
||||
typedef ZCNode1 ZCNode ;
|
||||
typedef ZCNode1List ZCNodeList ;
|
||||
public:
|
||||
typedef typename ZCNodeList::ZCLink ZCNodeLink;
|
||||
typedef typename ZCNodeList::iterator IterOfNode;
|
||||
public:
|
||||
|
||||
class ZCNode1 : public ZCTypeInit
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
TypeData mo_TypeData ;
|
||||
ZCNode2List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode1()
|
||||
{
|
||||
mp_HighNode=0; this->ZCTypeInit::OnInit(mo_TypeData);
|
||||
}/*
|
||||
ZCNode1()*/
|
||||
|
||||
~ZCNode1()
|
||||
{
|
||||
mp_HighNode=0; this->ZCTypeInit::OnFini(mo_TypeData);
|
||||
}/*
|
||||
~ZCNode1()*/
|
||||
|
||||
ZCNode* GetHighNodePtr () {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr ()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
TypeData& GetData () {return mo_TypeData;}
|
||||
const TypeData& GetData ()const{return mo_TypeData;}
|
||||
const ZCNodeList& GetCNodeList()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void clear (){mo_CNodeList.DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&(**mo_CNodeList.AddTailDef());
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode ;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> TViewClass <20><> interface
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnDataBody(TypeData, TypeSize AI_Depth, TypeSize AI_Index=0)
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeStart(int AI_Depth, int AI_NodeCnt)
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(int AI_Depth, int AI_NodeCnt)
|
||||
|
||||
-- 2011-10-31 21:53:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
( TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0 )
|
||||
/*##############################################################*/
|
||||
{
|
||||
const bool CB_DoStop = ///////////////////////////////
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
(mo_TypeData, AI_StartDepth, AI_NodeIndex)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
TypeSize VL_NodeCnt= ((ZCNodeList&)mo_CNodeList).size () ;
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if ( AR_CViewClass. //////////////////////////////////////
|
||||
OnSubNodeStart(AI_StartDepth, VL_NodeCnt)==
|
||||
ZNsMain::ZNsEnum::ZERun_NO
|
||||
)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; } //////////////////////
|
||||
|
||||
|
||||
++AI_StartDepth;
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).ItD(VO_iter_Node).
|
||||
IterPreOrder<TViewClass>
|
||||
(AR_CViewClass, AI_StartDepth, i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(RR(VO_iter_Node));
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth;
|
||||
|
||||
const ZNsMain::ZNsEnum::ZERun CE_ERun =
|
||||
AR_CViewClass.OnSubNodeClose(AI_StartDepth, VL_NodeCnt);
|
||||
|
||||
if(CE_ERun==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
return ZNsMain::ZNsEnum::ZERun_NO; /////////////////////
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
(TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0)
|
||||
/*##############################################################*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
( TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0 )
|
||||
/*###############################################################*/
|
||||
{
|
||||
TypeSize VL_NodeCnt = ((ZCNodeList&)mo_CNodeList).size () ;
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if(AR_CViewClass.OnSubNodeStart
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
|
||||
++AI_StartDepth; /*####################*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).ItD(VO_iter_Node).
|
||||
IterPostOrder<TViewClass>(AR_CViewClass, AI_StartDepth, i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(VO_iter_Node);
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth; /*####################*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeClose
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
|
||||
const bool CB_DoStop = /////////////////////////
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
( mo_TypeData, AI_StartDepth, AI_NodeIndex )
|
||||
==ZNsMain::ZNsEnum::ZERun_NO
|
||||
) ;
|
||||
////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
(TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0, TypeSize AI_NodeIndex=0)
|
||||
/*###############################################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode1*/
|
||||
|
||||
class ZCNode2 : public ZCTypeInit
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
TypeData mo_TypeData ;
|
||||
ZCNode1List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode2()
|
||||
{
|
||||
mp_HighNode=0; this->ZCTypeInit::OnInit(mo_TypeData);
|
||||
}/*
|
||||
ZCNode2()*/
|
||||
~ZCNode2()
|
||||
{
|
||||
mp_HighNode=0; this->ZCTypeInit::OnFini(mo_TypeData);
|
||||
}/*
|
||||
~ZCNode2()*/
|
||||
|
||||
ZCNode* GetHighNodePtr () {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr ()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
TypeData& GetData () {return mo_TypeData ;}
|
||||
const TypeData& GetData ()const{return mo_TypeData ;}
|
||||
const ZCNodeList& GetCNodeList()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void clear (){mo_CNodeList.DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&(**mo_CNodeList.AddTailDef());
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode ;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> ZCNode1 <20><> ZCNode2 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̹Ƿ<CCB9>, ZCNode2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IterPreOrder() <20><> IterPostOrder() <20><>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>. ZCNode2 <20><> ZCNode1 <20><> <20><><EFBFBD><EFBFBD>ȯ<EFBFBD>Ǿ ZCNode1 <20><> IterPreOrder() <20><> IterPostOrder()
|
||||
<20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̱<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>.
|
||||
|
||||
-- 2011-11-01 10:40:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode2*/
|
||||
|
||||
class ZCNodeInfo
|
||||
{
|
||||
private:
|
||||
ZCNode* mp_NowNodeWrap;
|
||||
ZCNodeLink* mp_NowNodeLink;
|
||||
public :
|
||||
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0, ZCNodeLink* AP_CNodeLink=0)
|
||||
{
|
||||
mp_NowNodeWrap=AP_CNode; mp_NowNodeLink=AP_CNodeLink;
|
||||
}/*
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0, ZCNodeLink* AP_CNodeLink=0)*/
|
||||
|
||||
ZCNode* GetNowNodeWrap(){return mp_NowNodeWrap;}
|
||||
ZCNodeLink* GetNowNodeLink(){return mp_NowNodeLink;}
|
||||
|
||||
bool DeleteNode()
|
||||
{
|
||||
if(mp_NowNodeWrap==0 || mp_NowNodeLink==0) return false;
|
||||
|
||||
((ZCNodeList&)(mp_NowNodeWrap->mo_CNodeList)).
|
||||
DeleteLink(mp_NowNodeLink);
|
||||
mp_NowNodeLink=0; return true; ///////////////
|
||||
}/*
|
||||
bool DeleteNode()*/
|
||||
|
||||
ZCNodeInfo& operator ++ (int)
|
||||
{mp_NowNodeWrap->mo_CNodeList.MoveNextIter(mp_NowNodeLink); return *this;}
|
||||
|
||||
ZCNode& operator*() {return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
const ZCNode& operator*()const{return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNodeInfo*/
|
||||
|
||||
|
||||
/*public :*/
|
||||
private:
|
||||
ZCNode mo_RootNode;
|
||||
public :
|
||||
ZCNode& GetRootNode() {return mo_RootNode;}
|
||||
const ZCNode& GetRootNode()const{return mo_RootNode;}
|
||||
|
||||
void DeleteAll(){mo_RootNode.clear();}
|
||||
void clear (){mo_RootNode.clear();}
|
||||
|
||||
/*/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> <20><> clear() <20>Լ<EFBFBD><D4BC><EFBFBD> mo_RootNode.clear() <20><> ȣ<><C8A3><EFBFBD>ϰ<EFBFBD> <20>ִµ<D6B4>, <20><><EFBFBD><EFBFBD> mo_RootNode.mo_TypeData
|
||||
<20><> <20><><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, mo_TypeData <20><> <20>߰<EFBFBD><DFB0><EFBFBD> <20>ʱ<EFBFBD>ȭ<EFBFBD>ϴ<EFBFBD> <20>ڵ尡 <20>ʿ<EFBFBD><CABF><EFBFBD> <20><> <20>ִ<EFBFBD>. <20>̿<EFBFBD> <20><><EFBFBD>ؼ<EFBFBD>
|
||||
<20><> CXmlInfo_T<>::clear() <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
|
||||
-- 2012-10-12 13:20:00
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
template<typename TViewClass> void IterPreOrder(TViewClass& AR_CViewClass)
|
||||
{
|
||||
mo_RootNode.IterPreOrder<TViewClass>(AR_CViewClass, 0, 0);
|
||||
}/*
|
||||
template<typename TViewClass> void IterPreOrder(TViewClass& AR_CViewClass) */
|
||||
|
||||
template<typename TViewClass> void IterPostOrder(TViewClass& AR_CViewClass)
|
||||
{
|
||||
mo_RootNode.IterPostOrder<TViewClass>(AR_CViewClass, 0, 0);
|
||||
}/*
|
||||
template<typename TViewClass> void IterPostOrder(TViewClass& AR_CViewClass) */
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TType ,
|
||||
typename TTypeInit =ZNsMain::ZtCInit<TType>,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
class ZtCTreeData #############################################*/
|
||||
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> class ZtCTreeData <20><><EFBFBD><EFBFBD> -- 2015-08-14 14:00
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCTreeData.H"
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
typedef ZtCStringBase<char> CStringBase ;
|
||||
typedef ZtCTreeData<CStringBase> CStrTreeData ;
|
||||
typedef CStrTreeData::ZCNode CNodeCStr ;
|
||||
typedef ZNsMain::ZNsView::
|
||||
ZtCViewTreeData<CStringBase> CViewTreeData;
|
||||
|
||||
int main()
|
||||
{
|
||||
CStringBase VO_CStringBase ;
|
||||
CStrTreeData VO_CStrTreeData ;
|
||||
CViewTreeData VO_CViewTreeData;
|
||||
|
||||
CNodeCStr& VO_CNodeCStr1 = VO_CStrTreeData.GetRootNode().AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr2 = VO_CStrTreeData.GetRootNode().AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr3 = VO_CStrTreeData.GetRootNode().AddSubNode();
|
||||
|
||||
CNodeCStr& VO_CNodeCStr11 = VO_CNodeCStr1 .AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr12 = VO_CNodeCStr1 .AddSubNode();
|
||||
|
||||
CNodeCStr& VO_CNodeCStr121= VO_CNodeCStr12.AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr122= VO_CNodeCStr12.AddSubNode();
|
||||
|
||||
CNodeCStr& VO_CNodeCStr21 = VO_CNodeCStr2 .AddSubNode();
|
||||
CNodeCStr& VO_CNodeCStr22 = VO_CNodeCStr2 .AddSubNode();
|
||||
|
||||
VO_CStrTreeData.GetRootNode().GetData()="## Root Node ##";
|
||||
|
||||
VO_CNodeCStr1 . GetData()="Node1" ;
|
||||
VO_CNodeCStr2 . GetData()="Node2" ;
|
||||
VO_CNodeCStr3 . GetData()="Node3" ;
|
||||
|
||||
VO_CNodeCStr11. GetData()="Node11" ;
|
||||
VO_CNodeCStr12. GetData()="Node12" ;
|
||||
|
||||
VO_CNodeCStr21. GetData()="Node21" ;
|
||||
VO_CNodeCStr22. GetData()="Node22" ;
|
||||
|
||||
VO_CNodeCStr121.GetData()="Node121";
|
||||
VO_CNodeCStr122.GetData()="Node122";
|
||||
|
||||
cout<<"# Pre Order"<<endl;
|
||||
VO_CStrTreeData.IterPreOrder (VO_CViewTreeData);
|
||||
cout<<"# Post Order" <<endl;
|
||||
VO_CStrTreeData.IterPostOrder(VO_CViewTreeData);
|
||||
}
|
||||
|
||||
<20><> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
# Pre Order
|
||||
<20><> Index=0: ## Root Node ##
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node1
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node11
|
||||
<20><> Index=2: Node12
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node121
|
||||
<20><> Index=2: Node122
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> Index=2: Node2
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node21
|
||||
<20><> Index=2: Node22
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> Index=3: Node3
|
||||
<20><> OnSubNodeClose:
|
||||
# Post Order
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node11
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node121
|
||||
<20><> Index=2: Node122
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> Index=2: Node12
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> Index=1: Node1
|
||||
<20><> OnSubNodeStart:
|
||||
<20><> Index=1: Node21
|
||||
<20><> Index=2: Node22
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> Index=2: Node2
|
||||
<20><> Index=3: Node3
|
||||
<20><> OnSubNodeClose:
|
||||
<20><> Index=0: ## Root Node ##
|
||||
|
||||
///////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> class ZtCTreeData <>::ZCNode1 <20><><EFBFBD><EFBFBD> mo_TypeData <20><> <20>ִٸ<D6B4>,
|
||||
class ZtCTreeDataEx<>::ZCNode1 <20><><EFBFBD><EFBFBD> mo_CDataList <20><> <20>ִ<EFBFBD>.
|
||||
|
||||
///////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
template< typename TType,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
class ZtCTreeDataEx /*#########################################*/
|
||||
{
|
||||
public:
|
||||
typedef TType TypeData ;
|
||||
typedef TTypeTreeData ZCTypeTreeData;
|
||||
public:
|
||||
class ZCNode1; class ZCNode2; class ZCNodeInfo ;
|
||||
public:
|
||||
typedef typename TTypeTreeData::TypeSize TypeSize;
|
||||
public:
|
||||
typedef typename TTypeTreeData::
|
||||
template ZtCTypeClass<TypeData>::TypeList ZCDataList ;
|
||||
typedef typename TTypeTreeData::
|
||||
template ZtCTypeClass<ZCNode1 >::TypeList ZCNode1List;
|
||||
typedef typename TTypeTreeData::
|
||||
template ZtCTypeClass<ZCNode2 >::TypeList ZCNode2List;
|
||||
public:
|
||||
typedef ZCNode1 ZCNode ;
|
||||
typedef ZCNode1List ZCNodeList;
|
||||
typedef typename ZCNodeList::ZCLink ZCNodeLink;
|
||||
typedef typename ZCDataList::ZCLink ZCDataLink;
|
||||
public:
|
||||
typedef typename ZCDataList::iterator IterOfData;
|
||||
typedef typename ZCNodeList::iterator IterOfNode;
|
||||
public:
|
||||
|
||||
class ZCNode1
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
ZCDataList mo_CDataList;
|
||||
ZCNode2List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode1()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
ZCNode1()*/
|
||||
|
||||
ZCNode* GetHighNodePtr() {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
ZCDataList& GetZCDataList() {return mo_CDataList;}
|
||||
const ZCDataList& GetZCDataList()const{return mo_CDataList;}
|
||||
const ZCNodeList& GetCNodeList()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetDataCnt(){return mo_CDataList.size();}
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCDataList(){mo_CDataList.DeleteAll();}
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void DeleteAll (){mo_CDataList.DeleteAll(); mo_CNodeList.DeleteAll();}
|
||||
void clear (){DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&(**mo_CNodeList.AddTailDef());
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode ;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> TViewClass <20><> interface
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnDataStart(int AI_Depth)
|
||||
ZNsMain::ZNsEnum::ZERun OnDataBody(TypeData, TypeSize AI_Depth, TypeSize AI_Index)
|
||||
ZNsMain::ZNsEnum::ZERun OnDataClose(int AI_Depth)
|
||||
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeStart(int AI_Depth, int AI_NodeCnt)
|
||||
ZNsMain::ZNsEnum::ZERun OnSubNodeClose(int AI_Depth, int AI_NodeCnt)
|
||||
|
||||
-- 2011-10-31 21:53:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass ,
|
||||
TypeSize AI_StartDepth=0,
|
||||
TypeSize AI_NodeIndex =0
|
||||
)
|
||||
/*##############################################################*/
|
||||
{
|
||||
TypeSize VL_DataCnt= mo_CDataList .size();
|
||||
TypeSize VL_NodeCnt=((ZCNodeList&)mo_CNodeList).size();
|
||||
|
||||
IterOfData VO_iter_Data( mo_CDataList.begin());
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if(AR_CViewClass.OnDataStart(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_DataCnt)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
(
|
||||
mo_CDataList.ItD(VO_iter_Data), AI_StartDepth, AI_NodeIndex
|
||||
)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
mo_CDataList.MoveNextIter(VO_iter_Data); ///////
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_DataCnt)*/
|
||||
}
|
||||
if(AR_CViewClass.OnDataClose(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeStart
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
++AI_StartDepth; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop = ///////////////////////////////
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).ItD(VO_iter_Node).
|
||||
IterPreOrder<TViewClass>
|
||||
(AR_CViewClass, AI_StartDepth. i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(VO_iter_Node);
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeClose
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK; /////////////////////////
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPreOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass, TypeSize AI_StartDepth=0
|
||||
TypeSize AI_NodeIndex =0
|
||||
) */
|
||||
/*###############################################################*/
|
||||
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass ,
|
||||
TypeSize AI_StartDepth=0,
|
||||
TypeSize AI_NodeIndex =0
|
||||
)
|
||||
/*###############################################################*/
|
||||
{
|
||||
TypeSize VL_DataCnt= mo_CDataList. size();
|
||||
TypeSize VL_NodeCnt=((ZCNodeList&)mo_CNodeList).size();
|
||||
|
||||
IterOfData VO_iter_Data( mo_CDataList. begin());
|
||||
IterOfNode VO_iter_Node(((ZCNodeList&)mo_CNodeList).begin());
|
||||
|
||||
if(AR_CViewClass.OnSubNodeStart
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
++AI_StartDepth; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_NodeCnt)
|
||||
{
|
||||
const bool CB_DoStop = ////////////////////////////////
|
||||
(
|
||||
((ZCNodeList&)mo_CNodeList).
|
||||
ItD(VO_iter_Node).IterPostOrder<TViewClass>
|
||||
(AR_CViewClass, AI_StartDepth, i)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
((ZCNodeList&)mo_CNodeList).MoveNextIter(VO_iter_Node);
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_NodeCnt)*/
|
||||
}
|
||||
--AI_StartDepth; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if(AR_CViewClass.OnSubNodeClose
|
||||
(AI_StartDepth, VL_NodeCnt)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
|
||||
if(AR_CViewClass.OnDataStart(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
{
|
||||
__for1(TypeSize, i, VL_DataCnt)
|
||||
{
|
||||
const bool CB_DoStop = ////////////////////
|
||||
(
|
||||
AR_CViewClass.OnDataBody
|
||||
(
|
||||
mo_CDataList.ItD(VO_iter_Data), AI_StartDepth, AI_NodeIndex
|
||||
)
|
||||
== ZNsMain::ZNsEnum::ZERun_NO
|
||||
);
|
||||
///////////////////////////////////////////
|
||||
|
||||
if(CB_DoStop) return ZNsMain::ZNsEnum::ZERun_NO;
|
||||
|
||||
mo_CDataList.MoveNextIter(VO_iter_Data); ///////////////
|
||||
}/*
|
||||
__for1(TypeSize, i, VL_DataCnt)*/
|
||||
}
|
||||
if(AR_CViewClass.OnDataClose(AI_StartDepth)==ZNsMain::ZNsEnum::ZERun_NO)
|
||||
{ return ZNsMain::ZNsEnum::ZERun_NO; }
|
||||
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
return ZNsMain::ZNsEnum::ZERun_OK;
|
||||
}/*
|
||||
template<typename TViewClass> ZNsMain::ZNsEnum::ZERun IterPostOrder
|
||||
(
|
||||
TViewClass& AR_CViewClass ,
|
||||
TypeSize AI_StartDepth=0 ,
|
||||
TypeSize AI_NodeIndex =0
|
||||
)
|
||||
#################################################################*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode1*/
|
||||
|
||||
class ZCNode2
|
||||
{
|
||||
public :
|
||||
friend class ZCNodeInfo;
|
||||
private:
|
||||
ZCNode* mp_HighNode ;
|
||||
ZCDataList mo_CDataList;
|
||||
ZCNode1List mo_CNodeList;
|
||||
public :
|
||||
|
||||
ZCNode2()
|
||||
{
|
||||
mp_HighNode=0;
|
||||
}/*
|
||||
ZCNode2()*/
|
||||
|
||||
ZCNode* GetHighNodePtr() {return (ZCNode*)mp_HighNode;}
|
||||
const ZCNode* GetHighNodePtr()const{return (ZCNode*)mp_HighNode;}
|
||||
|
||||
ZCDataList& GetZCDataList() {return mo_CDataList;}
|
||||
const ZCDataList& GetZCDataList()const{return mo_CDataList;}
|
||||
const ZCNodeList& GetCNodeList ()const{return (ZCNodeList&)mo_CNodeList;}
|
||||
|
||||
TypeSize GetDataCnt(){return mo_CDataList.size();}
|
||||
TypeSize GetNodeCnt(){return mo_CNodeList.size();}
|
||||
|
||||
void DeleteCDataList(){mo_CDataList.DeleteAll();}
|
||||
void DeleteCNodeList(){mo_CNodeList.DeleteAll();}
|
||||
void DeleteAll (){mo_CDataList.DeleteAll(); mo_CNodeList.DeleteAll();}
|
||||
void clear (){DeleteAll();}
|
||||
|
||||
ZCNode& AddSubNode()
|
||||
{
|
||||
ZCNode* VP_CNode=(ZCNode*)&
|
||||
( **mo_CNodeList.AddTailDef() );
|
||||
|
||||
VP_CNode->mp_HighNode=(ZCNode*)this; return *VP_CNode;
|
||||
}/*
|
||||
ZCNode& AddSubNode()*/
|
||||
|
||||
ZCNodeInfo GetHeadNodeIter()
|
||||
{
|
||||
return ZCNodeInfo((ZCNode*)this, ((ZCNodeList&)mo_CNodeList).GetHeadLinkPtr());
|
||||
}/*
|
||||
ZCNodeInfo GetHeadNodeIter()*/
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<20><> ZCNode1 <20><> ZCNode2 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̹Ƿ<CCB9>, ZCNode2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IterPreOrder() <20><> IterPostOrder() <20><>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>. ZCNode2 <20><> ZCNode1 <20><> <20><><EFBFBD><EFBFBD>ȯ<EFBFBD>Ǿ ZCNode1 <20><> IterPreOrder() <20><> IterPostOrder()
|
||||
<20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̱<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>.
|
||||
|
||||
-- 2011-11-01 10:40:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNode2*/
|
||||
|
||||
class ZCNodeInfo
|
||||
{
|
||||
private:
|
||||
ZCNode* mp_NowNodeWrap;
|
||||
ZCNodeLink* mp_NowNodeLink;
|
||||
public :
|
||||
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0,ZCNodeLink* AP_CNodeLink=0)
|
||||
{
|
||||
mp_NowNodeWrap=AP_CNode; mp_NowNodeLink=AP_CNodeLink;
|
||||
}/*
|
||||
ZCNodeInfo(ZCNode* AP_CNode=0,ZCNodeLink* AP_CNodeLink=0)*/
|
||||
|
||||
ZCNode* GetNowNodeWrap(){return mp_NowNodeWrap;}
|
||||
ZCNodeLink* GetNowNodeLink(){return mp_NowNodeLink;}
|
||||
|
||||
bool DeleteNode()
|
||||
{
|
||||
if(mp_NowNodeWrap==0 || mp_NowNodeLink==0) return false;
|
||||
|
||||
((ZCNodeList&)(mp_NowNodeWrap->mo_CNodeList)).
|
||||
DeleteLink(mp_NowNodeLink);
|
||||
mp_NowNodeLink=0; return true; //////////////
|
||||
}/*
|
||||
bool DeleteNode()*/
|
||||
|
||||
ZCNodeInfo& operator++(int)
|
||||
{
|
||||
mp_NowNodeWrap->mo_CNodeList.MoveNextIter(mp_NowNodeLink); return *this;
|
||||
}/*
|
||||
ZCNodeInfo& operator++(int)*/
|
||||
|
||||
ZCNode& operator*() {return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
const ZCNode& operator*()const{return mp_NowNodeWrap->mo_CNodeList.ItD(mp_NowNodeLink);}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCNodeInfo
|
||||
|
||||
|
||||
public :*/
|
||||
private:
|
||||
ZCNode mo_RootNode;
|
||||
public:
|
||||
ZCNode& GetRootNode() {return mo_RootNode;}
|
||||
const ZCNode& GetRootNode()const{return mo_RootNode;}
|
||||
|
||||
void DeleteAll(){mo_RootNode.clear();}
|
||||
void clear (){mo_RootNode.clear();}
|
||||
|
||||
template<typename TViewClass> void IterPreOrder (TViewClass AO_CViewClass)
|
||||
{ mo_RootNode.IterPreOrder<TViewClass>(AO_CViewClass, 0); }
|
||||
template<typename TViewClass> void IterPostOrder(TViewClass AO_CViewClass)
|
||||
{ mo_RootNode.IterPostOrder<TViewClass>(AO_CViewClass, 0); }
|
||||
|
||||
public:
|
||||
};/*
|
||||
template< typename TType,
|
||||
typename TTypeTreeData=ZNsType::ZtCTypeTreeData<long>
|
||||
>
|
||||
ZtCTreeDataEx #################################################*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CTreeClass.H <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ü<EFBFBD><C3BC> <20><><EFBFBD>̴<EFBFBD>. CTreeClass.H <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ʈ<><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ǥ<><C7A5><EFBFBD>ϴµ<CFB4>,
|
||||
<20>Ʒ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
class CMyNode;
|
||||
{
|
||||
public:
|
||||
TypeData mo_TypeData;
|
||||
ZNsMain::ZtCObjList<CMyNode> mo_NodeList; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ.
|
||||
};
|
||||
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>, void* <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD>. <20><EFBFBD><D7B7><EFBFBD> <20><> <20><><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD>, <20>Ȱ<EFBFBD><C8B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><> Ŭ<><C5AC><EFBFBD><EFBFBD> ZCNode1, ZCNode2 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(!!) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD>.
|
||||
|
||||
Ŭ<><C5AC><EFBFBD><EFBFBD> ZCNode1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ZCNode2 <20><> <20><><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD>(<28><><EFBFBD><EFBFBD>Ʈ)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ְ<EFBFBD>,
|
||||
Ŭ<><C5AC><EFBFBD><EFBFBD> ZCNode2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ZCNode1 <20><> <20><><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD>(<28><><EFBFBD><EFBFBD>Ʈ)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD>.
|
||||
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20>ƴ<EFBFBD><C6B4><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
|
||||
|
||||
2011-10-29 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> 7 <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>ȭȸ<C8AD><C8B8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>鼭, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> object
|
||||
<20><><EFBFBD><EFBFBD>, <20><><EFBFBD>߿<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> object <20><> instance <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD>, <20>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD> <20>ذ<EFBFBD><D8B0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӹ<EFBFBD> <20>ӿ<EFBFBD> <20><EFBFBD><D7B7><EFBFBD><EFBFBD>鼭, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>
|
||||
<20><> <20><>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD> <20>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴϾ<C6B4><CFBE><EFBFBD><EFBFBD><EFBFBD> <20>巯<EFBFBD><E5B7AF><EFBFBD><EFBFBD>. <20>Ǹ<EFBFBD><C7B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD> <20><> <20><>
|
||||
<20><>, Ʈ<><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>, <20>ȱ<EFBFBD><C8B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20≯<EFBFBD><CCB8><EFBFBD> <20>ٸ<EFBFBD> 2 <20><><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ʈ<><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
<20><> <20><> <20>ִٴ<D6B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̴<EFBFBD>. <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> CTreeData.H <20>̴<EFBFBD>.
|
||||
|
||||
<20><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>.
|
||||
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ڿ<EFBFBD> <20>ΰ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>, <20>ٷ<EFBFBD> <20>տ<EFBFBD> <20><>ŭ <20>ٰ<EFBFBD><D9B0><EFBFBD>
|
||||
<20><>.
|
||||
|
||||
-- 2011-10-31 23:47:00
|
||||
|
||||
-- <20><><EFBFBD><EFBFBD> CTreeClass.H <20><> <20><><EFBFBD>ŵǾ<C5B5><C7BE><EFBFBD>. -- 2013-05-01 17:22:00
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
#endif // __ZCPPMAIN__ZCTREEDATA_H__
|
Reference in New Issue
Block a user