本文整理汇总了C++中CFX_ByteString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteString::IsEmpty方法的具体用法?C++ CFX_ByteString::IsEmpty怎么用?C++ CFX_ByteString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteString
的用法示例。
在下文中一共展示了CFX_ByteString::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetExportValue
CFX_WideString CPDF_FormControl::GetExportValue() {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn = GetOnStateName();
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
if (CPDF_Array* pArray =
ToArray(FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"))) {
int iIndex = m_pField->GetControlIndex(this);
csOn = pArray->GetStringAt(iIndex);
}
}
if (csOn.IsEmpty()) {
csOn = "Yes";
}
CFX_WideString csWOn = PDF_DecodeText(csOn);
return csWOn;
}
示例2: SetOnStateName
void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn)
{
ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csValue = csOn;
if (csValue.IsEmpty()) {
csValue = "Yes";
}
if (csValue == "Off") {
csValue = "Yes";
}
CFX_ByteString csAS = m_pWidgetDict->GetString("AS", "Off");
if (csAS != "Off") {
m_pWidgetDict->SetAtName("AS", csValue);
}
CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP");
if (pAP == NULL) {
return;
}
FX_POSITION pos1 = pAP->GetStartPos();
while (pos1) {
CFX_ByteString csKey1;
CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1);
if (pObj1 == NULL) {
continue;
}
CPDF_Object* pObjDirect1 = pObj1->GetDirect();
if (pObjDirect1->GetType() != PDFOBJ_DICTIONARY) {
continue;
}
CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)pObjDirect1;
FX_POSITION pos2 = pSubDict->GetStartPos();
while (pos2) {
CFX_ByteString csKey2;
CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2);
if (pObj2 == NULL) {
continue;
}
if (csKey2 != "Off") {
pSubDict->ReplaceKey(csKey2, csValue);
break;
}
}
}
}
示例3: InitInterFormDict
void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
if (!pDocument)
return;
if (!pFormDict) {
pFormDict = new CPDF_Dictionary;
uint32_t dwObjNum = pDocument->AddIndirectObject(pFormDict);
CPDF_Dictionary* pRoot = pDocument->GetRoot();
pRoot->SetAtReference("AcroForm", pDocument, dwObjNum);
}
CFX_ByteString csDA;
if (!pFormDict->KeyExist("DR")) {
CFX_ByteString csBaseName;
CFX_ByteString csDefault;
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
CPDF_Font* pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica");
if (pFont) {
AddInterFormFont(pFormDict, pDocument, pFont, csBaseName);
csDefault = csBaseName;
}
if (charSet != FXFONT_ANSI_CHARSET) {
CFX_ByteString csFontName =
CPDF_InterForm::GetNativeFont(charSet, nullptr);
if (!pFont || csFontName != "Helvetica") {
pFont = CPDF_InterForm::AddNativeFont(pDocument);
if (pFont) {
csBaseName = "";
AddInterFormFont(pFormDict, pDocument, pFont, csBaseName);
csDefault = csBaseName;
}
}
}
if (pFont) {
csDA = "/" + PDF_NameEncode(csDefault) + " 0 Tf";
}
}
if (!csDA.IsEmpty()) {
csDA += " ";
}
csDA += "0 g";
if (!pFormDict->KeyExist("DA")) {
pFormDict->SetAtString("DA", csDA);
}
}
示例4: SetOnStateName
void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csValue = csOn;
if (csValue.IsEmpty()) {
csValue = "Yes";
}
if (csValue == "Off") {
csValue = "Yes";
}
CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS", "Off");
if (csAS != "Off") {
m_pWidgetDict->SetAtName("AS", csValue);
}
CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP");
if (!pAP) {
return;
}
for (const auto& it : *pAP) {
CPDF_Object* pObj1 = it.second;
if (!pObj1) {
continue;
}
CPDF_Object* pObjDirect1 = pObj1->GetDirect();
CPDF_Dictionary* pSubDict = pObjDirect1->AsDictionary();
if (!pSubDict)
continue;
auto subdict_it = pSubDict->begin();
while (subdict_it != pSubDict->end()) {
const CFX_ByteString& csKey2 = subdict_it->first;
CPDF_Object* pObj2 = subdict_it->second;
++subdict_it;
if (!pObj2) {
continue;
}
if (csKey2 != "Off") {
pSubDict->ReplaceKey(csKey2, csValue);
break;
}
}
}
}
示例5: PDFDocInit
FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
CPDF_Document* pSrcPDFDoc) {
if (!pDestPDFDoc || !pSrcPDFDoc)
return FALSE;
CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
if (!pNewRoot)
return FALSE;
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE));
CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
if (cbRootType.IsEmpty())
pNewRoot->SetFor("Type", new CPDF_Name("Catalog"));
CPDF_Object* pElement = pNewRoot->GetObjectFor("Pages");
CPDF_Dictionary* pNewPages =
pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
if (!pNewPages) {
pNewPages = new CPDF_Dictionary(pDestPDFDoc->GetByteStringPool());
pNewRoot->SetReferenceFor("Pages", pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(pNewPages));
}
CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", "");
if (cbPageType == "") {
pNewPages->SetFor("Type", new CPDF_Name("Pages"));
}
if (!pNewPages->GetArrayFor("Kids")) {
pNewPages->SetIntegerFor("Count", 0);
pNewPages->SetReferenceFor("Kids", pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(new CPDF_Array));
}
return TRUE;
}
示例6: _GetLabelNumPortion
static CFX_WideString _GetLabelNumPortion(int num,
const CFX_ByteString& bsStyle) {
CFX_WideString wsNumPortion;
if (bsStyle.IsEmpty()) {
return wsNumPortion;
}
if (bsStyle == "D") {
wsNumPortion.Format(L"%d", num);
} else if (bsStyle == "R") {
wsNumPortion = _MakeRoman(num);
wsNumPortion.MakeUpper();
} else if (bsStyle == "r") {
wsNumPortion = _MakeRoman(num);
} else if (bsStyle == "A") {
wsNumPortion = _MakeLetters(num);
wsNumPortion.MakeUpper();
} else if (bsStyle == "a") {
wsNumPortion = _MakeLetters(num);
}
return wsNumPortion;
}
示例7: GetNativeFontName
CFX_ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) {
// searching native font is slow, so we must save time
for (int32_t i = 0, sz = m_aNativeFont.GetSize(); i < sz; i++) {
if (CPWL_FontMap_Native* pData = m_aNativeFont.GetAt(i)) {
if (pData->nCharset == nCharset)
return pData->sFontName;
}
}
CFX_ByteString sNew = GetNativeFont(nCharset);
if (!sNew.IsEmpty()) {
CPWL_FontMap_Native* pNewData = new CPWL_FontMap_Native;
pNewData->nCharset = nCharset;
pNewData->sFontName = sNew;
m_aNativeFont.Add(pNewData);
}
return sNew;
}
示例8: GetDefaultControlFont
CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
CPDF_DefaultAppearance cDA = GetDefaultAppearance();
CFX_ByteString csFontNameTag;
FX_FLOAT fFontSize;
cDA.GetFont(csFontNameTag, fFontSize);
if (csFontNameTag.IsEmpty())
return nullptr;
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR");
if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pFonts = ((CPDF_Dictionary*)pObj)->GetDict("Font");
if (pFonts) {
CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag);
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont) {
return pFont;
}
}
}
}
if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag))
return pFormFont;
CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDict("P");
pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pFonts = ((CPDF_Dictionary*)pObj)->GetDict("Font");
if (pFonts) {
CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag);
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont) {
return pFont;
}
}
}
}
return nullptr;
}
示例9: AddNativeInterFormFont
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
InitInterFormDict(pFormDict, pDocument);
}
CFX_ByteString csTemp;
CPDF_Font* pFont = GetNativeInterFormFont(pFormDict, pDocument, charSet, csTemp);
if (pFont != NULL) {
csNameTag = csTemp;
return pFont;
}
CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet);
if (!csFontName.IsEmpty()) {
if (FindInterFormFont(pFormDict, pDocument, csFontName, pFont, csNameTag)) {
return pFont;
}
}
pFont = CPDF_InterForm::AddNativeFont(charSet, pDocument);
if (pFont != NULL) {
AddInterFormFont(pFormDict, pDocument, pFont, csNameTag);
}
return pFont;
}
示例10: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag)
{
CFX_ByteString csAlias = PDF_NameDecode(csNameTag);
if (pFormDict == NULL || csAlias.IsEmpty()) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return NULL;
}
CPDF_Dictionary* pElement = pFonts->GetDict(csAlias);
if (pElement == NULL) {
return NULL;
}
if (pElement->GetString("Type") == "Font") {
return pDocument->LoadFont(pElement);
}
return NULL;
}
示例11: CalculateEncodingDict
size_t CPDF_Document::CalculateEncodingDict(int charset,
CPDF_Dictionary* pBaseDict) {
size_t i;
for (i = 0; i < FX_ArraySize(g_FX_CharsetUnicodes); ++i) {
if (g_FX_CharsetUnicodes[i].m_Charset == charset)
break;
}
if (i == FX_ArraySize(g_FX_CharsetUnicodes))
return i;
CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary(m_pByteStringPool);
pEncodingDict->SetNameFor("BaseEncoding", "WinAnsiEncoding");
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(128);
const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
pArray->AddName(name.IsEmpty() ? ".notdef" : name);
}
pEncodingDict->SetFor("Differences", pArray);
pBaseDict->SetReferenceFor("Encoding", this,
AddIndirectObject(pEncodingDict));
return i;
}
示例12: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
CFX_ByteString csNameTag) {
CFX_ByteString csAlias = PDF_NameDecode(csNameTag);
if (!pFormDict || csAlias.IsEmpty()) {
return nullptr;
}
CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
if (!pDR) {
return nullptr;
}
CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
if (!pFonts) {
return nullptr;
}
CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias);
if (!pElement) {
return nullptr;
}
if (pElement->GetStringBy("Type") == "Font") {
return pDocument->LoadFont(pElement);
}
return nullptr;
}
示例13: AddInterFormFont
void AddInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
CFX_ByteString& csNameTag) {
if (!pFont) {
return;
}
if (!pFormDict) {
InitInterFormDict(pFormDict, pDocument);
}
CFX_ByteString csTag;
if (FindInterFormFont(pFormDict, pFont, csTag)) {
csNameTag = csTag;
return;
}
if (!pFormDict) {
InitInterFormDict(pFormDict, pDocument);
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
pDR = new CPDF_Dictionary;
pFormDict->SetAt("DR", pDR);
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
pFonts = new CPDF_Dictionary;
pDR->SetAt("Font", pFonts);
}
if (csNameTag.IsEmpty()) {
csNameTag = pFont->GetBaseFont();
}
csNameTag.Remove(' ');
csNameTag =
CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag);
pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict());
}
示例14: AddMacFont
CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTranslateName)
{
CTFontRef font = (CTFontRef)pFont;
CTFontDescriptorRef descriptor = CTFontCopyFontDescriptor(font);
if (descriptor == NULL) {
return NULL;
}
CFX_ByteString basefont;
FX_BOOL bCJK = FALSE;
int flags = 0, italicangle = 0, ascend = 0, descend = 0, capheight = 0, bbox[4];
FXSYS_memset32(bbox, 0, sizeof(int) * 4);
CFArrayRef languages = (CFArrayRef)CTFontDescriptorCopyAttribute(descriptor, kCTFontLanguagesAttribute);
if (languages == NULL) {
CFRelease(descriptor);
return NULL;
}
CFX_DWordArray charSets;
charSets.Add(FXFONT_CHINESEBIG5_CHARSET);
charSets.Add(FXFONT_GB2312_CHARSET);
charSets.Add(FXFONT_HANGEUL_CHARSET);
charSets.Add(FXFONT_SHIFTJIS_CHARSET);
if (IsHasCharSet(languages, charSets)) {
bCJK = TRUE;
}
CFRelease(descriptor);
CFDictionaryRef traits = (CFDictionaryRef)CTFontCopyTraits(font);
if (traits == NULL) {
CFRelease(languages);
return NULL;
}
CFNumberRef sybolicTrait = (CFNumberRef)CFDictionaryGetValue(traits, kCTFontSymbolicTrait);
CTFontSymbolicTraits trait = 0;
CFNumberGetValue(sybolicTrait, kCFNumberSInt32Type, &trait);
if (trait & kCTFontItalicTrait) {
flags |= PDFFONT_ITALIC;
}
if (trait & kCTFontMonoSpaceTrait) {
flags |= PDFFONT_FIXEDPITCH;
}
if (trait & kCTFontModernSerifsClass) {
flags |= PDFFONT_SERIF;
}
if (trait & kCTFontScriptsClass) {
flags |= PDFFONT_SCRIPT;
}
CFNumberRef weightTrait = (CFNumberRef)CFDictionaryGetValue(traits, kCTFontWeightTrait);
Float32 weight = 0;
CFNumberGetValue(weightTrait, kCFNumberFloat32Type, &weight);
italicangle = CTFontGetSlantAngle(font);
ascend = CTFontGetAscent(font);
descend = CTFontGetDescent(font);
capheight = CTFontGetCapHeight(font);
CGRect box = CTFontGetBoundingBox(font);
bbox[0] = box.origin.x;
bbox[1] = box.origin.y;
bbox[2] = box.origin.x + box.size.width;
bbox[3] = box.origin.y + box.size.height;
if (bTranslateName && bCJK) {
CFStringRef postName = CTFontCopyPostScriptName(font);
_CFString2CFXByteString(postName, basefont);
CFRelease(postName);
}
if (basefont.IsEmpty()) {
CFStringRef fullName = CTFontCopyFullName(font);
_CFString2CFXByteString(fullName, basefont);
CFRelease(fullName);
}
basefont.Replace(" ", "");
CPDF_Dictionary* pFontDict = NULL;
CPDF_Dictionary* pBaseDict = FX_NEW CPDF_Dictionary;
pFontDict = pBaseDict;
if (!bCJK) {
charSets.RemoveAll();
charSets.Add(FXFONT_ANSI_CHARSET);
charSets.Add(FXFONT_DEFAULT_CHARSET);
charSets.Add(FXFONT_SYMBOL_CHARSET);
if (IsHasCharSet(languages, charSets)) {
charSets.RemoveAll();
charSets.Add(FXFONT_SYMBOL_CHARSET);
if (IsHasCharSet(languages, charSets)) {
flags |= PDFFONT_SYMBOLIC;
} else {
flags |= PDFFONT_NONSYMBOLIC;
}
pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding");
} else {
flags |= PDFFONT_NONSYMBOLIC;
int i;
for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes); i ++) {
charSets.RemoveAll();
charSets.Add(g_FX_CharsetUnicodes[i].m_Charset);
if (IsHasCharSet(languages, charSets)) {
break;
}
}
if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) {
CPDF_Dictionary* pEncoding = FX_NEW CPDF_Dictionary;
pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding");
CPDF_Array* pArray = FX_NEW CPDF_Array;
pArray->AddInteger(128);
//.........这里部分代码省略.........
示例15: sizeof
FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, FX_DWORD size,
FX_BOOL bOwner, FX_LPBYTE key)
{
CFX_ByteString okey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("O")) : CFX_ByteString();
if (okey.GetLength() < 48) {
return FALSE;
}
CFX_ByteString ukey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("U")) : CFX_ByteString();
if (ukey.GetLength() < 48) {
return FALSE;
}
FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey;
FX_BYTE sha[128];
FX_BYTE digest[32];
if (m_Revision >= 6) {
Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 32, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
CRYPT_SHA256Update(sha, pkey + 32, 8);
if (bOwner) {
CRYPT_SHA256Update(sha, ukey, 48);
}
CRYPT_SHA256Finish(sha, digest);
}
if (FXSYS_memcmp32(digest, pkey, 32) != 0) {
return FALSE;
}
if (key == NULL) {
return TRUE;
}
if (m_Revision >= 6) {
Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 40, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
CRYPT_SHA256Update(sha, pkey + 40, 8);
if (bOwner) {
CRYPT_SHA256Update(sha, ukey, 48);
}
CRYPT_SHA256Finish(sha, digest);
}
CFX_ByteString ekey = m_pEncryptDict ? m_pEncryptDict->GetString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE")) : CFX_ByteString();
if (ekey.GetLength() < 32) {
return FALSE;
}
FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048);
CRYPT_AESSetKey(aes, 16, digest, 32, FALSE);
FX_BYTE iv[16];
FXSYS_memset32(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESDecrypt(aes, key, ekey, 32);
CRYPT_AESSetKey(aes, 16, key, 32, FALSE);
CRYPT_AESSetIV(aes, iv);
CFX_ByteString perms = m_pEncryptDict->GetString(FX_BSTRC("Perms"));
if (perms.IsEmpty()) {
return FALSE;
}
FX_BYTE perms_buf[16];
FXSYS_memset32(perms_buf, 0, sizeof(perms_buf));
FX_DWORD copy_len = sizeof(perms_buf);
if (copy_len > (FX_DWORD)perms.GetLength()) {
copy_len = perms.GetLength();
}
FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len);
FX_BYTE buf[16];
CRYPT_AESDecrypt(aes, buf, perms_buf, 16);
FX_Free(aes);
if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') {
return FALSE;
}
if (FXDWORD_GET_LSBFIRST(buf) != m_Permissions) {
return FALSE;
}
if ((buf[8] == 'T' && !IsMetadataEncrypted()) || (buf[8] == 'F' && IsMetadataEncrypted())) {
return FALSE;
}
return TRUE;
}