本文整理汇总了C++中CFX_ByteString类的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteString类的具体用法?C++ CFX_ByteString怎么用?C++ CFX_ByteString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFX_ByteString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDefaultAppearance
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 (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
if (pFonts) {
CPDF_Dictionary* pElement = pFonts->GetDictBy(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->GetDictBy("P");
pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
if (pFonts) {
CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont)
return pFont;
}
}
}
return nullptr;
}
示例2: GetDefaultAppearance
CPDF_Font* CPDF_FormControl::GetDefaultControlFont()
{
CPDF_DefaultAppearance cDA = GetDefaultAppearance();
CFX_ByteString csFontNameTag;
FX_FLOAT fFontSize;
cDA.GetFont(csFontNameTag, fFontSize);
if (csFontNameTag.IsEmpty()) {
return NULL;
}
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR");
if (pObj != NULL && pObj->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pFonts = ((CPDF_Dictionary*)pObj)->GetDict("Font");
if (pFonts != NULL) {
CPDF_Dictionary *pElement = pFonts->GetDict(csFontNameTag);
CPDF_Font *pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont != NULL) {
return pFont;
}
}
}
CPDF_Font *pFont = m_pField->m_pForm->GetFormFont(csFontNameTag);
if (pFont != NULL) {
return pFont;
}
CPDF_Dictionary *pPageDict = m_pWidgetDict->GetDict("P");
pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
if (pObj != NULL && pObj->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pFonts = ((CPDF_Dictionary*)pObj)->GetDict("Font");
if (pFonts != NULL) {
CPDF_Dictionary *pElement = pFonts->GetDict(csFontNameTag);
CPDF_Font *pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont != NULL) {
return pFont;
}
}
}
return NULL;
}
示例3: ThrowScriptErrorMessage
void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData(
CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 0 || iLength > 2) {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData");
return;
}
IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
if (!pNotify) {
return;
}
IXFA_Doc* hDoc = pNotify->GetHDOC();
CFX_WideString wsFilePath;
FX_BOOL bXDP = TRUE;
if (iLength >= 1) {
CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength());
}
if (iLength >= 2) {
bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
}
pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP);
}
示例4: ASSERT
void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname,
const CFX_ByteString& sData) {
ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
sPropName.TrimRight();
if (sPropName.GetLength() == 0)
return;
if (CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName)) {
pData->data.nType = JS_GLOBALDATA_TYPE_STRING;
pData->data.sData = sData;
} else {
CJS_GlobalData_Element* pNewData = new CJS_GlobalData_Element;
pNewData->data.sKey = sPropName;
pNewData->data.nType = JS_GLOBALDATA_TYPE_STRING;
pNewData->data.sData = sData;
m_arrayGlobalData.Add(pNewData);
}
}
示例5: Script_HostPseudoModel_Title
void CScript_HostPseudoModel::Script_HostPseudoModel_Title(
FXJSE_HVALUE hValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute) {
if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
return;
}
IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
if (!pNotify) {
return;
}
IXFA_Doc* hDoc = pNotify->GetHDOC();
if (bSetting) {
CFX_ByteString bsValue;
FXJSE_Value_ToUTF8String(hValue, bsValue);
pNotify->GetDocProvider()->SetTitle(
hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()));
return;
}
CFX_WideString wsTitle;
pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle);
FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle));
}
示例6: RemoveInterFormFont
void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) {
if (!pFormDict || csNameTag.IsEmpty()) {
return;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
return;
}
pFonts->RemoveAt(csNameTag);
}
示例7: 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;
}
示例8: ASSERT
void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd)
{
ASSERT(m_pApp != NULL);
ASSERT(pWnd != NULL);
if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT)
{
CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
pEdit->SetCharSet(134);
pEdit->SetCodePage(936);
pEdit->SetReadyToInput();
CFX_WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);
pEdit->SetEditNotify(this);
//pUndo->BeginEdit(pDocument);
}
}
示例9: while
void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg,
int32_t startpos,
int32_t count,
CFX_WideString& sb) {
int32_t idx = 0;
BigInteger num900 = 900;
while (idx < count) {
CFX_WideString tmp;
int32_t len = 44 < count - idx ? 44 : count - idx;
CFX_ByteString part =
((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
BigInteger bigint = stringToBigInteger(part.c_str());
do {
int32_t c = (bigint % num900).toInt();
tmp += (FX_WCHAR)(c);
bigint = bigint / num900;
} while (!bigint.isZero());
for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) {
sb += tmp.GetAt(i);
}
idx += len;
}
}
示例10:
CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg,
CFX_WideString ecLevel,
int32_t& e) {
CFX_ByteString dststr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
CFX_WideString sb;
int32_t c = dststr.GetLength();
for (int32_t i = 0; i < c; i++) {
FX_WCHAR ch = (FX_WCHAR)(dststr.GetAt(i) & 0xff);
if (ch == '?' && dststr.GetAt(i) != '?') {
e = BCExceptionCharactersOutsideISO88591Encoding;
}
sb += ch;
}
m_msg = sb;
m_shape = FORCE_NONE;
m_newEncoding = -1;
m_pos = 0;
m_symbolInfo = NULL;
m_skipAtEnd = 0;
m_maxSize = NULL;
m_minSize = NULL;
}
示例11: 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;
}
示例12: GetPSNameFromTT
void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
if (!m_pFontInfo)
return;
m_FaceArray.push_back({name, static_cast<uint32_t>(charset)});
if (name == m_LastFamily)
return;
const uint8_t* ptr = name.raw_str();
FX_BOOL bLocalized = FALSE;
for (int i = 0; i < name.GetLength(); i++) {
if (ptr[i] > 0x80) {
bLocalized = TRUE;
break;
}
}
if (bLocalized) {
void* hFont = m_pFontInfo->GetFont(name.c_str());
if (!hFont) {
int iExact;
hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0,
name.c_str(), iExact);
if (!hFont)
return;
}
CFX_ByteString new_name = GetPSNameFromTT(hFont);
if (!new_name.IsEmpty()) {
new_name.Insert(0, ' ');
m_InstalledTTFonts.push_back(new_name);
}
m_pFontInfo->DeleteFont(hFont);
}
m_InstalledTTFonts.push_back(name);
m_LastFamily = name;
}
示例13: FPDFDOC_GetAnnotAP
CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
CPDF_Annot::AppearanceMode mode) {
CPDF_Dictionary* pAP = pAnnotDict->GetDictBy("AP");
if (!pAP) {
return nullptr;
}
const FX_CHAR* ap_entry = "N";
if (mode == CPDF_Annot::Down)
ap_entry = "D";
else if (mode == CPDF_Annot::Rollover)
ap_entry = "R";
if (!pAP->KeyExist(ap_entry))
ap_entry = "N";
CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry);
if (!psub)
return nullptr;
if (CPDF_Stream* pStream = psub->AsStream())
return pStream;
if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
CFX_ByteString as = pAnnotDict->GetStringBy("AS");
if (as.IsEmpty()) {
CFX_ByteString value = pAnnotDict->GetStringBy("V");
if (value.IsEmpty()) {
CPDF_Dictionary* pParentDict = pAnnotDict->GetDictBy("Parent");
value = pParentDict ? pParentDict->GetStringBy("V") : CFX_ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
as = "Off";
else
as = value;
}
return pDict->GetStreamBy(as);
}
return nullptr;
}
示例14: ThrowScriptErrorMessage
void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent(
CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 1 || iLength > 3) {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageContent");
return;
}
int32_t iIndex = 0;
CFX_WideString wsType;
FX_BOOL bOnPageArea = FALSE;
if (iLength >= 1) {
iIndex = pArguments->GetInt32(0);
}
if (iLength >= 2) {
CFX_ByteString bsType = pArguments->GetUTF8String(1);
wsType = CFX_WideString::FromUTF8(bsType, bsType.GetLength());
}
if (iLength >= 3) {
bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE;
}
IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
if (!pNotify) {
return;
}
IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout();
if (!pDocLayout) {
return;
}
CXFA_NodeArray retArray;
Script_LayoutPseudoModel_GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea,
retArray);
CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument);
pArrayNodeList->SetArrayNodeList(retArray);
FXJSE_Value_SetObject(pArguments->GetReturnValue(),
(CXFA_Object*)pArrayNodeList,
m_pDocument->GetScriptContext()->GetJseNormalClass());
}
示例15: CalcEncryptKey
void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pass_size,
FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray)
{
int revision = pEncrypt->GetInteger(FX_BSTRC("R"));
FX_BYTE passcode[32];
for (FX_DWORD i = 0; i < 32; i ++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
}
FX_BYTE md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, passcode, 32);
CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O"));
CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)okey, okey.GetLength());
FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P"));
CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) {
FX_DWORD tag = (FX_DWORD) - 1;
CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4);
}
FX_BYTE digest[16];
CRYPT_MD5Finish(md5, digest);
FX_DWORD copy_len = keylen;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
if (revision >= 3) {
for (int i = 0; i < 50; i ++) {
CRYPT_MD5Generate(digest, copy_len, digest);
}
}
FXSYS_memset32(key, 0, keylen);
FXSYS_memcpy32(key, digest, copy_len);
}