本文整理汇总了C++中CPDF_Object::GetInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Object::GetInteger方法的具体用法?C++ CPDF_Object::GetInteger怎么用?C++ CPDF_Object::GetInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Object
的用法示例。
在下文中一共展示了CPDF_Object::GetInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAsynDoc
void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_bLinearized = TRUE;
m_LastObjNum = m_pParser->GetLastObjNum();
CPDF_Object* pIndirectObj =
GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
if (!m_pRootDict) {
return;
}
pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr);
m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
CPDF_Array* pIDArray = m_pParser->GetIDArray();
if (pIDArray) {
m_ID1 = pIDArray->GetString(0);
m_ID2 = pIDArray->GetString(1);
}
FX_DWORD dwPageCount = 0;
CPDF_Object* pCount = pLinearized->GetElement("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
m_PageList.SetSize(dwPageCount);
CPDF_Object* pNo = pLinearized->GetElement("P");
if (ToNumber(pNo))
m_dwFirstPageNo = pNo->GetInteger();
CPDF_Object* pObjNum = pLinearized->GetElement("O");
if (ToNumber(pObjNum))
m_dwFirstPageObjNum = pObjNum->GetInteger();
}
示例2: GetInteger
int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key, int def) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetInteger();
}
return def;
}
示例3: GetInteger
int CPDF_Object::GetInteger() const
{
CFX_AutoRestorer<int> restorer(&s_nCurRefDepth);
if (++s_nCurRefDepth > OBJECT_REF_MAX_DEPTH) {
return 0;
}
switch (m_Type) {
case PDFOBJ_BOOLEAN:
return ((CPDF_Boolean*)this)->m_bValue;
case PDFOBJ_NUMBER:
return ((CPDF_Number*)this)->GetInteger();
case PDFOBJ_REFERENCE: {
CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
PARSE_CONTEXT context;
FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
if (pRef->m_pObjList == NULL) {
return 0;
}
CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum, &context);
if (pObj == NULL) {
return 0;
}
return pObj->GetInteger();
}
}
return 0;
}
示例4: GetBoolean
FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key,
FX_BOOL bDefault) const {
CPDF_Object* p = GetElement(key);
if (ToBoolean(p))
return p->GetInteger();
return bDefault;
}
示例5: CPDFPageFromFPDFPage
DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
!pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
"Page")) {
return -1;
}
CPDF_Dictionary* pDict = pPage->m_pFormDict;
if (!pDict)
return -1;
while (pDict) {
if (pDict->KeyExist("Rotate")) {
CPDF_Object* pRotateObj = pDict->GetElement("Rotate")->GetDirect();
return pRotateObj ? pRotateObj->GetInteger() / 90 : 0;
}
if (!pDict->KeyExist("Parent"))
break;
pDict = ToDictionary(pDict->GetElement("Parent")->GetDirect());
}
return 0;
}
示例6: GetFieldFlags
uint32_t CPDF_FormField::GetFieldFlags() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "Ff");
if (!pObj) {
return 0;
}
return pObj->GetInteger();
}
示例7: GetTopVisibleIndex
int CPDF_FormField::GetTopVisibleIndex() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TI");
if (!pObj) {
return 0;
}
return pObj->GetInteger();
}
示例8: GetFieldFlags
FX_DWORD CPDF_FormField::GetFieldFlags() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "Ff");
if (!pObj) {
return 0;
}
return pObj->GetInteger();
}
示例9: GetAttr
int CPDF_StructElementImpl::GetInteger(FX_BSTR owner, FX_BSTR name, int default_value, FX_BOOL bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) {
return default_value;
}
return pAttr->GetInteger();
}
示例10: GetInteger
int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
int default_value,
FX_BOOL bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
return ToNumber(pAttr) ? pAttr->GetInteger() : default_value;
}
示例11: info
FX_BOOL Document::info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo();
if (!pDictionary)return FALSE;
CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author");
CFX_WideString cwTitle = pDictionary->GetUnicodeText("Title");
CFX_WideString cwSubject = pDictionary->GetUnicodeText("Subject");
CFX_WideString cwKeywords = pDictionary->GetUnicodeText("Keywords");
CFX_WideString cwCreator = pDictionary->GetUnicodeText("Creator");
CFX_WideString cwProducer = pDictionary->GetUnicodeText("Producer");
CFX_WideString cwCreationDate = pDictionary->GetUnicodeText("CreationDate");
CFX_WideString cwModDate = pDictionary->GetUnicodeText("ModDate");
CFX_WideString cwTrapped = pDictionary->GetUnicodeText("Trapped");
v8::Isolate* isolate = GetIsolate(cc);
if (vp.IsGetting())
{
CJS_Context* pContext = (CJS_Context *)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, -1);
JS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str());
JS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str());
JS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str());
JS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str());
JS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str());
JS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str());
JS_PutObjectString(isolate, pObj, L"CreationDate", cwCreationDate.c_str());
JS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str());
JS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str());
// It's to be compatible to non-standard info dictionary.
FX_POSITION pos = pDictionary->GetStartPos();
while(pos)
{
CFX_ByteString bsKey;
CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey);
CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength());
if((pValueObj->GetType()==PDFOBJ_STRING) || (pValueObj->GetType()==PDFOBJ_NAME) )
JS_PutObjectString(isolate, pObj, wsKey.c_str(), pValueObj->GetUnicodeText().c_str());
if(pValueObj->GetType()==PDFOBJ_NUMBER)
JS_PutObjectNumber(isolate,pObj, wsKey.c_str(), (float)pValueObj->GetNumber());
if(pValueObj->GetType()==PDFOBJ_BOOLEAN)
JS_PutObjectBoolean(isolate,pObj, wsKey.c_str(), (bool)pValueObj->GetInteger());
}
vp << pObj;
return TRUE;
}
else
{
return TRUE;
}
}
示例12: LoadMetricsArray
void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
std::vector<uint32_t>* result,
int nElements) {
int width_status = 0;
int iCurElement = 0;
int first_code = 0;
int last_code = 0;
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (!pObj)
continue;
if (CPDF_Array* pObjArray = pObj->AsArray()) {
if (width_status != 1)
return;
for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) {
result->push_back(first_code);
result->push_back(first_code);
for (int k = 0; k < nElements; k++)
result->push_back(pObjArray->GetIntegerAt(j + k));
first_code++;
}
width_status = 0;
} else {
if (width_status == 0) {
first_code = pObj->GetInteger();
width_status = 1;
} else if (width_status == 1) {
last_code = pObj->GetInteger();
width_status = 2;
iCurElement = 0;
} else {
if (!iCurElement) {
result->push_back(first_code);
result->push_back(last_code);
}
result->push_back(pObj->GetInteger());
iCurElement++;
if (iCurElement == nElements)
width_status = 0;
}
}
}
}
示例13: GetInteger
int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key) const
{
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
if (p) {
return p->GetInteger();
}
return 0;
}
示例14: GetBoolean
FX_BOOL CPDF_Dictionary::GetBoolean(FX_BSTR key, FX_BOOL bDefault) const
{
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
if (p && p->GetType() == PDFOBJ_BOOLEAN) {
return p->GetInteger();
}
return bDefault;
}
示例15: LoadLinearizedDoc
void CPDF_Document::LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams) {
m_bLinearized = true;
LoadDocInternal();
uint32_t dwPageCount = 0;
CPDF_Object* pCount = pLinearizationParams->GetObjectFor("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
m_PageList.SetSize(dwPageCount);
CPDF_Object* pNo = pLinearizationParams->GetObjectFor("P");
if (ToNumber(pNo))
m_iFirstPageNo = pNo->GetInteger();
CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O");
if (ToNumber(pObjNum))
m_dwFirstPageObjNum = pObjNum->GetInteger();
}