[lldb-mi] Use size_t where appropriate.

Summary:
Many places should have been using size_t rather than MIuint or
MIint. This is particularly true for code that uses std::string::find(),
std::string::rfind(), std::string::size(), and related methods.

Reviewers: abidh, ki.stfu, domipheus

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10931

llvm-svn: 241360
This commit is contained in:
Bruce Mitchener 2015-07-03 15:40:44 +00:00
parent 201dec7dc2
commit e86c6fa3dc
14 changed files with 178 additions and 178 deletions

View File

@ -85,16 +85,16 @@ CMICmdArgContext::RemoveArg(const CMIUtilString &vArg)
if (vArg.empty()) if (vArg.empty())
return MIstatus::success; return MIstatus::success;
const MIuint nLen = vArg.length(); const size_t nLen = vArg.length();
const MIuint nLenCntxt = m_strCmdArgsAndOptions.length(); const size_t nLenCntxt = m_strCmdArgsAndOptions.length();
if (nLen > nLenCntxt) if (nLen > nLenCntxt)
return MIstatus::failure; return MIstatus::failure;
MIuint nExtraSpace = 0; size_t nExtraSpace = 0;
MIint nPos = m_strCmdArgsAndOptions.find(vArg); size_t nPos = m_strCmdArgsAndOptions.find(vArg);
while (1) while (1)
{ {
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return MIstatus::success; return MIstatus::success;
bool bPass1 = false; bool bPass1 = false;
@ -106,7 +106,7 @@ CMICmdArgContext::RemoveArg(const CMIUtilString &vArg)
else else
bPass1 = true; bPass1 = true;
const MIuint nEnd = nPos + nLen; const size_t nEnd = nPos + nLen;
if (bPass1) if (bPass1)
{ {
@ -129,7 +129,7 @@ CMICmdArgContext::RemoveArg(const CMIUtilString &vArg)
nPos = m_strCmdArgsAndOptions.find(vArg, nEnd); nPos = m_strCmdArgsAndOptions.find(vArg, nEnd);
} }
const MIuint nPosEnd = nLen + nExtraSpace; const size_t nPosEnd = nLen + nExtraSpace;
m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, "").c_str(); m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, "").c_str();
m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.Trim(); m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.Trim();

View File

@ -122,8 +122,8 @@ CMICmdArgValFile::GetFileNamePath(const CMIUtilString &vrTxt) const
// Look for a space in the path // Look for a space in the path
const char cSpace = ' '; const char cSpace = ' ';
const MIint nPos = fileNamePath.find(cSpace); const size_t nPos = fileNamePath.find(cSpace);
if (nPos != (MIint)std::string::npos) if (nPos != std::string::npos)
fileNamePath = CMIUtilString::Format("\"%s\"", fileNamePath.c_str()); fileNamePath = CMIUtilString::Format("\"%s\"", fileNamePath.c_str());
return fileNamePath; return fileNamePath;
@ -146,7 +146,7 @@ CMICmdArgValFile::IsFilePath(const CMIUtilString &vrFileNamePath) const
const bool bHaveBckSlash = (vrFileNamePath.find_first_of("\\") != std::string::npos); const bool bHaveBckSlash = (vrFileNamePath.find_first_of("\\") != std::string::npos);
// Look for --someLongOption // Look for --someLongOption
MIint nPos = vrFileNamePath.find_first_of("--"); size_t nPos = vrFileNamePath.find_first_of("--");
const bool bLong = (nPos == 0); const bool bLong = (nPos == 0);
if (bLong) if (bLong)
return false; return false;

View File

@ -254,7 +254,7 @@ CMICmdArgValOptionLong::IsArgLongOption(const CMIUtilString &vrTxt) const
if (bHavePosSlash || bHaveBckSlash) if (bHavePosSlash || bHaveBckSlash)
return false; return false;
const MIint nPos = vrTxt.find_first_of("--"); const size_t nPos = vrTxt.find_first_of("--");
if (nPos != 0) if (nPos != 0)
return false; return false;

View File

@ -263,12 +263,12 @@ CMICmdArgValString::IsStringArgQuotedText(const CMIUtilString &vrTxt) const
// CODETAG_QUOTEDTEXT_SIMILAR_CODE // CODETAG_QUOTEDTEXT_SIMILAR_CODE
const char cQuote = '"'; const char cQuote = '"';
const MIint nPos = vrTxt.find(cQuote); const size_t nPos = vrTxt.find(cQuote);
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return false; return false;
// Is one and only quote at end of the string // Is one and only quote at end of the string
if (nPos == (MIint)(vrTxt.length() - 1)) if (nPos == (vrTxt.length() - 1))
return false; return false;
// Quote must be the first character in the string or be preceded by a space // Quote must be the first character in the string or be preceded by a space
@ -283,8 +283,8 @@ CMICmdArgValString::IsStringArgQuotedText(const CMIUtilString &vrTxt) const
return false; return false;
// Need to find the other quote // Need to find the other quote
const MIint nPos2 = vrTxt.rfind(cQuote); const size_t nPos2 = vrTxt.rfind(cQuote);
if (nPos2 == (MIint)std::string::npos) if (nPos2 == std::string::npos)
return false; return false;
// Make sure not same quote, need two quotes // Make sure not same quote, need two quotes
@ -309,8 +309,8 @@ CMICmdArgValString::IsStringArgQuotedTextEmbedded(const CMIUtilString &vrTxt) co
{ {
// CODETAG_QUOTEDTEXT_SIMILAR_CODE // CODETAG_QUOTEDTEXT_SIMILAR_CODE
const char cBckSlash = '\\'; const char cBckSlash = '\\';
const MIint nPos = vrTxt.find(cBckSlash); const size_t nPos = vrTxt.find(cBckSlash);
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return false; return false;
// Slash must be the first character in the string or be preceded by a space // Slash must be the first character in the string or be preceded by a space
@ -319,8 +319,8 @@ CMICmdArgValString::IsStringArgQuotedTextEmbedded(const CMIUtilString &vrTxt) co
return false; return false;
// Need to find the other matching slash // Need to find the other matching slash
const MIint nPos2 = vrTxt.rfind(cBckSlash); const size_t nPos2 = vrTxt.rfind(cBckSlash);
if (nPos2 == (MIint)std::string::npos) if (nPos2 == std::string::npos)
return false; return false;
// Make sure not same back slash, need two slashes // Make sure not same back slash, need two slashes
@ -343,15 +343,15 @@ CMICmdArgValString::IsStringArgQuotedTextEmbedded(const CMIUtilString &vrTxt) co
bool bool
CMICmdArgValString::IsStringArgQuotedQuotedTextEmbedded(const CMIUtilString &vrTxt) const CMICmdArgValString::IsStringArgQuotedQuotedTextEmbedded(const CMIUtilString &vrTxt) const
{ {
const MIint nPos = vrTxt.find("\"\\\""); const size_t nPos = vrTxt.find("\"\\\"");
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return false; return false;
const MIint nPos2 = vrTxt.rfind("\\\"\""); const size_t nPos2 = vrTxt.rfind("\\\"\"");
if (nPos2 == (MIint)std::string::npos) if (nPos2 == std::string::npos)
return false; return false;
const MIint nLen = vrTxt.length(); const size_t nLen = vrTxt.length();
if ((nLen > 5) && ((nPos + 2) == (nPos2 - 2))) if ((nLen > 5) && ((nPos + 2) == (nPos2 - 2)))
return false; return false;

View File

@ -1681,8 +1681,8 @@ CMICmdCmdDataInfoLine::Execute(void)
} }
else else
{ {
const MIuint nLineStartPos = strLocation.rfind(':'); const size_t nLineStartPos = strLocation.rfind(':');
if ((nLineStartPos == (MIuint)std::string::npos) || (nLineStartPos == 0) || (nLineStartPos == strLocation.length() - 1)) if ((nLineStartPos == std::string::npos) || (nLineStartPos == 0) || (nLineStartPos == strLocation.length() - 1))
{ {
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_LOCATION_FORMAT), m_cmdData.strMiCmd.c_str(), strLocation.c_str()) SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_LOCATION_FORMAT), m_cmdData.strMiCmd.c_str(), strLocation.c_str())
.c_str()); .c_str());
@ -1739,9 +1739,9 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1] // LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1]
// ^^^^^^^^^ -- property // ^^^^^^^^^ -- property
const MIuint nPropertyStartPos = rLine.find_first_not_of(' '); const size_t nPropertyStartPos = rLine.find_first_not_of(' ');
const MIuint nPropertyEndPos = rLine.find(':'); const size_t nPropertyEndPos = rLine.find(':');
const MIuint nPropertyLen = nPropertyEndPos - nPropertyStartPos; const size_t nPropertyLen = nPropertyEndPos - nPropertyStartPos;
const CMIUtilString strProperty(rLine.substr(nPropertyStartPos, nPropertyLen).c_str()); const CMIUtilString strProperty(rLine.substr(nPropertyStartPos, nPropertyLen).c_str());
// Skip all except LineEntry // Skip all except LineEntry
@ -1750,9 +1750,9 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1] // LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1]
// ^^^^^^^^^^^^^^^^^^ -- start address // ^^^^^^^^^^^^^^^^^^ -- start address
const MIuint nStartAddressStartPos = rLine.find("["); const size_t nStartAddressStartPos = rLine.find("[");
const MIuint nStartAddressEndPos = rLine.find("-"); const size_t nStartAddressEndPos = rLine.find("-");
const MIuint nStartAddressLen = nStartAddressEndPos - nStartAddressStartPos - 1; const size_t nStartAddressLen = nStartAddressEndPos - nStartAddressStartPos - 1;
const CMIUtilString strStartAddress(rLine.substr(nStartAddressStartPos + 1, nStartAddressLen).c_str()); const CMIUtilString strStartAddress(rLine.substr(nStartAddressStartPos + 1, nStartAddressLen).c_str());
const CMICmnMIValueConst miValueConst(strStartAddress); const CMICmnMIValueConst miValueConst(strStartAddress);
const CMICmnMIValueResult miValueResult("start", miValueConst); const CMICmnMIValueResult miValueResult("start", miValueConst);
@ -1760,8 +1760,8 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1] // LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1]
// ^^^^^^^^^^^^^^^^^^ -- end address // ^^^^^^^^^^^^^^^^^^ -- end address
const MIuint nEndAddressEndPos = rLine.find(")"); const size_t nEndAddressEndPos = rLine.find(")");
const MIuint nEndAddressLen = nEndAddressEndPos - nStartAddressEndPos - 1; const size_t nEndAddressLen = nEndAddressEndPos - nStartAddressEndPos - 1;
const CMIUtilString strEndAddress(rLine.substr(nStartAddressEndPos + 1, nEndAddressLen).c_str()); const CMIUtilString strEndAddress(rLine.substr(nStartAddressEndPos + 1, nEndAddressLen).c_str());
const CMICmnMIValueConst miValueConst2(strEndAddress); const CMICmnMIValueConst miValueConst2(strEndAddress);
const CMICmnMIValueResult miValueResult2("end", miValueConst2); const CMICmnMIValueResult miValueResult2("end", miValueConst2);
@ -1773,11 +1773,11 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// ^^^^^^^^^^^^^ -- file // ^^^^^^^^^^^^^ -- file
// ^ -- line // ^ -- line
// ^ -- column (optional) // ^ -- column (optional)
const MIuint nFileStartPos = rLine.find_first_not_of(' ', nEndAddressEndPos + 2); const size_t nFileStartPos = rLine.find_first_not_of(' ', nEndAddressEndPos + 2);
const MIuint nFileOrLineEndPos = rLine.rfind(':'); const size_t nFileOrLineEndPos = rLine.rfind(':');
const MIuint nFileOrLineStartPos = rLine.rfind(':', nFileOrLineEndPos - 1); const size_t nFileOrLineStartPos = rLine.rfind(':', nFileOrLineEndPos - 1);
const MIuint nFileEndPos = nFileStartPos < nFileOrLineStartPos ? nFileOrLineStartPos : nFileOrLineEndPos; const size_t nFileEndPos = nFileStartPos < nFileOrLineStartPos ? nFileOrLineStartPos : nFileOrLineEndPos;
const MIuint nFileLen = nFileEndPos - nFileStartPos; const size_t nFileLen = nFileEndPos - nFileStartPos;
const CMIUtilString strFile(rLine.substr(nFileStartPos, nFileLen).c_str()); const CMIUtilString strFile(rLine.substr(nFileStartPos, nFileLen).c_str());
const CMICmnMIValueConst miValueConst3(strFile); const CMICmnMIValueConst miValueConst3(strFile);
const CMICmnMIValueResult miValueResult3("file", miValueConst3); const CMICmnMIValueResult miValueResult3("file", miValueConst3);
@ -1787,10 +1787,10 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1] // LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1]
// ^ -- line // ^ -- line
const MIuint nLineStartPos = nFileEndPos + 1; const size_t nLineStartPos = nFileEndPos + 1;
const MIuint nLineEndPos = rLine.find(':', nLineStartPos); const size_t nLineEndPos = rLine.find(':', nLineStartPos);
const MIuint nLineLen = nLineEndPos != (MIuint)std::string::npos ? nLineEndPos - nLineStartPos - 1 const size_t nLineLen = nLineEndPos != std::string::npos ? nLineEndPos - nLineStartPos - 1
: (MIuint)std::string::npos; : std::string::npos;
const CMIUtilString strLine(rLine.substr(nLineStartPos, nLineLen).c_str()); const CMIUtilString strLine(rLine.substr(nLineStartPos, nLineLen).c_str());
const CMICmnMIValueConst miValueConst4(strLine); const CMICmnMIValueConst miValueConst4(strLine);
const CMICmnMIValueResult miValueResult4("line", miValueConst4); const CMICmnMIValueResult miValueResult4("line", miValueConst4);

View File

@ -126,7 +126,7 @@ CMICmdCmdSymbolListLines::Acknowledge(void)
// 0x0000000100000e70: /path/to/file:3[:4] // 0x0000000100000e70: /path/to/file:3[:4]
// ^^^^^^^^^^^^^^^^^^ -- pc // ^^^^^^^^^^^^^^^^^^ -- pc
const MIuint nAddrEndPos = rLine.find(':'); const size_t nAddrEndPos = rLine.find(':');
const CMIUtilString strAddr(rLine.substr(0, nAddrEndPos).c_str()); const CMIUtilString strAddr(rLine.substr(0, nAddrEndPos).c_str());
const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueConst miValueConst(strAddr);
const CMICmnMIValueResult miValueResult("pc", miValueConst); const CMICmnMIValueResult miValueResult("pc", miValueConst);
@ -134,10 +134,10 @@ CMICmdCmdSymbolListLines::Acknowledge(void)
// 0x0000000100000e70: /path/to/file:3[:4] // 0x0000000100000e70: /path/to/file:3[:4]
// ^ -- line // ^ -- line
const MIuint nLineOrColumnStartPos = rLine.rfind(':'); const size_t nLineOrColumnStartPos = rLine.rfind(':');
const CMIUtilString strLineOrColumn(rLine.substr(nLineOrColumnStartPos + 1).c_str()); const CMIUtilString strLineOrColumn(rLine.substr(nLineOrColumnStartPos + 1).c_str());
const MIuint nPathOrLineStartPos = rLine.rfind(':', nLineOrColumnStartPos - 1); const size_t nPathOrLineStartPos = rLine.rfind(':', nLineOrColumnStartPos - 1);
const MIuint nPathOrLineLen = nLineOrColumnStartPos - nPathOrLineStartPos - 1; const size_t nPathOrLineLen = nLineOrColumnStartPos - nPathOrLineStartPos - 1;
const CMIUtilString strPathOrLine(rLine.substr(nPathOrLineStartPos + 1, nPathOrLineLen).c_str()); const CMIUtilString strPathOrLine(rLine.substr(nPathOrLineStartPos + 1, nPathOrLineLen).c_str());
const CMIUtilString strLine(strPathOrLine.IsNumber() ? strPathOrLine : strLineOrColumn); const CMIUtilString strLine(strPathOrLine.IsNumber() ? strPathOrLine : strLineOrColumn);
const CMICmnMIValueConst miValueConst2(strLine); const CMICmnMIValueConst miValueConst2(strLine);

View File

@ -159,8 +159,8 @@ CMICmdFactory::IsValid(const CMIUtilString &vMiCmd) const
return false; return false;
} }
const MIint nPos = vMiCmd.find(" "); const size_t nPos = vMiCmd.find(" ");
if (nPos != (MIint)std::string::npos) if (nPos != std::string::npos)
bValid = false; bValid = false;
return bValid; return bValid;

View File

@ -153,8 +153,8 @@ bool
CMICmdInterpreter::MiHasCmdTokenEndingHyphen(const CMIUtilString &vTextLine) CMICmdInterpreter::MiHasCmdTokenEndingHyphen(const CMIUtilString &vTextLine)
{ {
// The hyphen is mandatory // The hyphen is mandatory
const MIint nPos = vTextLine.find("-", 0); const size_t nPos = vTextLine.find("-", 0);
if ((nPos == (MIint)std::string::npos)) if ((nPos == std::string::npos))
return false; return false;
if (MiHasCmdTokenPresent(vTextLine)) if (MiHasCmdTokenPresent(vTextLine))
@ -215,7 +215,7 @@ CMICmdInterpreter::MiHasCmdTokenEndingAlpha(const CMIUtilString &vTextLine)
bool bool
CMICmdInterpreter::MiHasCmdTokenPresent(const CMIUtilString &vTextLine) CMICmdInterpreter::MiHasCmdTokenPresent(const CMIUtilString &vTextLine)
{ {
const MIint nPos = vTextLine.find("-", 0); const size_t nPos = vTextLine.find("-", 0);
return (nPos > 0); return (nPos > 0);
} }
@ -233,11 +233,11 @@ CMICmdInterpreter::MiHasCmdTokenPresent(const CMIUtilString &vTextLine)
bool bool
CMICmdInterpreter::MiHasCmd(const CMIUtilString &vTextLine) CMICmdInterpreter::MiHasCmd(const CMIUtilString &vTextLine)
{ {
MIint nPos = 0; size_t nPos = 0;
if (m_miCmdData.bMIOldStyle) if (m_miCmdData.bMIOldStyle)
{ {
char cChar = vTextLine[0]; char cChar = vTextLine[0];
MIuint i = 0; size_t i = 0;
while (::isdigit(cChar) != 0) while (::isdigit(cChar) != 0)
{ {
cChar = vTextLine[++i]; cChar = vTextLine[++i];
@ -250,9 +250,9 @@ CMICmdInterpreter::MiHasCmd(const CMIUtilString &vTextLine)
} }
bool bFoundCmd = false; bool bFoundCmd = false;
const MIint nLen = vTextLine.length(); const size_t nLen = vTextLine.length();
const MIint nPos2 = vTextLine.find(" ", nPos); const size_t nPos2 = vTextLine.find(" ", nPos);
if (nPos2 != (MIint)std::string::npos) if (nPos2 != std::string::npos)
{ {
if (nPos2 == nLen) if (nPos2 == nLen)
return false; return false;

View File

@ -283,8 +283,8 @@ CMICmnLogMediumFile::MassagedData(const CMIUtilString &vData, const CMICmnLog::E
data = ConvertCr(data); data = ConvertCr(data);
// Look for EOL... // Look for EOL...
const MIint pos = vData.rfind(strCr); const size_t pos = vData.rfind(strCr);
if (pos == (MIint)vData.size()) if (pos == vData.size())
return data; return data;
// ... did not have an EOL so add one // ... did not have an EOL so add one
@ -382,11 +382,11 @@ CMICmnLogMediumFile::ConvertCr(const CMIUtilString &vData) const
if (strCr == rCrCmpat) if (strCr == rCrCmpat)
return vData; return vData;
const MIuint nSizeCmpat(rCrCmpat.size()); const size_t nSizeCmpat(rCrCmpat.size());
const MIuint nSize(strCr.size()); const size_t nSize(strCr.size());
CMIUtilString strConv(vData); CMIUtilString strConv(vData);
MIint pos = strConv.find(strCr); size_t pos = strConv.find(strCr);
while (pos != (MIint)CMIUtilString::npos) while (pos != CMIUtilString::npos)
{ {
strConv.replace(pos, nSize, rCrCmpat); strConv.replace(pos, nSize, rCrCmpat);
pos = strConv.find(strCr, pos + nSizeCmpat); pos = strConv.find(strCr, pos + nSizeCmpat);

View File

@ -862,7 +862,7 @@ CMIDriver::WrapCLICommandIntoMICommand(const CMIUtilString &vTextLine) const
// Also possible case when command not found: // Also possible case when command not found:
// 001 // 001
// ^ -- i.e. only tokens are present (or empty string at all) // ^ -- i.e. only tokens are present (or empty string at all)
const MIuint nCommandOffset = vTextLine.find_first_not_of(digits); const size_t nCommandOffset = vTextLine.find_first_not_of(digits);
// 2. Check if command is empty // 2. Check if command is empty
// For example: // For example:
@ -872,7 +872,7 @@ CMIDriver::WrapCLICommandIntoMICommand(const CMIUtilString &vTextLine) const
// or: // or:
// 001 // 001
// ^ -- command wasn't found // ^ -- command wasn't found
const bool bIsEmptyCommand = (nCommandOffset == (MIuint)CMIUtilString::npos); const bool bIsEmptyCommand = (nCommandOffset == CMIUtilString::npos);
// 3. Check and exit if it isn't a CLI command // 3. Check and exit if it isn't a CLI command
// For example: // For example:

View File

@ -518,7 +518,7 @@ CMIDriverMgr::ParseArgs(const int argc, const char *argv[], bool &vwbExiting)
} }
if (0 == strArg.compare(0,10,"--log-dir=")) if (0 == strArg.compare(0,10,"--log-dir="))
{ {
strLogDir = strArg.substr(10,CMIUtilString::npos); strLogDir = strArg.substr(10, CMIUtilString::npos);
bHaveArgLogDir = true; bHaveArgLogDir = true;
} }
if ((0 == strArg.compare("--help")) || (0 == strArg.compare("-h"))) if ((0 == strArg.compare("--help")) || (0 == strArg.compare("-h")))

View File

@ -256,9 +256,9 @@ CMIUtilFileStd::GetLineReturn(void) const
CMIUtilString CMIUtilString
CMIUtilFileStd::StripOffFileName(const CMIUtilString &vDirectoryPath) CMIUtilFileStd::StripOffFileName(const CMIUtilString &vDirectoryPath)
{ {
const MIint nPos = vDirectoryPath.rfind('\\'); const size_t nPos = vDirectoryPath.rfind('\\');
MIint nPos2 = vDirectoryPath.rfind('/'); size_t nPos2 = vDirectoryPath.rfind('/');
if ((nPos == (MIint)std::string::npos) && (nPos2 == (MIint)std::string::npos)) if ((nPos == std::string::npos) && (nPos2 == std::string::npos))
return vDirectoryPath; return vDirectoryPath;
if (nPos > nPos2) if (nPos > nPos2)

View File

@ -202,10 +202,10 @@ CMIUtilString::FormatValist(const CMIUtilString &vrFormating, va_list vArgs)
// Args: vData - (R) String data to be split up. // Args: vData - (R) String data to be split up.
// vDelimiter - (R) Delimiter char or text. // vDelimiter - (R) Delimiter char or text.
// vwVecSplits - (W) Container of splits found in string data. // vwVecSplits - (W) Container of splits found in string data.
// Return: MIuint - Number of splits found in the string data. // Return: size_t - Number of splits found in the string data.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const CMIUtilString::Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const
{ {
vwVecSplits.clear(); vwVecSplits.clear();
@ -213,22 +213,22 @@ CMIUtilString::Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits)
if (this->empty() || vDelimiter.empty()) if (this->empty() || vDelimiter.empty())
return 0; return 0;
const MIuint nLen(length()); const size_t nLen(length());
MIuint nOffset(0); size_t nOffset(0);
do do
{ {
// Find first occurrence which doesn't match to the delimiter // Find first occurrence which doesn't match to the delimiter
const MIuint nSectionPos(FindFirstNot(vDelimiter, nOffset)); const size_t nSectionPos(FindFirstNot(vDelimiter, nOffset));
if (nSectionPos == (MIuint)std::string::npos) if (nSectionPos == std::string::npos)
break; break;
// Find next occurrence of the delimiter after section // Find next occurrence of the delimiter after section
MIuint nNextDelimiterPos(FindFirst(vDelimiter, nSectionPos)); size_t nNextDelimiterPos(FindFirst(vDelimiter, nSectionPos));
if (nNextDelimiterPos == (MIuint)std::string::npos) if (nNextDelimiterPos == std::string::npos)
nNextDelimiterPos = nLen; nNextDelimiterPos = nLen;
// Extract string between delimiters // Extract string between delimiters
const MIuint nSectionLen(nNextDelimiterPos - nSectionPos); const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
const std::string strSection(substr(nSectionPos, nSectionLen)); const std::string strSection(substr(nSectionPos, nSectionLen));
vwVecSplits.push_back(strSection.c_str()); vwVecSplits.push_back(strSection.c_str());
@ -251,10 +251,10 @@ CMIUtilString::Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits)
// Args: vData - (R) String data to be split up. // Args: vData - (R) String data to be split up.
// vDelimiter - (R) Delimiter char or text. // vDelimiter - (R) Delimiter char or text.
// vwVecSplits - (W) Container of splits found in string data. // vwVecSplits - (W) Container of splits found in string data.
// Return: MIuint - Number of splits found in the string data. // Return: size_t - Number of splits found in the string data.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const CMIUtilString::SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const
{ {
vwVecSplits.clear(); vwVecSplits.clear();
@ -262,29 +262,29 @@ CMIUtilString::SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t
if (this->empty() || vDelimiter.empty()) if (this->empty() || vDelimiter.empty())
return 0; return 0;
const MIuint nLen(length()); const size_t nLen(length());
MIuint nOffset(0); size_t nOffset(0);
do do
{ {
// Find first occurrence which doesn't match to the delimiter // Find first occurrence which doesn't match to the delimiter
const MIuint nSectionPos(FindFirstNot(vDelimiter, nOffset)); const size_t nSectionPos(FindFirstNot(vDelimiter, nOffset));
if (nSectionPos == (MIuint)std::string::npos) if (nSectionPos == std::string::npos)
break; break;
// Find next occurrence of the delimiter after (quoted) section // Find next occurrence of the delimiter after (quoted) section
const bool bSkipQuotedText(true); const bool bSkipQuotedText(true);
bool bUnmatchedQuote(false); bool bUnmatchedQuote(false);
MIuint nNextDelimiterPos(FindFirst(vDelimiter, bSkipQuotedText, bUnmatchedQuote, nSectionPos)); size_t nNextDelimiterPos(FindFirst(vDelimiter, bSkipQuotedText, bUnmatchedQuote, nSectionPos));
if (bUnmatchedQuote) if (bUnmatchedQuote)
{ {
vwVecSplits.clear(); vwVecSplits.clear();
return 0; return 0;
} }
if (nNextDelimiterPos == (MIuint)std::string::npos) if (nNextDelimiterPos == std::string::npos)
nNextDelimiterPos = nLen; nNextDelimiterPos = nLen;
// Extract string between delimiters // Extract string between delimiters
const MIuint nSectionLen(nNextDelimiterPos - nSectionPos); const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
const std::string strSection(substr(nSectionPos, nSectionLen)); const std::string strSection(substr(nSectionPos, nSectionLen));
vwVecSplits.push_back(strSection.c_str()); vwVecSplits.push_back(strSection.c_str());
@ -300,10 +300,10 @@ CMIUtilString::SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t
// Details: Split string into lines using \n and return an array of strings. // Details: Split string into lines using \n and return an array of strings.
// Type: Method. // Type: Method.
// Args: vwVecSplits - (W) Container of splits found in string data. // Args: vwVecSplits - (W) Container of splits found in string data.
// Return: MIuint - Number of splits found in the string data. // Return: size_t - Number of splits found in the string data.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::SplitLines(VecString_t &vwVecSplits) const CMIUtilString::SplitLines(VecString_t &vwVecSplits) const
{ {
return Split("\n", vwVecSplits); return Split("\n", vwVecSplits);
@ -320,8 +320,8 @@ CMIUtilString::SplitLines(VecString_t &vwVecSplits) const
CMIUtilString CMIUtilString
CMIUtilString::StripCREndOfLine(void) const CMIUtilString::StripCREndOfLine(void) const
{ {
const MIint nPos = rfind('\n'); const size_t nPos = rfind('\n');
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return *this; return *this;
const CMIUtilString strNew(substr(0, nPos).c_str()); const CMIUtilString strNew(substr(0, nPos).c_str());
@ -358,12 +358,12 @@ CMIUtilString::FindAndReplace(const CMIUtilString &vFind, const CMIUtilString &v
if (vFind.empty() || this->empty()) if (vFind.empty() || this->empty())
return *this; return *this;
MIint nPos = find(vFind); size_t nPos = find(vFind);
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return *this; return *this;
CMIUtilString strNew(*this); CMIUtilString strNew(*this);
while (nPos != (MIint)std::string::npos) while (nPos != std::string::npos)
{ {
strNew.replace(nPos, vFind.length(), vReplaceWith); strNew.replace(nPos, vFind.length(), vReplaceWith);
nPos += vReplaceWith.length(); nPos += vReplaceWith.length();
@ -389,8 +389,8 @@ CMIUtilString::IsNumber(void) const
if ((at(0) == '-') && (length() == 1)) if ((at(0) == '-') && (length() == 1))
return false; return false;
const MIint nPos = find_first_not_of("-.0123456789"); const size_t nPos = find_first_not_of("-.0123456789");
if (nPos != (MIint)std::string::npos) if (nPos != std::string::npos)
return false; return false;
return true; return true;
@ -411,8 +411,8 @@ CMIUtilString::IsHexadecimalNumber(void) const
return false; return false;
// Skip '0x..' prefix // Skip '0x..' prefix
const MIint nPos = find_first_not_of("01234567890ABCDEFabcedf", 2); const size_t nPos = find_first_not_of("01234567890ABCDEFabcedf", 2);
if (nPos != (MIint)std::string::npos) if (nPos != std::string::npos)
return false; return false;
return true; return true;
@ -457,8 +457,8 @@ CMIUtilString::ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const
{ {
vwrNumber = 0; vwrNumber = 0;
const MIint nPos = find_first_not_of("xX01234567890ABCDEFabcedf"); const size_t nPos = find_first_not_of("xX01234567890ABCDEFabcedf");
if (nPos != (MIint)std::string::npos) if (nPos != std::string::npos)
return false; return false;
errno = 0; errno = 0;
@ -482,11 +482,11 @@ CMIUtilString::ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const
bool bool
CMIUtilString::IsAllValidAlphaAndNumeric(const char *vpText) CMIUtilString::IsAllValidAlphaAndNumeric(const char *vpText)
{ {
const MIuint len = ::strlen(vpText); const size_t len = ::strlen(vpText);
if (len == 0) if (len == 0)
return false; return false;
for (MIuint i = 0; i < len; i++, vpText++) for (size_t i = 0; i < len; i++, vpText++)
{ {
const char c = *vpText; const char c = *vpText;
if (::isalnum((int)c) == 0) if (::isalnum((int)c) == 0)
@ -526,13 +526,13 @@ CMIUtilString::Trim(void) const
{ {
CMIUtilString strNew(*this); CMIUtilString strNew(*this);
const char *pWhiteSpace = " \t\n\v\f\r"; const char *pWhiteSpace = " \t\n\v\f\r";
const MIint nPos = find_last_not_of(pWhiteSpace); const size_t nPos = find_last_not_of(pWhiteSpace);
if (nPos != (MIint)std::string::npos) if (nPos != std::string::npos)
{ {
strNew = substr(0, nPos + 1).c_str(); strNew = substr(0, nPos + 1).c_str();
} }
const MIint nPos2 = strNew.find_first_not_of(pWhiteSpace); const size_t nPos2 = strNew.find_first_not_of(pWhiteSpace);
if (nPos2 != (MIint)std::string::npos) if (nPos2 != std::string::npos)
{ {
strNew = strNew.substr(nPos2).c_str(); strNew = strNew.substr(nPos2).c_str();
} }
@ -551,7 +551,7 @@ CMIUtilString
CMIUtilString::Trim(const char vChar) const CMIUtilString::Trim(const char vChar) const
{ {
CMIUtilString strNew(*this); CMIUtilString strNew(*this);
const MIint nLen = strNew.length(); const size_t nLen = strNew.length();
if (nLen > 1) if (nLen > 1)
{ {
if ((strNew[0] == vChar) && (strNew[nLen - 1] == vChar)) if ((strNew[0] == vChar) && (strNew[nLen - 1] == vChar))
@ -617,22 +617,22 @@ CMIUtilString::RemoveRepeatedCharacters(const char vChar)
// character. // character.
// Type: Method. // Type: Method.
// Args: vChar - (R) The character to search for and remove adjacent duplicates. // Args: vChar - (R) The character to search for and remove adjacent duplicates.
// vnPos - (R) Character position in the string. // vnPos - Character position in the string.
// Return: CMIUtilString - New version of the string. // Return: CMIUtilString - New version of the string.
// Throws: None. // Throws: None.
//-- //--
CMIUtilString CMIUtilString
CMIUtilString::RemoveRepeatedCharacters(const MIint vnPos, const char vChar) CMIUtilString::RemoveRepeatedCharacters(size_t vnPos, const char vChar)
{ {
const char cQuote = '"'; const char cQuote = '"';
// Look for first quote of two // Look for first quote of two
MIint nPos = find(cQuote, vnPos); const size_t nPos = find(cQuote, vnPos);
if (nPos == (MIint)std::string::npos) if (nPos == std::string::npos)
return *this; return *this;
const MIint nPosNext = nPos + 1; const size_t nPosNext = nPos + 1;
if (nPosNext > (MIint)length()) if (nPosNext > length())
return *this; return *this;
if (at(nPosNext) == cQuote) if (at(nPosNext) == cQuote)
@ -659,7 +659,7 @@ CMIUtilString::IsQuoted(void) const
if (at(0) != cQuote) if (at(0) != cQuote)
return false; return false;
const MIint nLen = length(); const size_t nLen = length();
if ((nLen > 0) && (at(nLen - 1) != cQuote)) if ((nLen > 0) && (at(nLen - 1) != cQuote))
return false; return false;
@ -670,12 +670,12 @@ CMIUtilString::IsQuoted(void) const
// Details: Find first occurrence in *this string which matches the pattern. // Details: Find first occurrence in *this string which matches the pattern.
// Type: Method. // Type: Method.
// Args: vrPattern - (R) The pattern to search for. // Args: vrPattern - (R) The pattern to search for.
// vnPos - (R) The starting position at which to start searching. (Dflt = 0) // vnPos - The starting position at which to start searching. (Dflt = 0)
// Return: MIuint - The position of the first substring that match. // Return: size_t - The position of the first substring that match.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::FindFirst(const CMIUtilString &vrPattern, const MIuint vnPos /* = 0 */) const CMIUtilString::FindFirst(const CMIUtilString &vrPattern, size_t vnPos /* = 0 */) const
{ {
return find(vrPattern, vnPos); return find(vrPattern, vnPos);
} }
@ -686,61 +686,61 @@ CMIUtilString::FindFirst(const CMIUtilString &vrPattern, const MIuint vnPos /* =
// Args: vrPattern - (R) The pattern to search for. // Args: vrPattern - (R) The pattern to search for.
// vbSkipQuotedText - (R) True = don't look at quoted text, false = otherwise. // vbSkipQuotedText - (R) True = don't look at quoted text, false = otherwise.
// vrwbNotFoundClosedQuote - (W) True = parsing error: unmatched quote, false = otherwise. // vrwbNotFoundClosedQuote - (W) True = parsing error: unmatched quote, false = otherwise.
// vnPos - (R) Position of the first character in the string to be considered in the search. (Dflt = 0) // vnPos - Position of the first character in the string to be considered in the search. (Dflt = 0)
// Return: MIuint - The position of the first substring that matches and isn't quoted. // Return: size_t - The position of the first substring that matches and isn't quoted.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::FindFirst(const CMIUtilString &vrPattern, const bool vbSkipQuotedText, bool &vrwbNotFoundClosedQuote, CMIUtilString::FindFirst(const CMIUtilString &vrPattern, const bool vbSkipQuotedText, bool &vrwbNotFoundClosedQuote,
const MIuint vnPos /* = 0 */) const size_t vnPos /* = 0 */) const
{ {
vrwbNotFoundClosedQuote = false; vrwbNotFoundClosedQuote = false;
if (!vbSkipQuotedText) if (!vbSkipQuotedText)
return FindFirst(vrPattern, vnPos); return FindFirst(vrPattern, vnPos);
const MIuint nLen(length()); const size_t nLen(length());
MIuint nPos = vnPos; size_t nPos = vnPos;
do do
{ {
const MIuint nQuotePos(FindFirstQuote(nPos)); const size_t nQuotePos(FindFirstQuote(nPos));
const MIuint nPatternPos(FindFirst(vrPattern, nPos)); const size_t nPatternPos(FindFirst(vrPattern, nPos));
if (nQuotePos == (MIuint)std::string::npos) if (nQuotePos == std::string::npos)
return nPatternPos; return nPatternPos;
const MIuint nQuoteClosedPos = FindFirstQuote(nQuotePos + 1); const size_t nQuoteClosedPos = FindFirstQuote(nQuotePos + 1);
if (nQuoteClosedPos == (MIuint)std::string::npos) if (nQuoteClosedPos == std::string::npos)
{ {
vrwbNotFoundClosedQuote = true; vrwbNotFoundClosedQuote = true;
return (MIuint)std::string::npos; return std::string::npos;
} }
if ((nPatternPos == (MIuint)std::string::npos) || (nPatternPos < nQuotePos)) if ((nPatternPos == std::string::npos) || (nPatternPos < nQuotePos))
return nPatternPos; return nPatternPos;
nPos = nQuoteClosedPos + 1; nPos = nQuoteClosedPos + 1;
} }
while (nPos < nLen); while (nPos < nLen);
return (MIuint)std::string::npos; return std::string::npos;
} }
//++ ------------------------------------------------------------------------------------ //++ ------------------------------------------------------------------------------------
// Details: Find first occurrence in *this string which doesn't match the pattern. // Details: Find first occurrence in *this string which doesn't match the pattern.
// Type: Method. // Type: Method.
// Args: vrPattern - (R) The pattern to search for. // Args: vrPattern - (R) The pattern to search for.
// vnPos - (R) Position of the first character in the string to be considered in the search. (Dflt = 0) // vnPos - Position of the first character in the string to be considered in the search. (Dflt = 0)
// Return: MIuint - The position of the first character that doesn't match. // Return: size_t - The position of the first character that doesn't match.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::FindFirstNot(const CMIUtilString &vrPattern, const MIuint vnPos /* = 0 */) const CMIUtilString::FindFirstNot(const CMIUtilString &vrPattern, size_t vnPos /* = 0 */) const
{ {
const MIuint nLen(length()); const size_t nLen(length());
const MIuint nPatternLen(vrPattern.length()); const size_t nPatternLen(vrPattern.length());
MIuint nPatternPos(vnPos); size_t nPatternPos(vnPos);
do do
{ {
const bool bMatchPattern(compare(nPatternPos, nPatternLen, vrPattern) == 0); const bool bMatchPattern(compare(nPatternPos, nPatternLen, vrPattern) == 0);
@ -750,29 +750,29 @@ CMIUtilString::FindFirstNot(const CMIUtilString &vrPattern, const MIuint vnPos /
} }
while (nPatternPos < nLen); while (nPatternPos < nLen);
return (MIuint)std::string::npos; return std::string::npos;
} }
//++ ------------------------------------------------------------------------------------ //++ ------------------------------------------------------------------------------------
// Details: Find first occurrence of not escaped quotation mark in *this string. // Details: Find first occurrence of not escaped quotation mark in *this string.
// Type: Method. // Type: Method.
// Args: vnPos - (R) Position of the first character in the string to be considered in the search. // Args: vnPos - Position of the first character in the string to be considered in the search.
// Return: MIuint - The position of the quotation mark. // Return: size_t - The position of the quotation mark.
// Throws: None. // Throws: None.
//-- //--
MIuint size_t
CMIUtilString::FindFirstQuote(const MIuint vnPos) const CMIUtilString::FindFirstQuote(size_t vnPos) const
{ {
const char cBckSlash('\\'); const char cBckSlash('\\');
const char cQuote('"'); const char cQuote('"');
const MIuint nLen(length()); const size_t nLen(length());
MIuint nPos = vnPos; size_t nPos = vnPos;
do do
{ {
const MIuint nBckSlashPos(find(cBckSlash, nPos)); const size_t nBckSlashPos(find(cBckSlash, nPos));
const MIuint nQuotePos(find(cQuote, nPos)); const size_t nQuotePos(find(cQuote, nPos));
if ((nBckSlashPos == (MIuint)std::string::npos) || (nQuotePos == (MIuint)std::string::npos)) if ((nBckSlashPos == std::string::npos) || (nQuotePos == std::string::npos))
return nQuotePos; return nQuotePos;
if (nQuotePos < nBckSlashPos) if (nQuotePos < nBckSlashPos)
@ -783,7 +783,7 @@ CMIUtilString::FindFirstQuote(const MIuint vnPos) const
} }
while (nPos < nLen); while (nPos < nLen);
return (MIuint)std::string::npos; return std::string::npos;
} }
//++ ------------------------------------------------------------------------------------ //++ ------------------------------------------------------------------------------------
@ -794,12 +794,12 @@ CMIUtilString::FindFirstQuote(const MIuint vnPos) const
// Throws: None. // Throws: None.
//-- //--
CMIUtilString CMIUtilString
CMIUtilString::Escape(const bool vbEscapeQuotes /* = false */) const CMIUtilString::Escape(bool vbEscapeQuotes /* = false */) const
{ {
const MIuint nLen(length()); const size_t nLen(length());
CMIUtilString strNew; CMIUtilString strNew;
strNew.reserve(nLen); strNew.reserve(nLen);
for (MIuint nIndex(0); nIndex < nLen; ++nIndex) for (size_t nIndex(0); nIndex < nLen; ++nIndex)
{ {
const char cUnescapedChar((*this)[nIndex]); const char cUnescapedChar((*this)[nIndex]);
if (cUnescapedChar == '"' && vbEscapeQuotes) if (cUnescapedChar == '"' && vbEscapeQuotes)
@ -822,22 +822,22 @@ CMIUtilString
CMIUtilString::AddSlashes(void) const CMIUtilString::AddSlashes(void) const
{ {
const char cBckSlash('\\'); const char cBckSlash('\\');
const MIuint nLen(length()); const size_t nLen(length());
CMIUtilString strNew; CMIUtilString strNew;
strNew.reserve(nLen); strNew.reserve(nLen);
MIuint nOffset(0); size_t nOffset(0);
while (nOffset < nLen) while (nOffset < nLen)
{ {
const MIuint nUnescapedCharPos(find_first_of("\"\\", nOffset)); const size_t nUnescapedCharPos(find_first_of("\"\\", nOffset));
const bool bUnescapedCharNotFound(nUnescapedCharPos == (MIuint)std::string::npos); const bool bUnescapedCharNotFound(nUnescapedCharPos == std::string::npos);
if (bUnescapedCharNotFound) if (bUnescapedCharNotFound)
{ {
const MIuint nAppendAll((MIuint)std::string::npos); const size_t nAppendAll(std::string::npos);
strNew.append(*this, nOffset, nAppendAll); strNew.append(*this, nOffset, nAppendAll);
break; break;
} }
const MIuint nAppendLen(nUnescapedCharPos - nOffset); const size_t nAppendLen(nUnescapedCharPos - nOffset);
strNew.append(*this, nOffset, nAppendLen); strNew.append(*this, nOffset, nAppendLen);
strNew.push_back(cBckSlash); strNew.push_back(cBckSlash);
const char cUnescapedChar((*this)[nUnescapedCharPos]); const char cUnescapedChar((*this)[nUnescapedCharPos]);
@ -859,22 +859,22 @@ CMIUtilString
CMIUtilString::StripSlashes(void) const CMIUtilString::StripSlashes(void) const
{ {
const char cBckSlash('\\'); const char cBckSlash('\\');
const MIuint nLen(length()); const size_t nLen(length());
CMIUtilString strNew; CMIUtilString strNew;
strNew.reserve(nLen); strNew.reserve(nLen);
MIuint nOffset(0); size_t nOffset(0);
while (nOffset < nLen) while (nOffset < nLen)
{ {
const MIuint nBckSlashPos(find(cBckSlash, nOffset)); const size_t nBckSlashPos(find(cBckSlash, nOffset));
const bool bBckSlashNotFound(nBckSlashPos == (MIuint)std::string::npos); const bool bBckSlashNotFound(nBckSlashPos == std::string::npos);
if (bBckSlashNotFound) if (bBckSlashNotFound)
{ {
const MIuint nAppendAll((MIuint)std::string::npos); const size_t nAppendAll(std::string::npos);
strNew.append(*this, nOffset, nAppendAll); strNew.append(*this, nOffset, nAppendAll);
break; break;
} }
const MIuint nAppendLen(nBckSlashPos - nOffset); const size_t nAppendLen(nBckSlashPos - nOffset);
strNew.append(*this, nOffset, nAppendLen); strNew.append(*this, nOffset, nAppendLen);
const bool bBckSlashIsLast(nBckSlashPos == nLen); const bool bBckSlashIsLast(nBckSlashPos == nLen);
if (bBckSlashIsLast) if (bBckSlashIsLast)
@ -883,8 +883,8 @@ CMIUtilString::StripSlashes(void) const
break; break;
} }
const char cEscapedChar((*this)[nBckSlashPos + 1]); const char cEscapedChar((*this)[nBckSlashPos + 1]);
const MIuint nEscapedCharPos(std::string("\"\\").find(cEscapedChar)); const size_t nEscapedCharPos(std::string("\"\\").find(cEscapedChar));
const bool bEscapedCharNotFound(nEscapedCharPos == (MIuint)std::string::npos); const bool bEscapedCharNotFound(nEscapedCharPos == std::string::npos);
if (bEscapedCharNotFound) if (bEscapedCharNotFound)
strNew.push_back(cBckSlash); strNew.push_back(cBckSlash);
strNew.push_back(cEscapedChar); strNew.push_back(cEscapedChar);

View File

@ -53,18 +53,18 @@ class CMIUtilString : public std::string
bool IsHexadecimalNumber(void) const; bool IsHexadecimalNumber(void) const;
bool IsQuoted(void) const; bool IsQuoted(void) const;
CMIUtilString RemoveRepeatedCharacters(const char vChar); CMIUtilString RemoveRepeatedCharacters(const char vChar);
MIuint Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const; size_t Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const;
MIuint SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const; size_t SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const;
MIuint SplitLines(VecString_t &vwVecSplits) const; size_t SplitLines(VecString_t &vwVecSplits) const;
CMIUtilString StripCREndOfLine(void) const; CMIUtilString StripCREndOfLine(void) const;
CMIUtilString StripCRAll(void) const; CMIUtilString StripCRAll(void) const;
CMIUtilString Trim(void) const; CMIUtilString Trim(void) const;
CMIUtilString Trim(const char vChar) const; CMIUtilString Trim(const char vChar) const;
MIuint FindFirst(const CMIUtilString &vrPattern, const MIuint vnPos = 0) const; size_t FindFirst(const CMIUtilString &vrPattern, size_t vnPos = 0) const;
MIuint FindFirst(const CMIUtilString &vrPattern, const bool vbSkipQuotedText, bool &vrwbNotFoundClosedQuote, size_t FindFirst(const CMIUtilString &vrPattern, bool vbSkipQuotedText, bool &vrwbNotFoundClosedQuote,
const MIuint vnPos = 0) const; size_t vnPos = 0) const;
MIuint FindFirstNot(const CMIUtilString &vrPattern, const MIuint vnPos = 0) const; size_t FindFirstNot(const CMIUtilString &vrPattern, size_t vnPos = 0) const;
CMIUtilString Escape(const bool vbEscapeQuotes = false) const; CMIUtilString Escape(bool vbEscapeQuotes = false) const;
CMIUtilString AddSlashes(void) const; CMIUtilString AddSlashes(void) const;
CMIUtilString StripSlashes(void) const; CMIUtilString StripSlashes(void) const;
// //
@ -82,6 +82,6 @@ class CMIUtilString : public std::string
// Methods: // Methods:
private: private:
bool ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const; bool ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const;
CMIUtilString RemoveRepeatedCharacters(const MIint vnPos, const char vChar); CMIUtilString RemoveRepeatedCharacters(size_t vnPos, const char vChar);
MIuint FindFirstQuote(const MIuint vnPos) const; size_t FindFirstQuote(size_t vnPos) const;
}; };