本文整理汇总了C++中CFX_ArrayTemplate::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ArrayTemplate::GetSize方法的具体用法?C++ CFX_ArrayTemplate::GetSize怎么用?C++ CFX_ArrayTemplate::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ArrayTemplate
的用法示例。
在下文中一共展示了CFX_ArrayTemplate::GetSize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CountFields
int CountFields(int nLevel = 0) {
if (nLevel > nMaxRecursion)
return 0;
if (field_ptr)
return 1;
int count = 0;
for (int i = 0; i < children.GetSize(); i++)
count += children.GetAt(i)->CountFields(nLevel + 1);
return count;
}
示例2: SetSelector
void CFDE_CSSStyleRule::SetSelector(
IFX_MemoryAllocator* pStaticStore,
const CFX_ArrayTemplate<CFDE_CSSSelector*>& list) {
ASSERT(!m_ppSelector);
m_iSelectors = list.GetSize();
m_ppSelector = static_cast<CFDE_CSSSelector**>(
pStaticStore->Alloc(m_iSelectors * sizeof(CFDE_CSSSelector*)));
for (int32_t i = 0; i < m_iSelectors; ++i) {
m_ppSelector[i] = list.GetAt(i);
}
}
示例3: CheckPage
bool CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
uint32_t iPageObjs = m_PageObjList.GetSize();
CFX_ArrayTemplate<uint32_t> UnavailObjList;
for (uint32_t i = 0; i < iPageObjs; ++i) {
uint32_t dwPageObjNum = m_PageObjList.GetAt(i);
bool bExist = false;
std::unique_ptr<CPDF_Object> pObj =
GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
if (bExist)
UnavailObjList.Add(dwPageObjNum);
continue;
}
CPDF_Array* pArray = ToArray(pObj.get());
if (pArray) {
for (const auto& pArrayObj : *pArray) {
if (CPDF_Reference* pRef = ToReference(pArrayObj.get()))
UnavailObjList.Add(pRef->GetRefObjNum());
}
}
if (!pObj->IsDictionary())
continue;
CFX_ByteString type = pObj->GetDict()->GetStringFor("Type");
if (type == "Pages") {
m_PagesArray.push_back(std::move(pObj));
continue;
}
}
m_PageObjList.RemoveAll();
if (UnavailObjList.GetSize()) {
m_PageObjList.Append(UnavailObjList);
return false;
}
uint32_t iPages = m_PagesArray.size();
for (uint32_t i = 0; i < iPages; i++) {
std::unique_ptr<CPDF_Object> pPages = std::move(m_PagesArray[i]);
if (pPages && !GetPageKids(m_pCurrentParser, pPages.get())) {
m_PagesArray.clear();
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
}
m_PagesArray.clear();
if (!m_PageObjList.GetSize())
m_docStatus = PDF_DATAAVAIL_DONE;
return true;
}
示例4: NextStates
void CFWL_CheckBoxImp::NextStates() {
uint32_t dwFirststate = m_pProperties->m_dwStates;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Unchecked) {
CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
if (!pWidgetMgr->IsFormDisabled()) {
CFX_ArrayTemplate<IFWL_Widget*> radioarr;
pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr);
IFWL_CheckBox* pCheckBox = nullptr;
int32_t iCount = radioarr.GetSize();
for (int32_t i = 0; i < iCount; i++) {
pCheckBox = static_cast<IFWL_CheckBox*>(radioarr[i]);
if (pCheckBox != m_pInterface &&
pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
pCheckBox->SetCheckState(0);
CFX_RectF rt;
pCheckBox->GetWidgetRect(rt);
rt.left = rt.top = 0;
m_pWidgetMgr->RepaintWidget(pCheckBox, &rt);
break;
}
}
}
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
} else {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Neutral) {
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) {
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
} else if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Checked) {
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
} else {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) {
m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral;
} else {
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
}
}
Repaint(&m_rtClient);
uint32_t dwLaststate = m_pProperties->m_dwStates;
if (dwFirststate != dwLaststate) {
CFWL_EvtCkbCheckStateChanged wmCheckBoxState;
wmCheckBoxState.m_pSrcTarget = m_pInterface;
DispatchEvent(&wmCheckBoxState);
}
}
示例5: GetFontByUnicode
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;
}
示例6: delay
FX_BOOL Document::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
if (vp.IsGetting())
{
vp << m_bDelay;
return TRUE;
}
else
{
ASSERT(m_pDocument != NULL);
if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE;
bool b;
vp >> b;
m_bDelay = b;
if (m_bDelay)
{
for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++)
delete m_DelayData.GetAt(i);
m_DelayData.RemoveAll();
}
else
{
CFX_ArrayTemplate<CJS_DelayData*> DelayDataToProcess;
for (int i=0,sz=m_DelayData.GetSize(); i < sz; i++)
{
if (CJS_DelayData* pData = m_DelayData.GetAt(i))
{
DelayDataToProcess.Add(pData);
m_DelayData.SetAt(i, NULL);
}
}
m_DelayData.RemoveAll();
for (int i=0,sz=DelayDataToProcess.GetSize(); i < sz; i++)
{
CJS_DelayData* pData = DelayDataToProcess.GetAt(i);
Field::DoDelay(m_pDocument, pData);
DelayDataToProcess.SetAt(i,NULL);
delete pData;
}
}
return TRUE;
}
}
示例7: GetField
CPDF_FormField* GetField(int* fields_to_go) {
if (field_ptr) {
if (*fields_to_go == 0)
return field_ptr;
--*fields_to_go;
return nullptr;
}
for (int i = 0; i < children.GetSize(); i++) {
if (CPDF_FormField* pField = children.GetAt(i)->GetField(fields_to_go))
return pField;
}
return nullptr;
}
示例8: InsertDeletePDFPage
static int InsertDeletePDFPage(CPDF_Document* pDoc,
CPDF_Dictionary* pPages,
int nPagesToGo,
CPDF_Dictionary* pPage,
FX_BOOL bInsert,
CFX_ArrayTemplate<CPDF_Dictionary*>& stackList) {
CPDF_Array* pKidList = pPages->GetArray("Kids");
if (!pKidList) {
return -1;
}
int nKids = pKidList->GetCount();
for (int i = 0; i < nKids; i++) {
CPDF_Dictionary* pKid = pKidList->GetDict(i);
if (pKid->GetString("Type") == "Page") {
if (nPagesToGo == 0) {
if (bInsert) {
pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum()));
pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum());
} else {
pKidList->RemoveAt(i);
}
pPages->SetAtInteger("Count",
pPages->GetInteger("Count") + (bInsert ? 1 : -1));
return 1;
}
nPagesToGo--;
} else {
int nPages = pKid->GetInteger("Count");
if (nPagesToGo < nPages) {
int stackCount = stackList.GetSize();
for (int j = 0; j < stackCount; ++j) {
if (pKid == stackList[j]) {
return -1;
}
}
stackList.Add(pKid);
if (InsertDeletePDFPage(pDoc, pKid, nPagesToGo, pPage, bInsert,
stackList) < 0) {
return -1;
}
stackList.RemoveAt(stackCount);
pPages->SetAtInteger("Count",
pPages->GetInteger("Count") + (bInsert ? 1 : -1));
return 1;
}
nPagesToGo -= nPages;
}
}
return 0;
}
示例9: RecoverParagEnd
void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) {
FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r';
if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) {
CFX_ArrayTemplate<int32_t> PosArr;
int32_t nLength = wsText.GetLength();
int32_t i = 0;
FX_WCHAR* lpPos = const_cast<FX_WCHAR*>(wsText.c_str());
for (i = 0; i < nLength; i++, lpPos++) {
if (*lpPos == m_wLineEnd) {
*lpPos = wc;
PosArr.Add(i);
}
}
const FX_WCHAR* lpSrcBuf = wsText.c_str();
CFX_WideString wsTemp;
int32_t nCount = PosArr.GetSize();
FX_WCHAR* lpDstBuf = wsTemp.GetBuffer(nLength + nCount);
int32_t nDstPos = 0;
int32_t nSrcPos = 0;
for (i = 0; i < nCount; i++) {
int32_t nPos = PosArr[i];
int32_t nCopyLen = nPos - nSrcPos + 1;
FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos,
nCopyLen * sizeof(FX_WCHAR));
nDstPos += nCopyLen;
nSrcPos += nCopyLen;
lpDstBuf[nDstPos] = L'\n';
nDstPos++;
}
if (nSrcPos < nLength) {
FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos,
(nLength - nSrcPos) * sizeof(FX_WCHAR));
}
wsTemp.ReleaseBuffer(nLength + nCount);
wsText = wsTemp;
} else {
int32_t nLength = wsText.GetLength();
FX_WCHAR* lpBuf = const_cast<FX_WCHAR*>(wsText.c_str());
for (int32_t i = 0; i < nLength; i++, lpBuf++) {
if (*lpBuf == m_wLineEnd)
*lpBuf = wc;
}
}
}
示例10: GetFontByCodePage
CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
CFX_ByteString bsHash;
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;
if (pFonts->GetSize() != 0)
return pFonts->GetAt(0)->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), 0);
m_Hash2CandidateList.SetAt(dwHash, sortedFonts);
}
if (sortedFonts->GetSize() == 0)
return nullptr;
CFX_FontDescriptor* pDesc = sortedFonts->GetAt(0).pFont;
CFGAS_GEFont* pFont =
LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr);
if (pFont)
pFont->SetLogicalFontStyle(dwFontStyles);
pFonts->Add(pFont);
return pFont;
}
示例11: LoadParag
void CFDE_TxtEdtParag::LoadParag() {
if (m_lpData) {
m_lpData[0]++;
return;
}
CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams();
FX_WCHAR wcAlias = 0;
if (pParam->dwMode & FDE_TEXTEDITMODE_Password) {
wcAlias = m_pEngine->GetAliasChar();
}
std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBuf::Iterator(
static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias));
pIter->SetAt(m_nCharStart);
int32_t nEndIndex = m_nCharStart + m_nCharCount;
CFX_ArrayTemplate<int32_t> LineBaseArr;
bool bReload = false;
uint32_t dwBreakStatus = FX_TXTBREAK_None;
do {
if (bReload) {
dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
} else {
FX_WCHAR wAppend = pIter->GetChar();
dwBreakStatus = pTxtBreak->AppendChar(wAppend);
}
if (pIter->GetAt() + 1 == nEndIndex &&
dwBreakStatus < FX_TXTBREAK_LineBreak) {
dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
}
if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
int32_t nCount = pTxtBreak->CountBreakPieces();
int32_t nTotal = 0;
for (int32_t j = 0; j < nCount; j++) {
const CFX_TxtPiece* Piece = pTxtBreak->GetBreakPiece(j);
nTotal += Piece->GetLength();
}
LineBaseArr.Add(nTotal);
pTxtBreak->ClearBreakPieces();
}
if ((pIter->GetAt() + 1 == nEndIndex) &&
(dwBreakStatus == FX_TXTBREAK_LineBreak)) {
bReload = true;
pIter->Next(true);
}
} while (pIter->Next(false) && (pIter->GetAt() < nEndIndex));
pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
pTxtBreak->ClearBreakPieces();
int32_t nLineCount = LineBaseArr.GetSize();
m_nLineCount = nLineCount;
if (m_lpData) {
m_lpData = FX_Realloc(int32_t, m_lpData, nLineCount + 1);
} else {
m_lpData = FX_Alloc(int32_t, nLineCount + 1);
}
int32_t* pIntArr = m_lpData;
pIntArr[0] = 1;
m_nLineCount = nLineCount;
pIntArr++;
for (int32_t j = 0; j < nLineCount; j++, pIntArr++) {
*pIntArr = LineBaseArr[j];
}
LineBaseArr.RemoveAll();
}