diff options
author | dsinclair <dsinclair@chromium.org> | 2016-09-15 10:15:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-15 10:15:32 -0700 |
commit | 38fd84428a1ea007a043be0b7d9b289e47aa5da0 (patch) | |
tree | 2bae09e8ae60d6d86e451eb7fa212f7aa9d899a8 /fpdfsdk/fpdfppo.cpp | |
parent | 41d6bbe3d413e7854be89142b70c42a89e315cba (diff) | |
download | pdfium-38fd84428a1ea007a043be0b7d9b289e47aa5da0.tar.xz |
Rename dictionary set and get methods
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For.
BUG=pdfium:596
Review-Url: https://codereview.chromium.org/2334323005
Diffstat (limited to 'fpdfsdk/fpdfppo.cpp')
-rw-r--r-- | fpdfsdk/fpdfppo.cpp | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 3432fb6e6e..8ed8384c24 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -60,33 +60,33 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, CFX_ByteString producerstr; producerstr.Format("PDFium"); - DInfoDict->SetAt("Producer", new CPDF_String(producerstr, FALSE)); + DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE)); - CFX_ByteString cbRootType = pNewRoot->GetStringBy("Type", ""); + CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", ""); if (cbRootType.IsEmpty()) - pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); + pNewRoot->SetFor("Type", new CPDF_Name("Catalog")); - CPDF_Object* pElement = pNewRoot->GetObjectBy("Pages"); + CPDF_Object* pElement = pNewRoot->GetObjectFor("Pages"); CPDF_Dictionary* pNewPages = pElement ? ToDictionary(pElement->GetDirect()) : nullptr; if (!pNewPages) { pNewPages = new CPDF_Dictionary; uint32_t NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); - pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON)); + pNewRoot->SetFor("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON)); } - CFX_ByteString cbPageType = pNewPages->GetStringBy("Type", ""); + CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", ""); if (cbPageType == "") { - pNewPages->SetAt("Type", new CPDF_Name("Pages")); + pNewPages->SetFor("Type", new CPDF_Name("Pages")); } - CPDF_Array* pKeysArray = pNewPages->GetArrayBy("Kids"); + CPDF_Array* pKeysArray = pNewPages->GetArrayFor("Kids"); if (!pKeysArray) { CPDF_Array* pNewKids = new CPDF_Array; uint32_t Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids); - pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum)); - pNewPages->SetAt("Count", new CPDF_Number(0)); + pNewPages->SetFor("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum)); + pNewPages->SetFor("Count", new CPDF_Number(0)); } return TRUE; @@ -111,8 +111,8 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, CPDF_Object* pObj = it.second; if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) { if (pCurPageDict->KeyExist(cbSrcKeyStr)) - pCurPageDict->RemoveAt(cbSrcKeyStr); - pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone()); + pCurPageDict->RemoveFor(cbSrcKeyStr); + pCurPageDict->SetFor(cbSrcKeyStr, pObj->Clone()); } } @@ -126,7 +126,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, // if not exists,we take the letter size. pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox"); if (pInheritable) { - pCurPageDict->SetAt("MediaBox", pInheritable->Clone()); + pCurPageDict->SetFor("MediaBox", pInheritable->Clone()); } else { // Make the default size to be letter size (8.5'x11') CPDF_Array* pArray = new CPDF_Array; @@ -134,10 +134,10 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, pArray->AddNumber(0); pArray->AddNumber(612); pArray->AddNumber(792); - pCurPageDict->SetAt("MediaBox", pArray); + pCurPageDict->SetFor("MediaBox", pArray); } } else { - pCurPageDict->SetAt("MediaBox", pInheritable->Clone()); + pCurPageDict->SetFor("MediaBox", pInheritable->Clone()); } } // 2 Resources //required @@ -145,19 +145,19 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources"); if (!pInheritable) return FALSE; - pCurPageDict->SetAt("Resources", pInheritable->Clone()); + pCurPageDict->SetFor("Resources", pInheritable->Clone()); } // 3 CropBox //Optional if (!pCurPageDict->KeyExist("CropBox")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox"); if (pInheritable) - pCurPageDict->SetAt("CropBox", pInheritable->Clone()); + pCurPageDict->SetFor("CropBox", pInheritable->Clone()); } // 4 Rotate //Optional if (!pCurPageDict->KeyExist("Rotate")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Rotate"); if (pInheritable) - pCurPageDict->SetAt("Rotate", pInheritable->Clone()); + pCurPageDict->SetFor("Rotate", pInheritable->Clone()); } // Update the reference @@ -181,25 +181,26 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type")) return nullptr; - CPDF_Object* pType = pDict->GetObjectBy("Type")->GetDirect(); + CPDF_Object* pType = pDict->GetObjectFor("Type")->GetDirect(); if (!ToName(pType)) return nullptr; if (pType->GetString().Compare("Page")) return nullptr; - CPDF_Dictionary* pp = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect()); + CPDF_Dictionary* pp = + ToDictionary(pDict->GetObjectFor("Parent")->GetDirect()); if (!pp) return nullptr; if (pDict->KeyExist(bsSrcTag)) - return pDict->GetObjectBy(bsSrcTag); + return pDict->GetObjectFor(bsSrcTag); while (pp) { if (pp->KeyExist(bsSrcTag)) - return pp->GetObjectBy(bsSrcTag); + return pp->GetObjectFor(bsSrcTag); if (!pp->KeyExist("Parent")) break; - pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect()); + pp = ToDictionary(pp->GetObjectFor("Parent")->GetDirect()); } return nullptr; } @@ -228,7 +229,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, if (!pNextObj) return FALSE; if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) - pDict->RemoveAt(key); + pDict->RemoveFor(key); } break; } @@ -285,7 +286,7 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { if (pDictClone->KeyExist("Type")) { - CFX_ByteString strType = pDictClone->GetStringBy("Type"); + CFX_ByteString strType = pDictClone->GetStringFor("Type"); if (!FXSYS_stricmp(strType.c_str(), "Pages")) { pDictClone->Release(); return 4; @@ -394,7 +395,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, return FALSE; CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot(); - pSrcDict = pSrcDict->GetDictBy("ViewerPreferences"); + pSrcDict = pSrcDict->GetDictFor("ViewerPreferences"); if (!pSrcDict) return FALSE; @@ -402,6 +403,6 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, if (!pDstDict) return FALSE; - pDstDict->SetAt("ViewerPreferences", pSrcDict->CloneDirectObject()); + pDstDict->SetFor("ViewerPreferences", pSrcDict->CloneDirectObject()); return TRUE; } |