主题: node sample
查看单个帖子
旧 2007-07-22, 09:17 PM   #2
yogy
高级会员
 
注册日期: 06-11
帖子: 1527
精华: 15
现金: 6353 标准币
资产: 6353 标准币
yogy 向着好的方向发展
默认 回复: node sample

2.CSClassTypeNode.cpp
// CSClassTypeNode.cpp: implementation of the CSClassTypeNode class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CSClassTypeNode.h"
#include "CSMapType.h"
//////////////////////////////////////////////////////////////////////
// Construction/DestructionCSClassTypeNode*
//////////////////////////////////////////////////////////////////////
CS_EXPORT CSMapType *CSMapType();

inline CSClassTypeNode::CSClassTypeNode() :
m_pNext( NULL ), m_pInterface( NULL ), m_pNextContainer( NULL ),
m_strName( NULL ), m_nLength( 0 ), m_eKind( CS_IsUnKnown ),
m_eWay( CS_IsNothing ), m_eInternalType( CS_Void ),
m_nHashCode( 0 ), m_nRank( 0 ), m_hType( NULL ),
m_bMethodType( CS_False )
{
// cout << "CSClassTypeNode::CSClassTypeNode 1 " ;
// Display() ;
// cout << endl ;
}
inline CSClassTypeNode::CSClassTypeNode(
const CS_CString aName ,
const CS_Integer aLen ,
const ELifeWay aWayOfLife) :
m_pNext( NULL ), m_pInterface( NULL ), m_pNextContainer( NULL ),
m_strName( aName ), m_nLength( aLen ),m_eKind( CS_IsPackage ),
m_eWay( aWayOfLife ), m_eInternalType( CS_Void ),
m_nHashCode( 0 ), m_nRank( 0 ), m_hType( NULL ),
m_bMethodType( CS_False )
{
// cout << "CSClassTypeNode::CSClassTypeNode 2 " ;
// Display() ;
// cout << endl ;
}
inline void CSClassTypeNode::Copy(const CSClassTypeNode*& anOther )
{
m_hType = anOther->m_hType ;
m_eKind = anOther->m_eKind ;
m_eWay = anOther->m_eWay ;
m_eInternalType = anOther->m_eInternalType ;
m_bMethodType = anOther->m_bMethodType ;
}
inline CS_CString CSClassTypeNode::Name() const
{
return m_strName ;
}
inline void CSClassTypeNode::AddInternalType( const EInternalType aInternalType )
{
m_eInternalType = aInternalType ;
}
inline EInternalType CSClassTypeNode::InternalType() const
{
return m_eInternalType ;
}
inline void CSClassTypeNode::AddMethodType( const CS_Boolean aMethodType )
{
m_bMethodType = aMethodType ;
}
inline CS_Boolean CSClassTypeNode::MethodType() const
{
return m_bMethodType ;
}
inline CS_Integer CSClassTypeNode::Length() const
{
return m_nLength ;
}

inline CSClassTypeHandle CSClassTypeNode::Type() const
{
return m_hType ;
}

inline CS_Boolean CSClassTypeNode::SubType(const CSClassTypeNode*& pNode ) const
{
if ( m_eKind == CS_IsUnKnown ||
pNode->IsUnKnown() )
return CS_False ;
if ( m_eKind == CS_IsPrimitive ||
pNode->IsPrimitive() )
return CS_False ;
if ( pNode == this || pNode->Type() == m_hType )
return CS_True ;
return m_hType->SubType( pNode->Type() ) ;
}

inline CS_Boolean CSClassTypeNode::IsImported() const
{
return m_eKind == CS_IsImported;
}

inline CS_Boolean CSClassTypeNode::IsPrimitive() const
{
return m_eKind == CS_IsPrimitive;
}

inline CS_Boolean CSClassTypeNode::IsUnKnown() const
{
return m_eKind == CS_IsUnKnown;
}

inline CS_Boolean CSClassTypeNode::IsEnumeration() const
{
return m_eKind == CS_IsEnumeration;
}

inline CS_Boolean CSClassTypeNode::IsClass() const
{
return m_eKind == CS_IsClass ;
}

inline CS_Boolean CSClassTypeNode::IsPackage() const
{
return m_eKind == CS_IsPackage ;
}

inline void CSClassTypeNode::WhatIs()
{
if ( m_eKind == CS_IsPackage )
m_eWay = CS_IsNothing ;
else if ( m_hType->SubType( THEPForMapOfTypes()->TypPersistent()->Type() ) )
m_eWay = CS_IsPersistent ;
else if ( m_hType->SubType( THEPForMapOfTypes()->TypTransient()->Type() ) )
m_eWay = CS_IsTransient ;
else
m_eWay = CS_IsAddress ;
}

inline CS_Boolean CSClassTypeNode::IsPersistent() const
{
return m_eWay == CS_IsPersistent ;
}

inline CS_Boolean CSClassTypeNode::IsTransient() const
{
return m_eWay == CS_IsTransient ;
}

inline CS_Boolean CSClassTypeNode::IsAddress() const
{
return m_eWay == CS_IsAddress ;
}
inline CS_Boolean CSClassTypeNode::IsNotLoaded() const
{
return m_eWay == CS_IsNotLoaded ;
}

inline CS_Integer CSClassTypeNode::HashCode() const
{
return m_nHashCode ;
}

inline CS_Integer CSClassTypeNode::Rank() const
{
return m_nRank ;
}
inline CSClassTypeNode* CSClassTypeNode::Next() const
{
return m_pNext ;
}
inline CSClassTypeNode* CSClassTypeNode::NextContainer() const
{
return m_pNextContainer ;
}
inline void CSClassTypeNode::AddName(const CS_CString aName,const CS_Integer aLen )
{
m_strName = new char[aLen + 1];
strcpy( m_strName , aName );
m_nLength = aLen ;
m_eWay = CS_IsNotLoaded ;
}

inline void CSClassTypeNode::AddHashCode(const CS_Integer aHashCode )
{
m_nHashCode = aHashCode ;
}

inline void CSClassTypeNode::AddRank(const CS_Integer aRank )
{
m_nRank = aRank ;
}
inline void CSClassTypeNode::AddNext(const CSClassTypeNode*& pNode )
{
m_pNext = pNode;
}
inline void CSClassTypeNode::AddNextContainer(const CSClassTypeNode*& pNode )
{
m_pNextContainer = pNode;
}
inline CS_Integer CSClassTypeNode::CaseCmp(const CSClassTypeNode*& pNode ) const
{
if ( m_nRank < pNode->m_nRank )
return -1 ;
else if ( m_nRank > pNode->m_nRank )
return 1 ;
else
return 0 ;
}
inline void CSClassTypeNode::SetInterfacePlugin( const CS_Address pInterface )
{
m_pInterface = pInterface;
}
inline CS_Address CSClassTypeNode::InterfacePlugin() const
{
return m_pInterface;
}
inline void CSClassTypeNode::Nullify()
{
m_hType.Nullify() ;
}
inline CS_Boolean CSClassTypeNode::IsNull() const
{
return m_hType.IsNull() ;
}
yogy离线中   回复时引用此帖