本文整理汇总了C++中CFX_ByteTextBuf::AppendByte方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteTextBuf::AppendByte方法的具体用法?C++ CFX_ByteTextBuf::AppendByte怎么用?C++ CFX_ByteTextBuf::AppendByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteTextBuf
的用法示例。
在下文中一共展示了CFX_ByteTextBuf::AppendByte方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadHexString
CFX_ByteString CPDF_StreamParser::ReadHexString() {
if (!PositionIsInBounds())
return CFX_ByteString();
CFX_ByteTextBuf buf;
bool bFirst = true;
int code = 0;
while (PositionIsInBounds()) {
int ch = m_pBuf[m_Pos++];
if (ch == '>')
break;
if (!std::isxdigit(ch))
continue;
int val = FXSYS_toHexDigit(ch);
if (bFirst) {
code = val * 16;
} else {
code += val;
buf.AppendByte((uint8_t)code);
}
bFirst = !bFirst;
}
if (!bFirst)
buf.AppendChar((char)code);
if (buf.GetLength() > MAX_STRING_LENGTH)
return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH);
return buf.GetByteString();
}
示例2: GetCharRef
uint32_t CXML_Parser::GetCharRef() {
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (IsEOF()) {
return 0;
}
uint8_t ch;
int32_t iState = 0;
CFX_ByteTextBuf buf;
uint32_t code = 0;
do {
while (m_dwIndex < m_dwBufferSize) {
ch = m_pBuffer[m_dwIndex];
switch (iState) {
case 0:
if (ch == '#') {
m_dwIndex++;
iState = 2;
break;
}
iState = 1;
case 1:
m_dwIndex++;
if (ch == ';') {
CFX_ByteStringC ref = buf.AsStringC();
if (ref == "gt") {
code = '>';
} else if (ref == "lt") {
code = '<';
} else if (ref == "amp") {
code = '&';
} else if (ref == "apos") {
code = '\'';
} else if (ref == "quot") {
code = '"';
}
iState = 10;
break;
}
buf.AppendByte(ch);
break;
case 2:
if (ch == 'x') {
m_dwIndex++;
iState = 4;
break;
}
iState = 3;
case 3:
m_dwIndex++;
if (ch == ';') {
iState = 10;
break;
}
if (g_FXCRT_XML_IsDigital(ch))
code = code * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
break;
case 4:
m_dwIndex++;
if (ch == ';') {
iState = 10;
break;
}
uint8_t nHex =
g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar;
if (nHex) {
if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) {
code =
(code << 4) + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
} else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) {
code = (code << 4) + ch - 87;
} else {
code = (code << 4) + ch - 55;
}
}
break;
}
if (iState == 10) {
break;
}
}
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) {
break;
}
} while (ReadNextBlock());
return code;
}
示例3: GetCharRef
FX_DWORD CXML_Parser::GetCharRef()
{
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (IsEOF()) {
return 0;
}
FX_BYTE ch;
FX_INT32 iState = 0;
CFX_ByteTextBuf buf;
FX_DWORD code = 0;
do {
while (m_dwIndex < m_dwBufferSize) {
ch = m_pBuffer[m_dwIndex];
switch (iState) {
case 0:
if (ch == '#') {
m_dwIndex ++;
iState = 2;
break;
}
iState = 1;
case 1:
m_dwIndex ++;
if (ch == ';') {
CFX_ByteStringC ref = buf.GetByteString();
if (ref == FX_BSTRC("gt")) {
code = '>';
} else if (ref == FX_BSTRC("lt")) {
code = '<';
} else if (ref == FX_BSTRC("amp")) {
code = '&';
} else if (ref == FX_BSTRC("apos")) {
code = '\'';
} else if (ref == FX_BSTRC("quot")) {
code = '"';
}
iState = 10;
break;
}
buf.AppendByte(ch);
break;
case 2:
if (ch == 'x') {
m_dwIndex ++;
iState = 4;
break;
}
iState = 3;
case 3:
m_dwIndex ++;
if (ch == ';') {
iState = 10;
break;
}
if (g_FXCRT_XML_IsDigital(ch)) {
code = code * 10 + ch - '0';
}
break;
case 4:
m_dwIndex ++;
if (ch == ';') {
iState = 10;
break;
}
FX_BYTE nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar;
if (nHex) {
if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) {
code = (code << 4) + ch - '0';
} else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) {
code = (code << 4) + ch - 87;
} else {
code = (code << 4) + ch - 55;
}
}
break;
}
if (iState == 10) {
break;
}
}
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) {
break;
}
} while (ReadNextBlock());
return code;
}