本文整理匯總了C++中CFX_WideString函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFX_WideString函數的具體用法?C++ CFX_WideString怎麽用?C++ CFX_WideString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFX_WideString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: FGAS_GetUnicodeBitField
CFGAS_GEFont* CFGAS_FontMgr::GetFontByUnicode(FX_WCHAR wUnicode,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
CFGAS_GEFont* pFont = nullptr;
if (m_FailedUnicodes2Nullptr.Lookup(wUnicode, pFont))
return nullptr;
const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode);
uint16_t wCodePage = x ? x->wCodePage : 0xFFFF;
uint16_t wBitField = x ? x->wBitField : 0x03E7;
CFX_ByteString bsHash;
if (wCodePage == 0xFFFF)
bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles);
else
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
bsHash += CFX_WideString(pszFontFamily).UTF8Encode();
uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts = nullptr;
if (m_Hash2Fonts.Lookup(dwHash, pFonts)) {
if (!pFonts)
return nullptr;
for (int32_t i = 0; i < pFonts->GetSize(); ++i) {
if (VerifyUnicode(pFonts->GetAt(i), wUnicode))
return pFonts->GetAt(i)->Retain();
}
}
if (!pFonts)
pFonts = new CFX_ArrayTemplate<CFGAS_GEFont*>;
m_Hash2Fonts.SetAt(dwHash, pFonts);
CFX_FontDescriptorInfos* sortedFonts = nullptr;
if (!m_Hash2CandidateList.Lookup(dwHash, sortedFonts)) {
sortedFonts = new CFX_FontDescriptorInfos;
MatchFonts(*sortedFonts, wCodePage, dwFontStyles,
CFX_WideString(pszFontFamily), wUnicode);
m_Hash2CandidateList.SetAt(dwHash, sortedFonts);
}
for (int32_t i = 0; i < sortedFonts->GetSize(); ++i) {
CFX_FontDescriptor* pDesc = sortedFonts->GetAt(i).pFont;
if (!VerifyUnicode(pDesc, wUnicode))
continue;
pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr);
if (!pFont)
continue;
pFont->SetLogicalFontStyle(dwFontStyles);
pFonts->Add(pFont);
return pFont;
}
if (!pszFontFamily)
m_FailedUnicodes2Nullptr.SetAt(wUnicode, nullptr);
return nullptr;
}
示例2: CFX_WideString
FX_BOOL util::printx(OBJ_METHOD_PARAMS)
{
int iSize = params.size();
if (iSize<2)
return FALSE;
CFX_WideString sFormat = params[0].operator CFX_WideString();
CFX_WideString sSource = params[1].operator CFX_WideString();
std::string cFormat = (FX_LPCSTR)CFX_ByteString::FromUnicode(sFormat);
std::string cSource = (FX_LPCSTR)CFX_ByteString::FromUnicode(sSource);
std::string cDest;
printx(cFormat,cSource,cDest);
vRet = cDest.c_str();
return TRUE;
}
示例3: ToArray
CFX_WideString CPDF_FormField::GetOptionText(int index, int sub_index) const {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "Opt"));
if (!pArray)
return CFX_WideString();
CPDF_Object* pOption = pArray->GetDirectObjectAt(index);
if (!pOption)
return CFX_WideString();
if (CPDF_Array* pOptionArray = pOption->AsArray())
pOption = pOptionArray->GetDirectObjectAt(sub_index);
CPDF_String* pString = ToString(pOption);
return pString ? pString->GetUnicodeText() : CFX_WideString();
}
示例4: CFX_WideString
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;
}
示例5: GetUnicodeFromCharCode
CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
FX_WCHAR ret = GetUnicodeFromCharCode(charcode);
return ret ? ret : CFX_WideString();
}
示例6: FX_OpenFolder
CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
Restart:
void* pCurHandle =
m_FolderQueue.GetSize() != 0
? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle
: nullptr;
if (!pCurHandle) {
if (m_FolderPaths.GetSize() < 1) {
return "";
}
pCurHandle =
FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str());
FX_HandleParentPath hpp;
hpp.pFileHandle = pCurHandle;
hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1];
m_FolderQueue.Add(hpp);
}
CFX_ByteString bsName;
FX_BOOL bFolder;
CFX_ByteString bsFolderSpearator =
CFX_ByteString::FromUnicode(CFX_WideString(FX_GetFolderSeparator()));
while (TRUE) {
if (!FX_GetNextFile(pCurHandle, bsName, bFolder)) {
FX_CloseFolder(pCurHandle);
m_FolderQueue.RemoveAt(m_FolderQueue.GetSize() - 1);
if (m_FolderQueue.GetSize() == 0) {
m_FolderPaths.RemoveAt(m_FolderPaths.GetSize() - 1);
if (m_FolderPaths.GetSize() == 0) {
return "";
} else {
goto Restart;
}
}
pCurHandle =
m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle;
continue;
}
if (bsName == "." || bsName == "..") {
continue;
}
if (bFolder) {
FX_HandleParentPath hpp;
hpp.bsParentPath =
m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
bsFolderSpearator + bsName;
hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
if (!hpp.pFileHandle) {
continue;
}
m_FolderQueue.Add(hpp);
pCurHandle = hpp.pFileHandle;
continue;
}
bsName =
m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
bsFolderSpearator + bsName;
break;
}
return bsName;
}
示例7: FILESPEC_DecodeFileName
static CFX_WideString FILESPEC_DecodeFileName(const CFX_WideStringC& filepath) {
if (filepath.GetLength() <= 1) {
return CFX_WideString();
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (filepath.Left(sizeof("/Mac") - 1) == CFX_WideStringC(L"/Mac")) {
return ChangeSlashToPlatform(filepath.GetPtr() + 1);
}
return ChangeSlashToPlatform(filepath.GetPtr());
#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
if (filepath.GetAt(0) != '/') {
return ChangeSlashToPlatform(filepath.GetPtr());
}
if (filepath.GetAt(1) == '/') {
return ChangeSlashToPlatform(filepath.GetPtr() + 1);
}
if (filepath.GetAt(2) == '/') {
CFX_WideString result;
result += filepath.GetAt(1);
result += ':';
result += ChangeSlashToPlatform(filepath.GetPtr() + 2);
return result;
}
CFX_WideString result;
result += '\\';
result += ChangeSlashToPlatform(filepath.GetPtr());
return result;
#else
return filepath;
#endif
}
示例8: CFX_WideString
CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb,
int32_t startPos,
int32_t& e) {
int32_t len = sb.GetLength() - startPos;
if (len == 0) {
e = BCExceptionNoContents;
return CFX_WideString();
}
FX_WCHAR c1 = sb.GetAt(startPos);
FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0;
FX_WCHAR c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0;
FX_WCHAR c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0;
int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
FX_WCHAR cw1 = (FX_WCHAR)((v >> 16) & 255);
FX_WCHAR cw2 = (FX_WCHAR)((v >> 8) & 255);
FX_WCHAR cw3 = (FX_WCHAR)(v & 255);
CFX_WideString res;
res += cw1;
if (len >= 2) {
res += cw2;
}
if (len >= 3) {
res += cw3;
}
return res;
}
示例9: sizeof
CFX_WideString Document::CutString(CFX_WideString cbFrom)
{
size_t iLength = cbFrom.GetLength();
pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t);
iSize *= (iLength + 1);
wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie());
wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength);
for (int i = 0; i < iLength; i++)
{
if (pFrom[i] == L'\\' || pFrom[i] == L'/')
{
pResult[i] = L'\0';
break;
}
pResult[i] = pFrom[i];
}
pResult[iLength] = L'\0';
cbFrom.ReleaseBuffer();
CFX_WideString cbRet = CFX_WideString(pResult);
free(pResult);
pResult = NULL;
return cbRet;
}
示例10: CFX_WideString
IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadHTMLStandardStyleSheet() {
static const FX_WCHAR* s_pStyle =
L"html,address,blockquote,body,dd,div,dl,dt,fieldset,form,frame,frameset,"
L"h1,h2,h3,h4,h5,h6,noframes,ol,p,ul,center,dir,hr,menu,pre{display:"
L"block}"
L"li{display:list-item}head{display:none}table{display:table}tr{display:"
L"table-row}thead{display:table-header-group}tbody{display:table-row-"
L"group}tfoot{display:table-footer-group}"
L"col{display:table-column}colgroup{display:table-column-group}td,th{"
L"display:table-cell}caption{display:table-caption}th{font-weight:bolder;"
L"text-align:center}caption{text-align:center}"
L"body{margin:0}h1{font-size:2em;margin:.67em "
L"0}h2{font-size:1.5em;margin:.75em 0}h3{font-size:1.17em;margin:.83em "
L"0}h4,p,blockquote,ul,fieldset,form,ol,dl,dir,menu{margin:1.12em 0}"
L"h5{font-size:.83em;margin:1.5em 0}h6{font-size:.75em;margin:1.67em "
L"0}h1,h2,h3,h4,h5,h6,b,strong{font-weight:bolder}blockquote{margin-left:"
L"40px;margin-right:40px}i,cite,em,var,address{font-style:italic}"
L"pre,tt,code,kbd,samp{font-family:monospace}pre{white-space:pre}button,"
L"textarea,input,select{display:inline-block}big{font-size:1.17em}small,"
L"sub,sup{font-size:.83em}sub{vertical-align:sub}"
L"sup{vertical-align:super}table{border-spacing:2px}thead,tbody,tfoot{"
L"vertical-align:middle}td,th,tr{vertical-align:inherit}s,strike,del{"
L"text-decoration:line-through}hr{border:1px inset silver}"
L"ol,ul,dir,menu,dd{margin-left:40px}ol{list-style-type:decimal}ol ul,ul "
L"ol,ul ul,ol "
L"ol{margin-top:0;margin-bottom:0}u,ins{text-decoration:underline}center{"
L"text-align:center}"
L"ruby{display:ruby}rt{display:ruby-text;font-size:.5em}rb{display:ruby-"
L"base}rbc{display:ruby-base-group}rtc{display:ruby-text-group}"
L"q:before{content:open-quote}q:after{content:close-quote}"
L"rp{display:none}";
return IFDE_CSSStyleSheet::LoadFromBuffer(
CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8);
}
示例11: name_extractor
CPDF_FormField* CFieldTree::RemoveField(const CFX_WideString& full_name) {
if (full_name == L"")
return nullptr;
CFieldNameExtractor name_extractor(full_name);
const FX_WCHAR* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
Node* pNode = &m_Root;
Node* pLast = nullptr;
while (nLength > 0 && pNode) {
pLast = pNode;
CFX_WideString name = CFX_WideString(pName, nLength);
pNode = Lookup(pLast, name);
name_extractor.GetNext(pName, nLength);
}
if (pNode && pNode != &m_Root) {
for (int i = 0; i < pLast->children.GetSize(); i++) {
if (pNode == pLast->children[i]) {
pLast->children.RemoveAt(i);
break;
}
}
CPDF_FormField* pField = pNode->field_ptr;
RemoveNode(pNode);
return pField;
}
return nullptr;
}
示例12: GetElement
CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key,
CFX_CharMap* pCharMap) const {
CPDF_Object* p = GetElement(key);
if (CPDF_Reference* pRef = ToReference(p))
p = pRef->GetDirect();
return p ? p->GetUnicodeText(pCharMap) : CFX_WideString();
}
示例13: WSToJSString
v8::Handle<v8::String> WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* PropertyName, int Len = -1)
{
CFX_WideString ws = CFX_WideString(PropertyName,Len);
CFX_ByteString bs = ws.UTF8Encode();
if(!pJSRuntime) pJSRuntime = v8::Isolate::GetCurrent();
return v8::String::NewFromUtf8(pJSRuntime, bs.c_str());
}
示例14: CFX_WideString
CFX_WideString CFPF_SkiaFont::GetPsName()
{
if (!m_Face) {
return CFX_WideString();
}
return CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face));
}
示例15: CFX_WideString
CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const
{
if (this == NULL) {
return CFX_WideString();
}
if (m_Type == PDFOBJ_STRING) {
return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap);
} else if (m_Type == PDFOBJ_STREAM) {
CPDF_StreamAcc stream;
stream.LoadAllData((CPDF_Stream*)this, FALSE);
CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize(), pCharMap);
return result;
} else if (m_Type == PDFOBJ_NAME) {
return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap);
}
return CFX_WideString();
}