working on rendering
This commit is contained in:
@@ -62,16 +62,83 @@ void CUtlString::AppendAt( size_t nPosition, const char *psz )
|
||||
|
||||
void CUtlString::RemoveTail( size_t nCount )
|
||||
{
|
||||
|
||||
m_data.RemoveTail(nCount);
|
||||
m_data[m_data.GetSize()-1] = 0;
|
||||
}
|
||||
void CUtlString::RemoveHead( size_t nCount )
|
||||
{
|
||||
|
||||
m_data.RemoveHead(nCount);
|
||||
}
|
||||
void CUtlString::RemoveAt( size_t nPosition, size_t nCount )
|
||||
{
|
||||
|
||||
}
|
||||
CUtlString CUtlString::GetFileName()
|
||||
{
|
||||
CUtlString szFileName = GetString();
|
||||
|
||||
char *pLast = &m_data[GetLenght()-1];
|
||||
while (pLast != m_data.GetData())
|
||||
{
|
||||
if (*pLast=='/')
|
||||
break;
|
||||
pLast--;
|
||||
}
|
||||
|
||||
return pLast;
|
||||
}
|
||||
CUtlString CUtlString::GetDirectory()
|
||||
{
|
||||
if (GetLenght() == 0)
|
||||
return NULL;
|
||||
size_t iNumDeleted = 0;
|
||||
char *pLast = &m_data[GetLenght()-1];
|
||||
CUtlString szDirectory = GetString();
|
||||
while (pLast != m_data.GetData())
|
||||
{
|
||||
if (*pLast=='/')
|
||||
{
|
||||
iNumDeleted++;
|
||||
break;
|
||||
}
|
||||
pLast--;
|
||||
iNumDeleted++;
|
||||
}
|
||||
|
||||
szDirectory.RemoveTail(iNumDeleted);
|
||||
|
||||
return szDirectory;
|
||||
}
|
||||
CUtlString CUtlString::RemoveHeadFile()
|
||||
{
|
||||
size_t iLenght = GetLenght();
|
||||
size_t iNumDeleted = 0;
|
||||
char *pc = GetString();
|
||||
CUtlString szDirectory = pc;
|
||||
|
||||
if (GetLenght() == 0)
|
||||
return NULL;
|
||||
while ( iNumDeleted < iLenght )
|
||||
{
|
||||
if (*pc == '/')
|
||||
goto remove_slashes;
|
||||
pc++;
|
||||
iNumDeleted++;
|
||||
}
|
||||
return NULL;
|
||||
remove_slashes:
|
||||
while ( iNumDeleted < iLenght )
|
||||
{
|
||||
if (*pc != '/')
|
||||
{
|
||||
szDirectory.RemoveHead(iNumDeleted);
|
||||
return szDirectory;
|
||||
}
|
||||
pc++;
|
||||
iNumDeleted++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *CUtlString::GetString( void )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user