本文整理汇总了C++中FactoryResource::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::clear方法的具体用法?C++ FactoryResource::clear怎么用?C++ FactoryResource::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: numBytes
//.........这里部分代码省略.........
"-3.67806E-12" // SAMPLE_NUMERATOR_COEF_PREFIX
"-5.165706E-7" // SAMPLE_NUMERATOR_COEF_PREFIX
"+1.80431E-11" // SAMPLE_NUMERATOR_COEF_PREFIX
"-1.27129E-14" // SAMPLE_NUMERATOR_COEF_PREFIX
"+6.73947E-11" // SAMPLE_NUMERATOR_COEF_PREFIX
"-6.15359E-13" // SAMPLE_NUMERATOR_COEF_PREFIX
"+4.17329E-15" // SAMPLE_NUMERATOR_COEF_PREFIX
"+1.000000E+0" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+6.416136E-4" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-3.216630E-3" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+3.835487E-7" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-2.931790E-7" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+6.94669E-11" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-2.79189E-10" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-4.228677E-7" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+1.511759E-6" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-3.68835E-12" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+2.38470E-14" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-7.25739E-11" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+5.28938E-11" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-4.96651E-15" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+5.10645E-10" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-2.11044E-12" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+5.46322E-14" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-4.30517E-14" // SAMPLE_DENOMINATOR_COEF_PREFIX
"-3.21303E-14" // SAMPLE_DENOMINATOR_COEF_PREFIX
"+3.33432E-14" // SAMPLE_DENOMINATOR_COEF_PREFIX
);
FactoryResource<DynamicObject> treDO;
size_t numBytes(0);
istringstream input(data);
numBytes = data.size();
string errorMessage;
bool success = toDynamicObject(input, numBytes, *treDO.get(), errorMessage);
if (!errorMessage.empty())
{
failure << errorMessage << endl;
errorMessage.clear();
}
TreState status(INVALID);
if (success)
{
status = isTreValid(*treDO.get(), failure);
}
treDO->clear();
if (status == INVALID)
{
return false;
}
// Start of test 2 - Negative test: 1 extra byte in input stream
stringstream input2(data);
input2 << "1"; // Add one more byte; valid as alphanumberic or numeric
numBytes = data.size() + 1;
success = toDynamicObject(input2, numBytes, *treDO.get(), errorMessage);
if (success == true) // negative test so success must == false.
{
failure << "Error: Negative test of 1 extra byte failed\n";
treDO->clear();
return false;
}
// start of test 3 - Negative test: 1 byte short in input stream
string negdata3(data); // data for test 3 not the 3rd data set
negdata3.resize(data.size()-1);
stringstream input3(negdata3);
numBytes = negdata3.size();
success = toDynamicObject(input3, numBytes, *treDO.get(), errorMessage);
if (success == true) // negative test so success must == false.
{
failure << "Error: Negative test of 1 byte short failed\n";
treDO->clear();
return false;
}
// Start of test 4 - false parser test
stringstream input4(data_error4);
numBytes = input4.str().size();
success = toDynamicObject(input4, numBytes, *treDO.get(), errorMessage);
if (success)
{
failure << "Error: Negative test: LINE_OFFSET floating point in int field failed: did not return false\n";
return false;
}
treDO->clear();
return (status != INVALID);
}
示例2: numBytes
bool Nitf::SectgaParser::runAllTests(Progress* pProgress, ostream& failure)
{
static const string data(
"123456789012" // SEC_ID
"123456789012345" // SEC_BE
"0" // RESERVED001
);
static const string data_error4(
"123456789012" // SEC_ID
"123456789012345" // SEC_BE
" " // RESERVED001 ERROR: must == "0"
);
FactoryResource<DynamicObject> treDO;
size_t numBytes(0);
istringstream input(data);
numBytes = data.size();
string errorMessage;
bool success = toDynamicObject(input, numBytes, *treDO.get(), errorMessage);
if (!errorMessage.empty())
{
failure << errorMessage << endl;
errorMessage.clear();
}
TreState status(INVALID);
if (success)
{
status = isTreValid(*treDO.get(), failure);
}
treDO->clear();
if (status == INVALID)
{
return false;
}
// Start of test 2 - Negative test: 1 extra byte in input stream
stringstream input2(data);
input2 << "1"; // Add one more byte; valid as alphanumberic or numeric
numBytes = data.size() + 1;
success = toDynamicObject(input2, numBytes, *treDO.get(), errorMessage);
if (success == true) // negative test so success must == false.
{
failure << "Error: Negative test of 1 extra byte failed\n";
treDO->clear();
return false;
}
// start of test 3 - Negative test: 1 byte short in input stream
string negdata3(data); // data for test 3 not the 3rd data set
negdata3.resize(data.size()-1);
stringstream input3(negdata3);
numBytes = negdata3.size();
success = toDynamicObject(input3, numBytes, *treDO.get(), errorMessage);
if (success == true) // negative test so success must == false.
{
failure << "Error: Negative test of 1 byte short failed\n";
treDO->clear();
return false;
}
treDO->clear();
// Start of test 4 - SUSPECT test
stringstream input4(data_error4);
numBytes = input4.str().size();
success = toDynamicObject(input4, numBytes, *treDO.get(), errorMessage);
status = INVALID;
if (success)
{
failure << "Error: Negative test with data out of range failed: did not return false\n";
treDO->clear();
return false;
}
treDO->clear();
return true;
}
示例3: numBytes
bool Nitf::PatchbParser::runAllTests(Progress* pProgress, ostream& failure)
{
static const string data(
"0999" // PAT_NO
"0" // LAST_PAT_FLAG
"1234567" // LNSTRT
"1234567" // LNSTOP
"12345" // AZL
"12345" // NVL
"681" // FVL
"43000" // NPIXEL
"43000" // FVPIX
"512" // FRAME
"86399.99" // UTC
"359.999" // SHEAD
"31.0000" // GRAVITY
"09999" // INS_V_NC
"+9999" // INS_V_EC
"-9999" // INS_V_DC
"+80.0000" // OFFLAT
"-80.0000" // OFFLONG
"359" // TRACK
"120.00" // GSWEEP
"1.000000" // SHEAR
"000001" // BATCH_NO
);
static const string data_error4(
"0999" // PAT_NO
"0" // LAST_PAT_FLAG
"0000000" // LNSTRT
"1234567" // LNSTOP
"12345" // AZL
"12345" // NVL
"681" // FVL
"43000" // NPIXEL
"43000" // FVPIX
"512" // FRAME
"86399.99" // UTC
"359.999" // SHEAD
"31.0000" // GRAVITY
"09999" // INS_V_NC
"+9999" // INS_V_EC
"-9999" // INS_V_DC
"+80.0000" // OFFLAT
"-80.0000" // OFFLONG
"359" // TRACK
"120.00" // GSWEEP
"1.000000" // SHEAR
"000001" // BATCH_NO
);
static const string data5(
"0999" // PAT_NO
"0" // LAST_PAT_FLAG - set to spaces
"1234567" // LNSTRT
"1234567" // LNSTOP
"12345" // AZL
" " // NVL - set to spaces
" " // FVL - set to spaces
"43000" // NPIXEL
"43000" // FVPIX
" " // FRAME - set to spaces
"86399.99" // UTC
"359.999" // SHEAD
" " // GRAVITY - set to spaces
"+9999" // INS_V_NC
"+9999" // INS_V_EC
"-9999" // INS_V_DC
" " // OFFLAT - set to spaces
" " // OFFLONG - set to spaces
"359" // TRACK
"120.00" // GSWEEP
" " // SHEAR - set to spaces
" " // BATCH_NO - set to spaces
);
FactoryResource<DynamicObject> treDO;
size_t numBytes(0);
istringstream input(data);
numBytes = data.size();
string errorMessage;
bool success = toDynamicObject(input, numBytes, *treDO.get(), errorMessage);
if (!errorMessage.empty())
{
failure << errorMessage << endl;
errorMessage.clear();
}
TreState status(INVALID);
if (success)
{
status = isTreValid(*treDO.get(), failure);
}
treDO->clear();
//.........这里部分代码省略.........
示例4: numBytes
//.........这里部分代码省略.........
"19.99" // BANDLBOUND
"00.01" // BANDUBOUND
"19.99" // BANDWIDTH
"0000.1" // BANDCALDRK
"00.01" // BANDCALINC
"000.1" // BANDRESP
"999.9" // BANDASD
"99.99" // BANDGSD
"00.01" // BANDPEAK
"19.99" // BANDLBOUND
"00.01" // BANDUBOUND
"19.99" // BANDWIDTH
"0000.1" // BANDCALDRK
"00.01" // BANDCALINC
"000.1" // BANDRESP
"999.9" // BANDASD
"99.99" // BANDGSD
);
FactoryResource<DynamicObject> treDO;
size_t numBytes(0);
istringstream input(data);
numBytes = data.size();
string errorMessage;
bool success = toDynamicObject(input, numBytes, *treDO.get(), errorMessage);
if (!errorMessage.empty())
{
failure << errorMessage << endl;
errorMessage.clear();
}
TreState status(INVALID);
if (success)
{
status = isTreValid(*treDO.get(), failure);
}
treDO->clear();
if (status == INVALID)
{
return false;
}
// Start of test 2 - Negative test: 1 extra byte in input stream
stringstream input2(data);
input2 << "1"; // Add one more byte; valid as alphanumberic or numeric
numBytes = data.size() + 1;
success = toDynamicObject(input2, numBytes, *treDO.get(), errorMessage);
if (success == true) // negative test so success must == false.
{
failure << "Error: Negative test of 1 extra byte failed\n";
treDO->clear();
return false;
}
// start of test 3 - Negative test: 1 byte short in input stream
string negdata3(data); // data for test 3 not the 3rd data set
negdata3.resize(data.size()-1);
stringstream input3(negdata3);
numBytes = negdata3.size();