当前位置: 首页>>代码示例>>C++>>正文


C++ CFX_PtrArray::RemoveAt方法代码示例

本文整理汇总了C++中CFX_PtrArray::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_PtrArray::RemoveAt方法的具体用法?C++ CFX_PtrArray::RemoveAt怎么用?C++ CFX_PtrArray::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFX_PtrArray的用法示例。


在下文中一共展示了CFX_PtrArray::RemoveAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InsertDeletePDFPage

static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages,
                               int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL bInsert, CFX_PtrArray& 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") == FX_BSTRC("Page")) {
            if (nPagesToGo == 0) {
                if (bInsert) {
                    pKidList->InsertAt(i, CPDF_Reference::Create(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;
}
开发者ID:ouyang789987,项目名称:PDFium.js,代码行数:44,代码来源:fpdf_edit_doc.cpp

示例2: ProcessObject

FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine)
{
    CPDF_Font* pFont = pObj->GetFont();
    CFX_AffineMatrix matrix;
    pObj->GetTextMatrix(&matrix);
    int item_index = 0;
    if (m_pLastObj) {
        int result = FPDFText_ProcessInterObj(m_pLastObj, pObj);
        if (result == 2) {
            int len = m_Buffer.GetLength();
            if (len && m_bUseLF && m_Buffer.GetBuffer()[len - 1] == L'-') {
                m_Buffer.Delete(len - 1, 1);
                if (m_pObjArray) {
                    m_pObjArray->RemoveAt((len - 1) * 2, 2);
                }
            } else {
                if (bFirstLine) {
                    return TRUE;
                }
                if (m_bUseLF) {
                    m_Buffer.AppendChar(L'\r');
                    m_Buffer.AppendChar(L'\n');
                    if (m_pObjArray) {
                        for (int i = 0; i < 4; i ++) {
                            m_pObjArray->Add(NULL);
                        }
                    }
                } else {
                    m_Buffer.AppendChar(' ');
                    if (m_pObjArray) {
                        m_pObjArray->Add(NULL);
                        m_pObjArray->Add(NULL);
                    }
                }
            }
        } else if (result == 1) {
            m_Buffer.AppendChar(L' ');
            if (m_pObjArray) {
                m_pObjArray->Add(NULL);
                m_pObjArray->Add(NULL);
            }
        } else if (result == -1) {
            m_pLastObj = pObj;
            return FALSE;
        } else if (result == 3) {
            item_index = 1;
        }
    }
    m_pLastObj = pObj;
    int nItems = pObj->CountItems();
    FX_FLOAT Ignorekerning = 0;
    for(int i = 1; i < nItems - 1; i += 2) {
        CPDF_TextObjectItem item;
        pObj->GetItemInfo(i, &item);
        if (item.m_CharCode == (FX_DWORD) - 1) {
            if(i == 1) {
                Ignorekerning = item.m_OriginX;
            } else if(Ignorekerning > item.m_OriginX) {
                Ignorekerning = item.m_OriginX;
            }
        } else {
            Ignorekerning = 0;
            break;
        }
    }
    FX_FLOAT spacing = 0;
    for (; item_index < nItems; item_index ++) {
        CPDF_TextObjectItem item;
        pObj->GetItemInfo(item_index, &item);
        if (item.m_CharCode == (FX_DWORD) - 1) {
            CFX_WideString wstr = m_Buffer.GetWideString();
            if (wstr.IsEmpty() || wstr.GetAt(wstr.GetLength() - 1) == L' ') {
                continue;
            }
            FX_FLOAT fontsize_h = pObj->m_TextState.GetFontSizeH();
            spacing = -fontsize_h * (item.m_OriginX - Ignorekerning) / 1000;
            continue;
        }
        FX_FLOAT charSpace = pObj->m_TextState.GetObject()->m_CharSpace;
        if(nItems > 3 && !spacing) {
            charSpace = 0;
        }
        if((spacing || charSpace) && item_index > 0) {
            int last_width = 0;
            FX_FLOAT fontsize_h = pObj->m_TextState.GetFontSizeH();
            FX_DWORD space_charcode = pFont->CharCodeFromUnicode(' ');
            FX_FLOAT threshold = 0;
            if (space_charcode != -1) {
                threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000 ;
            }
            if(threshold > fontsize_h / 3) {
                threshold = 0;
            } else {
                threshold /= 2;
            }
            if (threshold == 0) {
                threshold = fontsize_h;
                int this_width = FXSYS_abs(GetCharWidth(item.m_CharCode, pFont));
                threshold = this_width > last_width ? (FX_FLOAT)this_width : (FX_FLOAT)last_width;
                int nDivide = 6;
//.........这里部分代码省略.........
开发者ID:151706061,项目名称:PDFium,代码行数:101,代码来源:fpdf_text_search.cpp


注:本文中的CFX_PtrArray::RemoveAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。