本文整理汇总了C++中String::AsInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ String::AsInteger方法的具体用法?C++ String::AsInteger怎么用?C++ String::AsInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::AsInteger方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//.........这里部分代码省略.........
<< "but was not specified" << std::endl;
return(-1);
}
if((storeOrig.Length() != 0) && (storeOrig.Length() != 2))
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "--storeOrig tag name must be 2 characters.\n";
return(-1);
}
myOverlapHandler = new OverlapClipLowerBaseQual();
if(myOverlapHandler == NULL)
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "Failed to allocate the overlap handler\n";
return(-1);
}
if(unmapped)
{
myOverlapHandler->markAsUnmapped();
}
// Setup the overlap handler.
myOverlapHandler->keepStats(stats);
if(storeOrig.Length() != 0)
{
myOverlapHandler->storeOrigCigar(storeOrig);
}
myIntExcludeFlags = excludeFlags.AsInteger();
if(params)
{
inputParameters.Status();
}
// For each step process the file.
// Open the files & read/write the sam header.
SamStatus::Status runStatus = SamStatus::SUCCESS;
for(int i = 1; i <= myOverlapHandler->numSteps(); i++)
{
// Open the file for reading.
mySamHeader.resetHeader();
SamFile samIn(inFile, SamFile::READ, &mySamHeader);
SamFile* samOutPtr = NULL;
// Check if writing, if so, open the output file.
if(i == myOverlapHandler->numSteps())
{
samOutPtr = new SamFile(outFile, SamFile::WRITE, &mySamHeader);
}
if(readName)
{
if(!noRNValidate)
{
samIn.setSortedValidation(SamFile::QUERY_NAME);
}
runStatus = handleSortedByReadName(samIn, samOutPtr);
}
else
{
// Coordinate sorted, so work with the pools.
示例2: execute
int Dedup_LowMem::execute(int argc, char** argv)
{
/* --------------------------------
* process the arguments
* -------------------------------*/
String inFile, outFile, logFile;
myDoRecab = false;
bool removeFlag = false;
bool verboseFlag = false;
myForceFlag = false;
myNumMissingMate = 0;
myMinQual = DEFAULT_MIN_QUAL;
String excludeFlags = "0xB04";
uint16_t intExcludeFlags = 0;
bool noeof = false;
bool params = false;
LongParamContainer parameters;
parameters.addGroup("Required Parameters");
parameters.addString("in", &inFile);
parameters.addString("out", &outFile);
parameters.addGroup("Optional Parameters");
parameters.addInt("minQual", & myMinQual);
parameters.addString("log", &logFile);
parameters.addBool("oneChrom", &myOneChrom);
parameters.addBool("recab", &myDoRecab);
parameters.addBool("rmDups", &removeFlag);
parameters.addBool("force", &myForceFlag);
parameters.addString("excludeFlags", &excludeFlags);
parameters.addBool("verbose", &verboseFlag);
parameters.addBool("noeof", &noeof);
parameters.addBool("params", ¶ms);
parameters.addPhoneHome(VERSION);
myRecab.addRecabSpecificParameters(parameters);
ParameterList inputParameters;
inputParameters.Add(new LongParameters ("Input Parameters",
parameters.getLongParameterList()));
// parameters start at index 2 rather than 1.
inputParameters.Read(argc, argv, 2);
// If no eof block is required for a bgzf file, set the bgzf file type to
// not look for it.
if(noeof)
{
// Set that the eof block is not required.
BgzfFileType::setRequireEofBlock(false);
}
if(inFile.IsEmpty())
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "Specify an input file" << std::endl;
return EXIT_FAILURE;
}
if(outFile.IsEmpty())
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "Specify an output file" << std::endl;
return EXIT_FAILURE;
}
intExcludeFlags = excludeFlags.AsInteger();
if(myForceFlag && SamFlag::isDuplicate(intExcludeFlags))
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "Cannot specify --force and Duplicate in the excludeFlags. Since --force indicates to override"
<< " previous duplicate setting and the excludeFlags says to skip those, you can't do both.\n";
return EXIT_FAILURE;
}
if(!SamFlag::isSecondary(intExcludeFlags))
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "ERROR: Secondary reads must be excluded, edit --excludeFlags to include 0x0100\n";
return EXIT_FAILURE;
}
if(!(intExcludeFlags & SamFlag::SUPPLEMENTARY_ALIGNMENT))
{
printUsage(std::cerr);
inputParameters.Status();
std::cerr << "ERROR: Supplementary reads must be excluded, edit --excludeFlags to include 0x0800\n";
return EXIT_FAILURE;
}
if(logFile.IsEmpty())
{
logFile = outFile + ".log";
}
if(myDoRecab)
{
//.........这里部分代码省略.........
示例3: testAsInteger
void testAsInteger()
{
// Test AsInteger with ints & negative ints.
String intString = "123";
String negIntString = "-123";
assert(intString.AsInteger() == 123);
assert(negIntString.AsInteger() == -123);
// Run the same tests with AsInteger that returns a bool and takes
// in a long to set.
long retValue;
assert(intString.AsInteger(retValue));
assert(retValue == 123);
assert(negIntString.AsInteger(retValue));
assert(retValue == -123);
// Strings that are not integers
// For AsInteger, it returns just the starting integer portion.
// For AsInteger that returns a bool and a long set, it returns false
// and sets the long to the starting int.
String nonIntString = "abd";
assert(nonIntString.AsInteger() == 0);
assert(!nonIntString.AsInteger(retValue));
nonIntString = "12ab33";
assert(nonIntString.AsInteger() == 12);
assert(!nonIntString.AsInteger(retValue));
assert(retValue == 12);
nonIntString = "as12ab3a4sd";
assert(nonIntString.AsInteger() == 0);
assert(!nonIntString.AsInteger(retValue));
assert(retValue == 0);
// Negatives are only recognized as the first characer.
nonIntString = "-12ab3a4sd";
assert(nonIntString.AsInteger() == -12);
assert(!nonIntString.AsInteger(retValue));
assert(retValue == -12);
nonIntString = "-as12ab3a4sd";
assert(nonIntString.AsInteger() == 0);
assert(!nonIntString.AsInteger(retValue));
assert(retValue == 0);
nonIntString = "as-12ab3a4sd";
assert(nonIntString.AsInteger() == 0);
assert(!nonIntString.AsInteger(retValue));
assert(retValue == 0);
nonIntString = "as12-ab3a4sd";
assert(nonIntString.AsInteger() == 0);
assert(!nonIntString.AsInteger(retValue));
assert(retValue == 0);
}