本文整理汇总了C++中CFX_ByteString::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteString::GetBuffer方法的具体用法?C++ CFX_ByteString::GetBuffer怎么用?C++ CFX_ByteString::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteString
的用法示例。
在下文中一共展示了CFX_ByteString::GetBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: 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;
}
示例3: sizeof
DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget,
FPDF_WIDESTRING wsText,
FPDF_DWORD* size) {
if (NULL == hWidget || NULL == document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
IXFA_MenuHandler* pXFAMenuHander =
CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
if (pXFAMenuHander == NULL)
return;
CFX_WideString wsCpText;
pXFAMenuHander->Cut((IXFA_Widget*)hWidget, wsCpText);
CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
int len = bsCpText.GetLength() / sizeof(unsigned short);
if (wsText == NULL) {
*size = len;
return;
}
int real_size = len < *size ? len : *size;
if (real_size > 0) {
FXSYS_memcpy((void*)wsText,
bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
real_size * sizeof(unsigned short));
bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short));
}
*size = real_size;
}
示例4: sizeof
DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget,
FPDF_WIDESTRING wsText,
FPDF_DWORD* size) {
if (!hWidget || !document)
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
pContext->GetDocType() != XFA_DOCTYPE_Static)
return;
CFX_WideString wsCpText;
static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsCpText);
CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
if (!wsText) {
*size = len;
return;
}
uint32_t real_size = len < *size ? len : *size;
if (real_size > 0) {
FXSYS_memcpy((void*)wsText,
bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
real_size * sizeof(unsigned short));
bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short));
}
*size = real_size;
}
示例5: PDF_NameEncode
CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
uint8_t* src_buf = (uint8_t*)orig.c_str();
int src_len = orig.GetLength();
int dest_len = 0;
int i;
for (i = 0; i < src_len; i++) {
uint8_t ch = src_buf[i];
if (ch >= 0x80 || PDFCharIsWhitespace(ch) || ch == '#' ||
PDFCharIsDelimiter(ch)) {
dest_len += 3;
} else {
dest_len++;
}
}
if (dest_len == src_len)
return orig;
CFX_ByteString res;
FX_CHAR* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i++) {
uint8_t ch = src_buf[i];
if (ch >= 0x80 || PDFCharIsWhitespace(ch) || ch == '#' ||
PDFCharIsDelimiter(ch)) {
dest_buf[dest_len++] = '#';
dest_buf[dest_len++] = "0123456789ABCDEF"[ch / 16];
dest_buf[dest_len++] = "0123456789ABCDEF"[ch % 16];
} else {
dest_buf[dest_len++] = ch;
}
}
dest_buf[dest_len] = 0;
res.ReleaseBuffer();
return res;
}
示例6: _FPDF_ReadStringFromStreamFile
static CFX_ByteString _FPDF_ReadStringFromStreamFile(IFX_FileStream* pFile, FX_DWORD size)
{
CFX_ByteString buffer;
if (!pFile->ReadBlock(buffer.GetBuffer(size), size)) {
return CFX_ByteString();
}
buffer.ReleaseBuffer(size);
return buffer;
}
示例7: _FPDF_ReadStringFromFile
static CFX_ByteString _FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size)
{
CFX_ByteString buffer;
if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile)) {
return CFX_ByteString();
}
buffer.ReleaseBuffer(size);
return buffer;
}
示例8: JS_docSubmitForm
void CPDFDoc_Environment::JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL)
{
if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_submitForm)
{
CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
FPDF_WIDESTRING pDestination = (FPDF_WIDESTRING)bsDestination.GetBuffer(bsDestination.GetLength());
m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, length, pDestination);
bsDestination.ReleaseBuffer();
}
}
示例9: decodeMacroBlock
int32_t CBC_DecodedBitStreamPaser::decodeMacroBlock(
CFX_Int32Array& codewords,
int32_t codeIndex,
CBC_PDF417ResultMetadata* resultMetadata,
int32_t& e) {
if (codeIndex + NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
e = BCExceptionFormatInstance;
return -1;
}
CFX_Int32Array segmentIndexArray;
segmentIndexArray.SetSize(NUMBER_OF_SEQUENCE_CODEWORDS);
for (int32_t i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
segmentIndexArray.SetAt(i, codewords[codeIndex]);
}
CFX_ByteString str =
decodeBase900toBase10(segmentIndexArray, NUMBER_OF_SEQUENCE_CODEWORDS, e);
BC_EXCEPTION_CHECK_ReturnValue(e, -1);
resultMetadata->setSegmentIndex(atoi(str.GetBuffer(str.GetLength())));
CFX_ByteString fileId;
codeIndex = textCompaction(codewords, codeIndex, fileId);
resultMetadata->setFileId(fileId);
if (codewords[codeIndex] == BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
codeIndex++;
CFX_Int32Array additionalOptionCodeWords;
additionalOptionCodeWords.SetSize(codewords[0] - codeIndex);
int32_t additionalOptionCodeWordsIndex = 0;
FX_BOOL end = FALSE;
while ((codeIndex < codewords[0]) && !end) {
int32_t code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
additionalOptionCodeWords[additionalOptionCodeWordsIndex++] = code;
} else {
switch (code) {
case MACRO_PDF417_TERMINATOR:
resultMetadata->setLastSegment(TRUE);
codeIndex++;
end = TRUE;
break;
default:
e = BCExceptionFormatInstance;
return -1;
}
}
}
CFX_Int32Array array;
array.SetSize(additionalOptionCodeWordsIndex);
array.Copy(additionalOptionCodeWords);
resultMetadata->setOptionalData(array);
} else if (codewords[codeIndex] == MACRO_PDF417_TERMINATOR) {
resultMetadata->setLastSegment(TRUE);
codeIndex++;
}
return codeIndex;
}
示例10: OnBeforeNotifySubmit
bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
return true;
}
if (!m_pContext->GetXFADocView())
return true;
CXFA_FFWidgetHandler* pWidgetHandler =
m_pContext->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return true;
std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
m_pContext->GetXFADocView()->CreateWidgetAccIterator());
if (pWidgetAccIterator) {
CXFA_EventParam Param;
Param.m_eType = XFA_EVENT_PreSubmit;
while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext())
pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
}
pWidgetAccIterator.reset(
m_pContext->GetXFADocView()->CreateWidgetAccIterator());
if (!pWidgetAccIterator)
return true;
CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
pWidgetAcc = pWidgetAccIterator->MoveToNext();
while (pWidgetAcc) {
int fRet = pWidgetAcc->ProcessValidate(-1);
if (fRet == XFA_EVENTERROR_Error) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return false;
CFX_WideString ws;
ws.FromLocal(IDS_XFA_Validate_Input);
CFX_ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 1);
bs.ReleaseBuffer(len);
return false;
}
pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
m_pContext->GetXFADocView()->UpdateDocView();
return true;
}
示例11: 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());
}
示例12:
CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
CFX_ByteString result;
if (!m_pData) {
return result;
}
int len = m_pData->m_nDataLength;
FX_CHAR* buffer = result.GetBuffer(len * 2);
for (int i = 0; i < len; ++i) {
buffer[i * 2] = m_pData->m_String[i] & 0xff;
buffer[i * 2 + 1] = m_pData->m_String[i] >> 8;
}
result.ReleaseBuffer(len * 2);
return result;
}
示例13: FX_GetCodePageFormStringW
FX_WORD FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength) {
if (iLength < 0) {
iLength = FXSYS_wcslen(pStr);
}
if (iLength == 0) {
return 0xFFFF;
}
CFX_ByteString csStr;
FX_CHAR* pBuf = csStr.GetBuffer(iLength + 1);
for (int32_t i = 0; i < iLength; ++i) {
*pBuf++ = (FX_CHAR)*pStr++;
}
csStr.ReleaseBuffer(iLength);
return FX_GetCodePageFromStringA(csStr, iLength);
}
示例14: CFX_ByteString
CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
if (m_pData == NULL) {
return CFX_ByteString(FX_BSTRC("\0\0"));
}
int len = m_pData->m_nDataLength;
CFX_ByteString result;
FX_CHAR* buffer = result.GetBuffer(len * 2 + 2);
for (int i = 0; i < len; i++) {
buffer[i * 2] = m_pData->m_String[i] & 0xff;
buffer[i * 2 + 1] = m_pData->m_String[i] >> 8;
}
buffer[len * 2] = 0;
buffer[len * 2 + 1] = 0;
result.ReleaseBuffer(len * 2 + 2);
return result;
}
示例15: _FPDF_LoadTableFromTTStreamFile
CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag)
{
for (FX_DWORD i = 0; i < nTables; i ++) {
FX_LPCBYTE p = pTables + i * 16;
if (GET_TT_LONG(p) == tag) {
FX_DWORD offset = GET_TT_LONG(p + 8);
FX_DWORD size = GET_TT_LONG(p + 12);
CFX_ByteString buffer;
if (!pFile->ReadBlock(buffer.GetBuffer(size), offset, size)) {
return CFX_ByteString();
}
buffer.ReleaseBuffer(size);
return buffer;
}
}
return CFX_ByteString();
}