本文整理汇总了C++中StringObject::getByteStringLen方法的典型用法代码示例。如果您正苦于以下问题:C++ StringObject::getByteStringLen方法的具体用法?C++ StringObject::getByteStringLen怎么用?C++ StringObject::getByteStringLen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringObject
的用法示例。
在下文中一共展示了StringObject::getByteStringLen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
StringObject * ToUnicodeCMap::getUTFChar(unsigned char * charCode, int len)
{
int charCodeNum = 0;
for(int i = 0; i<len; i++)
{
charCodeNum *= 16;
charCodeNum += charCode[i];
}
StringObject * utfChar = codeCharMap[charCodeNum];
if(utfChar == null)
{
//try to find range for char
BFRange * range = null;
int endSearch = codeRangeMapVector.size()-1;
if(endSearch > 0)
{
int beginSearch = 0;
do
{
int actualSearch = (beginSearch + endSearch) / 2;
BFRange * actualItem = &codeRangeMapVector[actualSearch];
if(actualItem->begin <= charCodeNum &&
actualItem->end >= charCodeNum)
{
range = actualItem;
break;
}
if(actualItem->begin > charCodeNum)
{
endSearch = actualSearch-1;
}
else
{
beginSearch = actualSearch+1;
}
}while(beginSearch <= endSearch);
}
if(range == null)
{
//Couldn't map character properly.
return null;
}
else
{
int increment = charCodeNum - range->begin;
if(range->object->objectType == PdfObject::TYPE_STRING)
{
StringObject * string = (StringObject*) range->object;
int numResult = string->toNum();
numResult += increment;
int len = string->getByteStringLen()*2;
char * hexaString = new char[len+3];
hexaString[0] = '<';
hexaString[len+1] = '>';
hexaString[len+2] = 0;
for(int i = len; i>0; i--)
{
int byte = numResult % 16;
switch(byte)
{
case 0:
hexaString[i] = '0';
break;
case 1:
hexaString[i] = '1';
break;
case 2:
hexaString[i] = '2';
break;
case 3:
hexaString[i] = '3';
break;
case 4:
hexaString[i] = '4';
break;
case 5:
hexaString[i] = '5';
break;
case 6:
hexaString[i] = '6';
break;
case 7:
hexaString[i] = '7';
break;
case 8:
hexaString[i] = '8';
break;
case 9:
hexaString[i] = '9';
break;
case 10:
hexaString[i] = 'A';
break;
case 11:
hexaString[i] = 'B';
break;
case 12:
hexaString[i] = 'C';
break;
case 13:
//.........这里部分代码省略.........