Revised String class

Renamed String::Substr to SubString


Former-commit-id: 6aa925799e71af6916f7808368a3faa26efbe1bc
This commit is contained in:
Lynix
2013-06-19 02:25:19 +02:00
parent c1e57c829c
commit b0c46b2384
10 changed files with 189 additions and 1099 deletions

View File

@@ -262,9 +262,9 @@ bool NzDirectory::Create(const NzString& dirPath, bool recursive)
do
{
NzString p = path.Substr(0, foundPos);
NzString p = path.SubString(0, foundPos);
if (p.EndsWith(NAZARA_DIRECTORY_SEPARATOR))
p = p.Substr(0, -2);
p = p.SubString(0, -2);
if (!NzDirectoryImpl::Exists(p) && !NzDirectoryImpl::Create(p))
return false;

View File

@@ -162,14 +162,14 @@ NzString NzFile::GetDirectory() const
{
NazaraLock(m_mutex)
return m_filePath.SubstrTo(NAZARA_DIRECTORY_SEPARATOR, -1, true, true);
return m_filePath.SubStringTo(NAZARA_DIRECTORY_SEPARATOR, -1, true, true);
}
NzString NzFile::GetFileName() const
{
NazaraLock(m_mutex)
return m_filePath.SubstrFrom(NAZARA_DIRECTORY_SEPARATOR, -1, true);
return m_filePath.SubStringFrom(NAZARA_DIRECTORY_SEPARATOR, -1, true);
}
time_t NzFile::GetLastAccessTime() const
@@ -501,8 +501,8 @@ NzString NzFile::AbsolutePath(const NzString& filePath)
}
else if (path.StartsWith('\\')) // Spécial : '\' fait référence au disque racine
{
NzString drive = NzDirectory::GetCurrent().SubstrTo('\\');
NzString end = path.Substr(1, -1);
NzString drive = NzDirectory::GetCurrent().SubStringTo('\\');
NzString end = path.SubString(1, -1);
if (end.IsEmpty())
path = drive;
else
@@ -604,7 +604,7 @@ time_t NzFile::GetCreationTime(const NzString& filePath)
NzString NzFile::GetDirectory(const NzString& filePath)
{
return filePath.SubstrTo(NAZARA_DIRECTORY_SEPARATOR, -1, true, true);
return filePath.SubStringTo(NAZARA_DIRECTORY_SEPARATOR, -1, true, true);
}
time_t NzFile::GetLastAccessTime(const NzString& filePath)

File diff suppressed because it is too large Load Diff

View File

@@ -151,7 +151,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_ka")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -166,7 +166,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_kd")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -181,7 +181,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_ks")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -196,7 +196,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_bump" || keyword == "bump")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -211,7 +211,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_d")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -226,7 +226,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_decal" || keyword == "decal")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -241,7 +241,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_disp" || keyword == "disp")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -256,7 +256,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "map_refl" || keyword == "refl")
{
NzString map = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString map = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!map.IsEmpty())
{
if (!currentMaterial)
@@ -271,7 +271,7 @@ bool NzMTLParser::Parse()
}
else if (keyword == "newmtl")
{
NzString materialName = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString materialName = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (!materialName.IsEmpty())
currentMaterial = &m_materials[materialName];
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
@@ -305,7 +305,7 @@ bool NzMTLParser::Advance(bool required)
m_lineCount++;
m_currentLine = m_stream.ReadLine();
m_currentLine = m_currentLine.SubstrTo("#"); // On ignore les commentaires
m_currentLine = m_currentLine.SubStringTo("#"); // On ignore les commentaires
m_currentLine.Simplify(); // Pour un traitement plus simple
}
while (m_currentLine.IsEmpty());

View File

@@ -237,7 +237,7 @@ bool NzOBJParser::Parse()
UnrecognizedLine();
#endif
m_mtlLib = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
m_mtlLib = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
break;
case 'g':
@@ -251,7 +251,7 @@ bool NzOBJParser::Parse()
break;
}
NzString objectName = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
NzString objectName = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (objectName.IsEmpty())
{
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
@@ -269,7 +269,7 @@ bool NzOBJParser::Parse()
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
if (m_currentLine[1] == ' ')
{
NzString param = m_currentLine.Substr(2);
NzString param = m_currentLine.SubString(2);
if (param != "all" && param != "on" && param != "off" && !param.IsNumber())
UnrecognizedLine();
}
@@ -284,7 +284,7 @@ bool NzOBJParser::Parse()
UnrecognizedLine();
#endif
matName = m_currentLine.Substr(m_currentLine.GetWordPosition(1));
matName = m_currentLine.SubString(m_currentLine.GetWordPosition(1));
if (matName.IsEmpty())
{
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
@@ -405,7 +405,7 @@ bool NzOBJParser::Advance(bool required)
m_lineCount++;
m_currentLine = m_stream.ReadLine();
m_currentLine = m_currentLine.SubstrTo("#"); // On ignore les commentaires
m_currentLine = m_currentLine.SubStringTo("#"); // On ignore les commentaires
m_currentLine.Simplify(); // Pour un traitement plus simple
}
while (m_currentLine.IsEmpty());

View File

@@ -215,7 +215,7 @@ bool NzMD5AnimParser::Parse(NzAnimation* animation)
sequence.firstFrame = 0;
sequence.frameCount = m_frames.size();
sequence.frameRate = m_frameRate;
sequence.name = m_stream.GetPath().SubstrFrom(NAZARA_DIRECTORY_SEPARATOR, -1, true);
sequence.name = m_stream.GetPath().SubStringFrom(NAZARA_DIRECTORY_SEPARATOR, -1, true);
if (!animation->AddSequence(sequence))
NazaraWarning("Failed to add sequence");
@@ -265,7 +265,7 @@ bool NzMD5AnimParser::Advance(bool required)
m_lineCount++;
m_currentLine = m_stream.ReadLine();
m_currentLine = m_currentLine.SubstrTo("//"); // On ignore les commentaires
m_currentLine = m_currentLine.SubStringTo("//"); // On ignore les commentaires
m_currentLine.Simplify(); // Pour un traitement plus simple
}
while (m_currentLine.IsEmpty());

View File

@@ -390,7 +390,7 @@ bool NzMD5MeshParser::Advance(bool required)
m_lineCount++;
m_currentLine = m_stream.ReadLine();
m_currentLine = m_currentLine.SubstrTo("//"); // On ignore les commentaires
m_currentLine = m_currentLine.SubStringTo("//"); // On ignore les commentaires
m_currentLine.Simplify(); // Pour un traitement plus simple
}
while (m_currentLine.IsEmpty());
@@ -494,7 +494,7 @@ bool NzMD5MeshParser::ParseMesh()
}
#endif
m_meshes[m_meshIndex].shader = m_currentLine.Substr(7);
m_meshes[m_meshIndex].shader = m_currentLine.SubString(7);
m_meshes[m_meshIndex].shader.Trim('"');
break;