本文整理汇总了C++中QuickString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QuickString::size方法的具体用法?C++ QuickString::size怎么用?C++ QuickString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickString
的用法示例。
在下文中一共展示了QuickString::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isNumeric
//This functions recognizes only numbers with digits, plus sign, minus sign, decimal point, e, or E. Hexadecimal and pointers not currently supported.
bool isNumeric(const QuickString &str) {
for (int i=0; i < (int)str.size(); i++) {
char currChar = str[i];
if (!(isdigit(currChar) || currChar == '-' || currChar == '.' || currChar == '+' || currChar == 'e' || currChar == 'E')) {
return false;
}
}
return true;
}
示例2: stricmp
bool QuickString::stricmp(const QuickString &str) const {
if (str.size() != _currSize) {
return true;
}
for (size_t i=0; i < _currSize; i++) {
if (tolower(str[i]) != tolower(_buffer[i])) {
return true;
}
}
return false;
}
示例3: parseIoBufSize
bool ContextBase::parseIoBufSize(QuickString bufStr)
{
char lastChar = bufStr[bufStr.size()-1];
int multiplier = 1;
if (!isdigit(lastChar)) {
switch (lastChar) {
case 'K':
multiplier = 1 << 10;
break;
case 'M':
multiplier = 1 << 20;
break;
case 'G':
multiplier = 1 << 30;
break;
default:
_errorMsg = "\n***** ERROR: Unrecognized memory buffer size suffix \'";
_errorMsg += lastChar;
_errorMsg += "\' given. *****";
return false;
break;
}
//lop off suffix character
bufStr.resize(bufStr.size()-1);
}
if (!isNumeric(bufStr)) {
_errorMsg = "\n***** ERROR: argument passed to -iobuf is not numeric. *****";
return false;
}
_ioBufSize = str2chrPos(bufStr) * multiplier;
if (_ioBufSize < MIN_ALLOWED_BUF_SIZE) {
_errorMsg = "\n***** ERROR: specified buffer size is too small. *****";
return false;
}
return true;
}
示例4: getTypeData
bool BufferedStreamMgr::getTypeData()
{
QuickString currScanBuffer;
_inputStreamMgr->getSavedData(currScanBuffer);
do {
if (!_typeChecker.scanBuffer(currScanBuffer.c_str(), currScanBuffer.size()) && !_typeChecker.needsMoreData()) {
return false;
} else if (_typeChecker.needsMoreData()) {
_inputStreamMgr->populateScanBuffer();
currScanBuffer.clear();
_inputStreamMgr->getSavedData(currScanBuffer);
}
} while (_typeChecker.needsMoreData());
_inputStreamMgr->reset();
return true;
}
示例5:
void QuickString<quickSize>::swap(QuickString<quickSize>& str)
{
/* Cannot swap if they are not of the same OneString type */
if(str.size() > quickSize)
{
ioc << cat_error << ta_bold << fg_red << "OneStringBase Error" <<
": The OneStringBase argument is too large to"
<< " swap with" <<io_end;
}
else
{
/* Swap the values */
QuickString<quickSize> temp = *this;
*this = str;
str = temp;
}
}
示例6: getLine
bool BufferedStreamMgr::getLine(QuickString &line)
{
line.clear();
if (_mainBufCurrStartPos >= _mainBufCurrLen) {
if (!readFileChunk()) {
_eof = true;
return false;
}
}
bool retVal = true;
while (1) {
int searchPos = _mainBufCurrStartPos;
while (searchPos < _mainBufCurrLen && _mainBuf[searchPos] != '\n') {
searchPos++;
}
line.append((char *)_mainBuf + _mainBufCurrStartPos, searchPos - _mainBufCurrStartPos);
_mainBufCurrStartPos = searchPos +1;
if (searchPos == _mainBufCurrLen) { //hit end of buffer, but no newline yet
if (!readFileChunk()) { //hit eof
retVal = true;
break;
}
} else if (_mainBuf[searchPos] == '\n') {
retVal = true;
break;
}
}
//strip any whitespace characters, such as DOS newline characters or extra tabs,
//from the end of the line
int lastPos = line.size();
while (isspace(line[lastPos-1])) lastPos--;
line.resize(lastPos);
return retVal;
}
示例7: str2chrPos
int str2chrPos(const QuickString &str) {
return str2chrPos(str.c_str(), str.size());
}