本文整理汇总了C++中CFX_ByteString::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteString::GetLength方法的具体用法?C++ CFX_ByteString::GetLength怎么用?C++ CFX_ByteString::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteString
的用法示例。
在下文中一共展示了CFX_ByteString::GetLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Script_SignaturePseudoModel_Sign
void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign(
CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 3 || iLength > 7) {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign");
return;
}
IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
if (!pNotify) {
return;
}
IXFA_Doc* hDoc = pNotify->GetHDOC();
CXFA_NodeList* pNodeList = NULL;
CFX_WideString wsExpression;
CFX_WideString wsXMLIdent;
if (iLength >= 1) {
pNodeList = (CXFA_NodeList*)pArguments->GetObject(0);
}
if (iLength >= 2) {
CFX_ByteString bsExpression = pArguments->GetUTF8String(1);
wsExpression =
CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
}
if (iLength >= 3) {
CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2);
wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength());
}
FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression,
wsXMLIdent);
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
if (hValue) {
FXJSE_Value_SetBoolean(hValue, bSign);
}
}
示例2: JS_docmailForm
void CPDFDoc_Environment::JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,
const FX_WCHAR* To, const FX_WCHAR* Subject,
const FX_WCHAR* CC, const FX_WCHAR* BCC,
const FX_WCHAR* Msg)
{
if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_mail)
{
CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();
CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_Encode();
CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();
CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();
CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
FPDF_WIDESTRING pSubject = (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform, mailData, length, bUI, pTo, pSubject,
pCC, pBcc, pMsg);
bsTo.ReleaseBuffer();
bsCC.ReleaseBuffer();
bsBcc.ReleaseBuffer();
bsSubject.ReleaseBuffer();
bsMsg.ReleaseBuffer();
}
}
示例3: DecodeAlphanumericSegment
void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(
CBC_CommonBitSource* bits,
CFX_ByteString& result,
int32_t count,
FX_BOOL fac1InEffect,
int32_t& e) {
int32_t start = result.GetLength();
while (count > 1) {
int32_t nextTwoCharsBits = bits->ReadBits(11, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
BC_FX_ByteString_Append(result, 1,
ALPHANUMERIC_CHARS[nextTwoCharsBits / 45]);
BC_FX_ByteString_Append(result, 1,
ALPHANUMERIC_CHARS[nextTwoCharsBits % 45]);
count -= 2;
}
if (count == 1) {
int32_t itemp = bits->ReadBits(6, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[itemp]);
}
if (fac1InEffect) {
for (int32_t i = start; i < result.GetLength(); i++) {
if (result[i] == '%') {
if ((i < result.GetLength() - 1) && result[i + 1] == '%') {
result.Delete(i + 1, 1);
} else {
result.SetAt(i, (FX_CHAR)0x1d);
}
}
}
}
}
示例4: GetLength
bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
if (m_pData == str.m_pData)
return false;
int result = FXSYS_memcmp(c_str(), str.c_str(),
std::min(GetLength(), str.GetLength()));
return result < 0 || (result == 0 && GetLength() < str.GetLength());
}
示例5: DrawTextString
// static
void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
FX_FLOAT origin_x,
FX_FLOAT origin_y,
CPDF_Font* pFont,
FX_FLOAT font_size,
const CFX_Matrix* pMatrix,
const CFX_ByteString& str,
FX_ARGB fill_argb,
FX_ARGB stroke_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions) {
if (pFont->IsType3Font())
return;
int nChars = pFont->CountChar(str.c_str(), str.GetLength());
if (nChars <= 0)
return;
int offset = 0;
uint32_t* pCharCodes;
FX_FLOAT* pCharPos;
std::vector<uint32_t> codes;
std::vector<FX_FLOAT> positions;
if (nChars == 1) {
pCharCodes = reinterpret_cast<uint32_t*>(
pFont->GetNextChar(str.c_str(), str.GetLength(), offset));
pCharPos = nullptr;
} else {
codes.resize(nChars);
positions.resize(nChars - 1);
FX_FLOAT cur_pos = 0;
for (int i = 0; i < nChars; i++) {
codes[i] = pFont->GetNextChar(str.c_str(), str.GetLength(), offset);
if (i)
positions[i - 1] = cur_pos;
cur_pos += pFont->GetCharWidthF(codes[i]) * font_size / 1000;
}
pCharCodes = codes.data();
pCharPos = positions.data();
}
CFX_Matrix matrix;
if (pMatrix)
matrix = *pMatrix;
matrix.e = origin_x;
matrix.f = origin_y;
if (stroke_argb == 0) {
DrawNormalText(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
&matrix, fill_argb, pOptions);
} else {
DrawTextPath(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
&matrix, nullptr, pGraphState, fill_argb, stroke_argb, nullptr,
0);
}
}
示例6: DrawTextString
void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
FX_FLOAT origin_x,
FX_FLOAT origin_y,
CPDF_Font* pFont,
FX_FLOAT font_size,
const CFX_AffineMatrix* pMatrix,
const CFX_ByteString& str,
FX_ARGB fill_argb,
FX_ARGB stroke_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions) {
int nChars = pFont->CountChar(str, str.GetLength());
if (nChars == 0) {
return;
}
FX_DWORD charcode;
int offset = 0;
FX_DWORD* pCharCodes;
FX_FLOAT* pCharPos;
if (nChars == 1) {
charcode = pFont->GetNextChar(str, str.GetLength(), offset);
pCharCodes = (FX_DWORD*)(uintptr_t)charcode;
pCharPos = NULL;
} else {
pCharCodes = FX_Alloc(FX_DWORD, nChars);
pCharPos = FX_Alloc(FX_FLOAT, nChars - 1);
FX_FLOAT cur_pos = 0;
for (int i = 0; i < nChars; i++) {
pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset);
if (i) {
pCharPos[i - 1] = cur_pos;
}
cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000;
}
}
CFX_AffineMatrix matrix;
if (pMatrix) {
matrix = *pMatrix;
}
matrix.e = origin_x;
matrix.f = origin_y;
if (pFont->GetFontType() == PDFFONT_TYPE3)
;
else if (stroke_argb == 0) {
DrawNormalText(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
&matrix, fill_argb, pOptions);
} else
DrawTextPath(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
&matrix, NULL, pGraphState, fill_argb, stroke_argb, NULL);
if (nChars > 1) {
FX_Free(pCharCodes);
FX_Free(pCharPos);
}
}
示例7: CheckSecurity
FX_BOOL CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
CFX_ByteString password = m_pParser->GetPassword();
if (!password.IsEmpty() &&
CheckPassword(password.raw_str(), password.GetLength(), TRUE,
m_EncryptKey, key_len)) {
m_bOwnerUnlocked = true;
return TRUE;
}
return CheckPassword(password.raw_str(), password.GetLength(), FALSE,
m_EncryptKey, key_len);
}
示例8: GetThisAppearanceStream
void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPWL_Wnd::GetThisAppearanceStream(sAppStream);
CFX_ByteTextBuf sListItems;
if (m_pList) {
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
CFX_FloatRect rcItem = m_pList->GetItemRect(i);
if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom)
continue;
CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (m_pList->IsItemSelected(i)) {
sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
PWL_DEFAULT_SELBACKCOLOR)
.AsStringC();
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
.AsStringC()
<< sItem.AsStringC() << "ET\n";
}
} else {
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(GetTextColor())
.AsStringC()
<< sItem.AsStringC() << "ET\n";
}
}
}
}
if (sListItems.GetLength() > 0) {
CFX_ByteTextBuf sClip;
CFX_FloatRect rcClient = GetClientRect();
sClip << "q\n";
sClip << rcClient.left << " " << rcClient.bottom << " "
<< rcClient.right - rcClient.left << " "
<< rcClient.top - rcClient.bottom << " re W n\n";
sClip << sListItems << "Q\n";
sAppStream << "/Tx BMC\n" << sClip << "EMC\n";
}
}
示例9: GetTitle
void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
CFX_WideString& wsTitle) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo();
if (!pInfoDict)
return;
CFX_ByteString csTitle = pInfoDict->GetStringFor("Title");
wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
csTitle.ReleaseBuffer(csTitle.GetLength());
}
示例10:
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: CheckSecurity
FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(FX_INT32 key_len)
{
CFX_ByteString password = m_pParser->GetPassword();
if (CheckPassword(password, password.GetLength(), TRUE, m_EncryptKey, key_len)) {
if (password.IsEmpty()) {
if (!CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, key_len)) {
return FALSE;
}
}
m_bOwner = TRUE;
return TRUE;
}
return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, key_len);
}
示例12: CalcTextInfo
void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
FXTEXT_CHARPOS* charPos,
CFX_Font* cFont,
FX_FLOAT geWidth,
int32_t fontSize,
FX_FLOAT& charsLen) {
std::unique_ptr<CFX_UnicodeEncodingEx> encoding(
FX_CreateFontEncodingEx(cFont));
int32_t length = text.GetLength();
uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength());
FX_FLOAT charWidth = 0;
for (int32_t j = 0; j < text.GetLength(); j++) {
pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0);
charWidth += temp;
}
charsLen = charWidth;
FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f;
if (leftPositon < 0 && geWidth == 0) {
leftPositon = 0;
}
FX_FLOAT penX = 0.0;
FX_FLOAT penY =
(FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f;
FX_FLOAT left = leftPositon;
FX_FLOAT top = 0.0;
charPos[0].m_OriginX = penX + left;
charPos[0].m_OriginY = penY + top;
charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]);
charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
#endif
penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
for (int32_t i = 1; i < length; i++) {
charPos[i].m_OriginX = penX + left;
charPos[i].m_OriginY = penY + top;
charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
#endif
penX +=
(FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
}
FX_Free(pCharCode);
}
示例13: CheckUserPassword
FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
const uint8_t* password,
FX_DWORD pass_size,
FX_BOOL bIgnoreEncryptMeta,
uint8_t* key,
int32_t key_len) {
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
CFX_ByteString ukey = m_pEncryptDict
? m_pEncryptDict->GetString(FX_BSTRC("U"))
: CFX_ByteString();
if (ukey.GetLength() < 16) {
return FALSE;
}
uint8_t ukeybuf[32];
if (m_Revision == 2) {
FXSYS_memcpy(ukeybuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len);
} else {
uint8_t test[32], tmpkey[32];
FX_DWORD copy_len = sizeof(test);
if (copy_len > (FX_DWORD)ukey.GetLength()) {
copy_len = ukey.GetLength();
}
FXSYS_memset(test, 0, sizeof(test));
FXSYS_memset(tmpkey, 0, sizeof(tmpkey));
FXSYS_memcpy(test, ukey.c_str(), copy_len);
for (int i = 19; i >= 0; i--) {
for (int j = 0; j < key_len; j++) {
tmpkey[j] = key[j] ^ i;
}
CRYPT_ArcFourCryptBlock(test, 32, tmpkey, key_len);
}
uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, defpasscode, 32);
CPDF_Array* pIdArray = m_pParser->GetIDArray();
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(md5, ukeybuf);
return FXSYS_memcmp(test, ukeybuf, 16) == 0;
}
if (FXSYS_memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) {
return TRUE;
}
return FALSE;
}
示例14: JS_appAlert
int CPDFDoc_Environment::JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, FX_UINT Type, FX_UINT Icon)
{
if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert)
{
CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
int ret = m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, pMsg, pTitle, Type, Icon);
bsMsg.ReleaseBuffer();
bsTitle.ReleaseBuffer();
return ret;
}
return -1;
}
示例15: CompareFieldName
int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1,
const CFX_ByteString& name2) {
if (name1.GetLength() == name2.GetLength())
return name1 == name2 ? 1 : 0;
const FX_CHAR* ptr1 = name1.c_str();
const FX_CHAR* ptr2 = name2.c_str();
int i = 0;
while (ptr1[i] == ptr2[i])
i++;
if (i == name1.GetLength())
return 2;
if (i == name2.GetLength())
return 3;
return 0;
}