Files
envi-code/SourceCode/Code2026/PipelineCmd/SysLayerCfg/TGData.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

94 lines
1.8 KiB
C++

#include "..\stdafx.h"
#include "TGData.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
////////////////////////////////////////////////////////////////////////////////
// 路径
////////////////////////////////////////////////////////////////////////////////
TGPath::TGPath(const TCHAR *pszName)
{
m_strPath = pszName;
}
TGPath::~TGPath()
{
}
void TGPath::GetName(CString &strName)const
{
int i = m_strPath.ReverseFind(_T('\\'));
if (i == NOT_FOUND)
strName = m_strPath;
else
{
if (m_strPath.GetLength() <= i + 1)
strName = _T("");
else
strName = m_strPath.Right(m_strPath.GetLength()-i-1);
}
}
bool TGPath::GetTopCat(CString &strName)const
{
int i = m_strPath.Find(_T('\\'));
if (i == NOT_FOUND)
return false;
else
{
strName = m_strPath.Left(i);
return true;
}
}
bool TGPath::GetLowPath(TGPath&path)const
{
int i = m_strPath.Find(_T('\\'));
if (i == NOT_FOUND)
return false;
else
{
if (m_strPath.GetLength()-i-1 > 0)
path = m_strPath.Right(m_strPath.GetLength()-i-1);
return true;
}
}
void TGPath::Resolve(TPDList<CString>&lstStrCats)const
{
int from = 0;
int to;
while (from < m_strPath.GetLength() && (to = m_strPath.Find(_T('\\'), from)) != NOT_FOUND)
{
if (to == from)
lstStrCats<<new CString(_T(""));
else
lstStrCats<<new CString(m_strPath.Mid(from, to-from));
from = to + 1;
}
CString *pName = new CString;
GetName(*pName);
lstStrCats<<pName;
}
////////////////////////////////////////////////////////////////////////////////
// 分层数据
////////////////////////////////////////////////////////////////////////////////
void TTreeItem::GeTGPathName(CString &strName)const
{
if (GetParent()->IsRoot())
strName = m_sName;
else
{
CString temp;
GetParent()->GeTGPathName(temp);
strName = temp+_T("\\") + m_sName;
}
}