本文整理汇总了C++中AsnBuf::ResetMode方法的典型用法代码示例。如果您正苦于以下问题:C++ AsnBuf::ResetMode方法的具体用法?C++ AsnBuf::ResetMode怎么用?C++ AsnBuf::ResetMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsnBuf
的用法示例。
在下文中一共展示了AsnBuf::ResetMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool AsnBuf::operator<(const AsnBuf &rhs) const
{
bool lessThan = true;
bool firstTime = true;
ResetMode();
rhs.ResetMode();
std::streambuf::int_type ch1;
std::streambuf::int_type ch2;
while ( lessThan )
{
try
{
ch1 = GetUByte();
}
catch (BufferException &)
{
ch1 = EOF;
}
try
{
ch2 = rhs.GetUByte();
}
catch (BufferException &)
{
ch2 = EOF;
}
if ((ch1 == EOF) && (ch2 == EOF))
{
if (firstTime)
lessThan = false;
break;
}
else if (ch2 == EOF)
{
lessThan = false;
break;
}
else if (ch1 == EOF)
{
break;
}
if (ch1 > ch2)
lessThan = false;
else if (ch1 < ch2)
break;
firstTime = false;
}
ResetMode();
rhs.ResetMode();
return lessThan;
}
示例2: TestSetSorting
void TestSetSorting(void)
{
int i = 0;
while (gSetSortingTable[i].input != NULL)
{
AsnLen bytesDecoded=0, bytesEncoded;
//TestSetSorting1 testSetSorting1;
int ch;
std::string input, result;
hex2str(gSetSortingTable[i].input, input);
hex2str(gSetSortingTable[i].derSorted, result);
std::stringstream ssInput(input);
std::stringstream ssResult(result);
AsnBuf inputBuf(ssInput);
AsnBuf expectedResultBuf(ssResult);
AsnBuf outputBuf;
inputBuf.ResetMode();
expectedResultBuf.ResetMode();
gSetSortingTable[i].asnType->BDec(inputBuf, bytesDecoded);
bytesEncoded = gSetSortingTable[i].asnType->BEnc(outputBuf);
if (bytesEncoded != bytesDecoded)
{
std::cout << "Encoded / Decode byte length mismatch!!!\n";
}
if (outputBuf == expectedResultBuf)
{
std::cout << "SET sorting SUCCESS!\n";
}
else
{
std::cout << "SET sorting FAILURE!\n";
std::string str;
std::cout << "Expected result: ";
expectedResultBuf.hexDump(std::cout);
std::cout << std::endl;
std::cout << "Actual result : ";
outputBuf.ResetMode();
outputBuf.hexDump(std::cout);
std::cout << std::endl;
}
i++;
}
multiCardSetTest();
}
示例3: ResetMode
bool AsnBuf::operator == (const AsnBuf &b) const
{
bool equal = true;
ResetMode();
b.ResetMode();
std::streambuf::int_type ch1;
std::streambuf::int_type ch2;
while ( equal )
{
try
{
ch1 = GetUByte();
}
catch (BufferException &)
{
ch1 = EOF;
}
try
{
ch2 = b.GetUByte();
}
catch (BufferException &)
{
ch2 = EOF;
}
if ((ch1 == EOF) && (ch1 == EOF))
break;
if (ch1 != ch2)
equal = false;
}
ResetMode();
b.ResetMode();
return equal;
}
示例4: multiCardSetTest
void multiCardSetTest()
{
OctetStringSetOf octsSet;
unsigned char test[10213];
fillTestBuffer(test,10213);
octsSet.insert(octsSet.end(), SNACC::AsnOcts())->Set((char*)test, 10213);
std::cout << "**** LARGE SET OF OCTET STRING TEST ****\n";
AsnBuf tmpBuf;
AsnLen bytesEncoded = octsSet.BEnc(tmpBuf);
checkBuf(tmpBuf);
AsnLen bytesDecoded = 0;
std::stringstream ss;
ss << tmpBuf;
OctetStringSetOf octsSet2;
tmpBuf.ResetMode();
octsSet2.BDec(tmpBuf, bytesDecoded);
if (bytesEncoded != bytesDecoded)
{
std::cout << "Bytes encoded/decoded do not match\n";
}
if (checkTestBuffer(octsSet2.front().c_ustr(), octsSet2.front().Len()))
{
std::cout << "SUCCESS!\n";
}
else
{
std::cout << "FAILURE!\n";
}
std::cout << "**** END OF LARGE SET OF OCTET STRING TEST ****\n";
}