当前位置: 首页>>代码示例>>C++>>正文


C++ QuickString::clear方法代码示例

本文整理汇总了C++中QuickString::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QuickString::clear方法的具体用法?C++ QuickString::clear怎么用?C++ QuickString::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QuickString的用法示例。


在下文中一共展示了QuickString::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getLine

bool BufferedStreamMgr::getLine(QuickString &line)
{
    line.clear();

    if (_mainBufCurrStartPos >= _mainBufCurrLen) {
        if (!readFileChunk()) {
            _eof = true;
            return false;
        }
    }
    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
                return true;
            }
        } else if (_mainBuf[searchPos] == '\n') {
            return true;
        }
    }
}
开发者ID:nkindlon,项目名称:nekBedtools,代码行数:27,代码来源:BufferedStreamMgr.cpp

示例2: 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;
}
开发者ID:nkindlon,项目名称:nekBedtools,代码行数:16,代码来源:BufferedStreamMgr.cpp

示例3: loadGenomeFileIntoMap

void NewGenomeFile::loadGenomeFileIntoMap() {


	ifstream genFile(_genomeFileName.c_str());
	if (!genFile.good()) {
		cerr << "Error: Can't open genome file" << _genomeFileName << "Exiting..." << endl;
		exit(1);
	}
	string sLine;
	Tokenizer fieldTokens;
	CHRPOS chrSize = 0;
	QuickString chrName;
	while (!genFile.eof()) {
		sLine.clear();
		chrSize = 0;
		chrName.clear();
		getline(genFile, sLine);
		int numFields = fieldTokens.tokenize(sLine.c_str());
		if (numFields != 2) {
			continue;
		}
		chrName = fieldTokens.getElem(0);
		chrSize = str2chrPos(fieldTokens.getElem(1));
		_maxId++;
		_chromSizeIds[chrName] = pair<CHRPOS, int>(chrSize, _maxId);
		_startOffsets.push_back(_genomeLength);
		_genomeLength += chrSize;
		_chromList.push_back(chrName);
	}
	if (_maxId == -1) {
		cerr << "Error: The genome file " << _genomeFileName << " has no valid entries. Exiting." << endl;
		exit(1);
	}
	// Special: BAM files can have unmapped reads, which show as no chromosome, or an empty chrom string.
	// Add in an empty chrom so these don't error.
	_maxId++;
	_chromSizeIds[""] = pair<CHRPOS, int>(0, _maxId);
	_chromList.push_back("");


	_startOffsets.push_back(_genomeLength); //insert the final length as the last element
	//to help with the lower_bound call in the projectOnGenome method.
	genFile.close();
}
开发者ID:Annaerial,项目名称:bedtools2,代码行数:44,代码来源:NewGenomeFile.cpp

示例4: 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;
}
开发者ID:Annaerial,项目名称:bedtools2,代码行数:38,代码来源:BufferedStreamMgr.cpp


注:本文中的QuickString::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。