本文整理匯總了C++中CFX_ByteString函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFX_ByteString函數的具體用法?C++ CFX_ByteString怎麽用?C++ CFX_ByteString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFX_ByteString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetNameFromTT
CFX_ByteString GetNameFromTT(const uint8_t* name_table,
uint32_t name_table_size,
uint32_t name_id) {
if (!name_table || name_table_size < 6) {
return CFX_ByteString();
}
uint32_t name_count = GET_TT_SHORT(name_table + 2);
uint32_t string_offset = GET_TT_SHORT(name_table + 4);
// We will ignore the possibility of overlap of structures and
// string table as if it's all corrupt there's not a lot we can do.
if (name_table_size < string_offset) {
return CFX_ByteString();
}
const uint8_t* string_ptr = name_table + string_offset;
uint32_t string_ptr_size = name_table_size - string_offset;
name_table += 6;
name_table_size -= 6;
if (name_table_size < name_count * 12) {
return CFX_ByteString();
}
for (uint32_t i = 0; i < name_count; i++, name_table += 12) {
if (GET_TT_SHORT(name_table + 6) == name_id &&
GET_TT_SHORT(name_table) == 1 && GET_TT_SHORT(name_table + 2) == 0) {
return GetStringFromTable(string_ptr, string_ptr_size,
GET_TT_SHORT(name_table + 10),
GET_TT_SHORT(name_table + 8));
}
}
return CFX_ByteString();
}
示例2: switch
CFX_ByteString CPDF_Object::GetString() const
{
switch (m_Type) {
case PDFOBJ_BOOLEAN:
return ((CPDF_Boolean*)this)->m_bValue ? "true" : "false";
case PDFOBJ_NUMBER:
return ((CPDF_Number*)this)->GetString();
case PDFOBJ_STRING:
return ((CPDF_String*)this)->m_String;
case PDFOBJ_NAME:
return ((CPDF_Name*)this)->m_Name;
case PDFOBJ_REFERENCE: {
CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
if (pRef->m_pObjList == NULL) {
break;
}
CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum);
if (pObj == NULL) {
return CFX_ByteString();
}
return pObj->GetString();
}
}
return CFX_ByteString();
}
示例3: CFX_ByteString
CFX_ByteString CFPF_SkiaFont::GetFamilyName()
{
if (!m_Face) {
return CFX_ByteString();
}
return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
}
示例4: CFX_ByteString
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();
}
示例5: CFX_ByteString
CFX_ByteString CFX_Font::GetFamilyName() const {
if (!m_Face && !m_pSubstFont) {
return CFX_ByteString();
}
if (m_Face) {
return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
}
return m_pSubstFont->m_Family;
}
示例6: GetStringFromTable
static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr,
uint32_t string_ptr_length,
uint16_t offset,
uint16_t length) {
if (string_ptr_length < static_cast<uint32_t>(offset + length)) {
return CFX_ByteString();
}
return CFX_ByteString(string_ptr + offset, length);
}
示例7: CFX_ByteString
CFX_ByteString CFX_Font::GetFamilyName() const
{
if (m_Face == NULL && m_pSubstFont == NULL) {
return CFX_ByteString();
}
if (m_Face) {
return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
} else {
return m_pSubstFont->m_Family;
}
}
示例8: CFX_ByteString
bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
const CFX_ByteStringC& name,
FX_FLOAT& attribute) const {
const CFX_WideString* pValue =
m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
if (pValue) {
attribute = pValue->GetFloat();
return true;
}
return false;
}
示例9: FX_XML_SplitQualifiedName
bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
int& attribute) const {
CFX_ByteStringC bsSpace;
CFX_ByteStringC bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
const CFX_WideString* pwsValue =
m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
if (pwsValue) {
attribute = pwsValue->GetInteger();
return true;
}
return false;
}
示例10: CRYPT_SHA1Start
void CPDF_StandardSecurityHandler::AES256_SetPassword(
CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
FX_DWORD size,
FX_BOOL bOwner,
const uint8_t* key) {
uint8_t sha[128];
CRYPT_SHA1Start(sha);
CRYPT_SHA1Update(sha, key, 32);
CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5);
uint8_t digest[20];
CRYPT_SHA1Finish(sha, digest);
CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U"));
uint8_t digest1[48];
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest,
(bOwner ? (const uint8_t*)ukey : NULL), digest1);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
CRYPT_SHA256Update(sha, digest, 8);
if (bOwner) {
CRYPT_SHA256Update(sha, ukey, ukey.GetLength());
}
CRYPT_SHA256Finish(sha, digest1);
}
FXSYS_memcpy(digest1 + 32, digest, 16);
pEncryptDict->SetAtString(bOwner ? FX_BSTRC("O") : FX_BSTRC("U"),
CFX_ByteString(digest1, 48));
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8,
(bOwner ? (const uint8_t*)ukey : NULL), digest1);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
CRYPT_SHA256Update(sha, digest + 8, 8);
if (bOwner) {
CRYPT_SHA256Update(sha, ukey, ukey.GetLength());
}
CRYPT_SHA256Finish(sha, digest1);
}
uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE);
uint8_t iv[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, digest1, key, 32);
FX_Free(aes);
pEncryptDict->SetAtString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"),
CFX_ByteString(digest1, 32));
}
示例11: CFX_ByteString
CFX_ByteString CPDF_StreamParser::ReadHexString()
{
if (m_Size <= m_Pos) {
return CFX_ByteString();
}
int ch = m_pBuf[m_Pos++];
CFX_ByteTextBuf buf;
FX_BOOL bFirst = TRUE;
int code = 0;
while (1) {
if (ch == '>') {
break;
}
if (ch >= '0' && ch <= '9') {
if (bFirst) {
code = (ch - '0') * 16;
} else {
code += ch - '0';
buf.AppendChar((char)code);
}
bFirst = !bFirst;
} else if (ch >= 'A' && ch <= 'F') {
if (bFirst) {
code = (ch - 'A' + 10) * 16;
} else {
code += ch - 'A' + 10;
buf.AppendChar((char)code);
}
bFirst = !bFirst;
} else if (ch >= 'a' && ch <= 'f') {
if (bFirst) {
code = (ch - 'a' + 10) * 16;
} else {
code += ch - 'a' + 10;
buf.AppendChar((char)code);
}
bFirst = !bFirst;
}
if (m_Size <= m_Pos) {
break;
}
ch = m_pBuf[m_Pos++];
}
if (!bFirst) {
buf.AppendChar((char)code);
}
if (buf.GetLength() > MAX_STRING_LENGTH) {
return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH);
}
return buf.GetByteString();
}
示例12: sprintf
CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString()
{
CFX_ByteString dtStr;
char tempStr[32];
sprintf(tempStr, "D:%04d%02d%02d%02d%02d%02d", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second);
dtStr = CFX_ByteString(tempStr);
if (dt.tzHour < 0)
dtStr += CFX_ByteString("-");
else
dtStr += CFX_ByteString("+");
sprintf(tempStr, "%02d'%02d'", abs(dt.tzHour), dt.tzMinute);
dtStr += CFX_ByteString(tempStr);
return dtStr;
}
示例13: GetAttr
CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_BOOL bInheritable,
FX_FLOAT fLevel) {
if (fLevel > nMaxRecursion) {
return nullptr;
}
if (bInheritable) {
CPDF_Object* pAttr = GetAttr(owner, name, FALSE);
if (pAttr) {
return pAttr;
}
if (!m_pParent) {
return nullptr;
}
return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
}
CPDF_Object* pA = m_pDict->GetDirectObjectBy("A");
if (pA) {
CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
if (pAttrDict) {
CPDF_Object* pAttr = pAttrDict->GetDirectObjectBy(CFX_ByteString(name));
if (pAttr) {
return pAttr;
}
}
}
CPDF_Object* pC = m_pDict->GetDirectObjectBy("C");
if (!pC)
return nullptr;
CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap");
if (!pClassMap)
return nullptr;
if (CPDF_Array* pArray = pC->AsArray()) {
for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString class_name = pArray->GetStringAt(i);
CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
if (pClassDict && pClassDict->GetStringBy("O") == owner)
return pClassDict->GetDirectObjectBy(CFX_ByteString(name));
}
return nullptr;
}
CFX_ByteString class_name = pC->GetString();
CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
if (pClassDict && pClassDict->GetStringBy("O") == owner)
return pClassDict->GetDirectObjectBy(CFX_ByteString(name));
return nullptr;
}
示例14: CFX_ByteString
CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
if (!m_pFontInfo)
return CFX_ByteString();
uint32_t size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0);
if (!size)
return CFX_ByteString();
std::vector<uint8_t> buffer(size);
uint8_t* buffer_ptr = buffer.data();
uint32_t bytes_read =
m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size);
return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6)
: CFX_ByteString();
}
示例15: CPDF_Number
CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) {
if (index >= m_ParamCount) {
return NULL;
}
int real_index = m_ParamStartPos + m_ParamCount - index - 1;
if (real_index >= PARAM_BUF_SIZE) {
real_index -= PARAM_BUF_SIZE;
}
ContentParam& param = m_ParamBuf1[real_index];
if (param.m_Type == PDFOBJ_NUMBER) {
CPDF_Number* pNumber = param.m_Number.m_bInteger
? new CPDF_Number(param.m_Number.m_Integer)
: new CPDF_Number(param.m_Number.m_Float);
param.m_Type = 0;
param.m_pObject = pNumber;
return pNumber;
}
if (param.m_Type == PDFOBJ_NAME) {
CPDF_Name* pName = new CPDF_Name(
CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
param.m_Type = 0;
param.m_pObject = pName;
return pName;
}
if (param.m_Type == 0) {
return param.m_pObject;
}
ASSERT(FALSE);
return NULL;
}