本文整理汇总了C++中CPDF_Object::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Object::Release方法的具体用法?C++ CPDF_Object::Release怎么用?C++ CPDF_Object::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Object
的用法示例。
在下文中一共展示了CPDF_Object::Release方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndKeyword
void CPDF_StreamContentParser::EndKeyword()
{
CPDF_Object *pObj = NULL;
if (m_WordSize == 4) {
if (*(FX_DWORD*)m_pWordBuf == FXDWORD_TRUE) {
pObj = CPDF_Boolean::Create(TRUE);
if (!SetToCurObj(pObj)) {
pObj->Release();
}
return;
} else if (*(FX_DWORD*)m_pWordBuf == FXDWORD_NULL) {
pObj = CPDF_Null::Create();
if (!SetToCurObj(pObj)) {
pObj->Release();
}
return;
}
} else if (m_WordSize == 5) {
if (*(FX_DWORD*)m_pWordBuf == FXDWORD_FALS && m_pWordBuf[4] == 'e') {
pObj = CPDF_Boolean::Create(FALSE);
if (!SetToCurObj(pObj)) {
pObj->Release();
}
return;
}
}
m_pWordBuf[m_WordSize] = 0;
OnOperator((char*)m_pWordBuf);
ClearAllParams();
}
示例2: RemoveAt
void CPDF_Array::RemoveAt(FX_DWORD i)
{
ASSERT(this != NULL && m_Type == PDFOBJ_ARRAY);
if (i >= (FX_DWORD)m_Objects.GetSize()) {
return;
}
CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i);
p->Release();
m_Objects.RemoveAt(i);
}
示例3: RemoveAt
void CPDF_Dictionary::RemoveAt(FX_BSTR key)
{
ASSERT(m_Type == PDFOBJ_DICTIONARY);
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
if (p == NULL) {
return;
}
p->Release();
m_Map.RemoveKey(key);
}
示例4: SetAt
void CPDF_Array::SetAt(FX_DWORD i, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs)
{
ASSERT(this != NULL && m_Type == PDFOBJ_ARRAY);
ASSERT(i < (FX_DWORD)m_Objects.GetSize());
if (i >= (FX_DWORD)m_Objects.GetSize()) {
return;
}
CPDF_Object* pOld = (CPDF_Object*)m_Objects.GetAt(i);
pOld->Release();
if (pObj->GetObjNum()) {
ASSERT(pObjs != NULL);
pObj = CPDF_Reference::Create(pObjs, pObj->GetObjNum());
}
m_Objects.SetAt(i, pObj);
}
示例5: GetNewObjId
FX_DWORD CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc,
ObjectNumberMap* pObjNumberMap,
CPDF_Reference* pRef) {
if (!pRef)
return 0;
FX_DWORD dwObjnum = pRef->GetRefObjNum();
FX_DWORD dwNewObjNum = 0;
const auto it = pObjNumberMap->find(dwObjnum);
if (it != pObjNumberMap->end())
dwNewObjNum = it->second;
if (dwNewObjNum)
return dwNewObjNum;
CPDF_Object* pDirect = pRef->GetDirect();
if (!pDirect)
return 0;
CPDF_Object* pClone = pDirect->Clone();
if (!pClone)
return 0;
if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) {
if (pDictClone->KeyExist("Type")) {
CFX_ByteString strType = pDictClone->GetString("Type");
if (!FXSYS_stricmp(strType, "Pages")) {
pDictClone->Release();
return 4;
}
if (!FXSYS_stricmp(strType, "Page")) {
pDictClone->Release();
return 0;
}
}
}
dwNewObjNum = pDoc->AddIndirectObject(pClone);
(*pObjNumberMap)[dwObjnum] = dwNewObjNum;
if (!UpdateReference(pClone, pDoc, pObjNumberMap)) {
pClone->Release();
return 0;
}
return dwNewObjNum;
}
示例6: EndDict
void CPDF_StreamContentParser::EndDict()
{
if (m_ObjectSize == 0) {
return;
}
CPDF_Object* pCurObj = m_pObjectStack[m_ObjectSize - 1];
if (pCurObj->GetType() != PDFOBJ_DICTIONARY) {
return;
}
m_ObjectSize --;
if (m_ObjectSize == 0) {
AddObjectParam(pCurObj);
} else {
if (!m_pObjectState[m_ObjectSize]) {
pCurObj->Release();
}
}
m_pObjectState[m_ObjectSize] = FALSE;
}
示例7: SetAt
void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs)
{
ASSERT(m_Type == PDFOBJ_DICTIONARY);
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
if (p == pObj) {
return;
}
if (p)
p->Release();
if (pObj) {
if (pObj->GetObjNum()) {
ASSERT(pObjs != NULL);
pObj = CPDF_Reference::Create(pObjs, pObj->GetObjNum());
}
m_Map.SetAt(key, pObj);
} else {
m_Map.RemoveKey(key);
}
}
示例8: Handle_BeginImage
void CPDF_StreamContentParser::Handle_BeginImage()
{
FX_FILESIZE savePos = m_pSyntax->GetPos();
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
if (type == CPDF_StreamParser::Keyword) {
CFX_ByteString bsKeyword(m_pSyntax->GetWordBuf(), m_pSyntax->GetWordSize());
if (bsKeyword != FX_BSTRC("ID")) {
m_pSyntax->SetPos(savePos);
pDict->Release();
return;
}
}
if (type != CPDF_StreamParser::Name) {
break;
}
CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1);
CPDF_Object* pObj = m_pSyntax->ReadNextObject();
if (!key.IsEmpty()) {
pDict->SetAt(key, pObj, m_pDocument);
} else if (pObj) {
pObj->Release();
}
}
_PDF_ReplaceAbbr(pDict);
CPDF_Object* pCSObj = NULL;
if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) {
pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj->GetType() == PDFOBJ_NAME) {
CFX_ByteString name = pCSObj->GetString();
if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && name != FX_BSTRC("DeviceCMYK")) {
pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name);
if (pCSObj && !pCSObj->GetObjNum()) {
pCSObj = pCSObj->Clone();
pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj, m_pDocument);
}
}
}
}
CPDF_Stream* pStream = m_pSyntax->ReadInlineStream(m_pDocument, pDict, pCSObj, m_Options.m_bDecodeInlineImage);
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
if (type == CPDF_StreamParser::EndOfData) {
break;
}
if (type != CPDF_StreamParser::Keyword) {
continue;
}
if (m_pSyntax->GetWordSize() == 2 && m_pSyntax->GetWordBuf()[0] == 'E' &&
m_pSyntax->GetWordBuf()[1] == 'I') {
break;
}
}
if (m_Options.m_bTextOnly) {
if (pStream) {
pStream->Release();
} else {
pDict->Release();
}
return;
}
pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, TRUE);
if (!pImgObj) {
if (pStream) {
pStream->Release();
} else {
pDict->Release();
}
}
}
示例9: ReadNextObject
CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOOL bInArray)
{
FX_BOOL bIsNumber;
GetNextWord(bIsNumber);
if (m_WordSize == 0) {
return NULL;
}
if (bIsNumber) {
m_WordBuffer[m_WordSize] = 0;
return CPDF_Number::Create(CFX_ByteStringC(m_WordBuffer, m_WordSize));
}
int first_char = m_WordBuffer[0];
if (first_char == '/') {
return CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
if (first_char == '(') {
return CPDF_String::Create(ReadString());
}
if (first_char == '<') {
if (m_WordSize == 1) {
return CPDF_String::Create(ReadHexString(), TRUE);
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
while (1) {
GetNextWord(bIsNumber);
if (m_WordSize == 0) {
pDict->Release();
return NULL;
}
if (m_WordSize == 2 && m_WordBuffer[0] == '>') {
break;
}
if (m_WordBuffer[0] != '/') {
pDict->Release();
return NULL;
}
CFX_ByteString key = PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
CPDF_Object* pObj = ReadNextObject(TRUE);
if (pObj == NULL) {
if (pDict) {
pDict->Release();
}
return NULL;
}
if (!key.IsEmpty()) {
pDict->SetAt(key, pObj);
} else {
pObj->Release();
}
}
return pDict;
}
if (first_char == '[') {
if (!bAllowNestedArray && bInArray) {
return NULL;
}
CPDF_Array* pArray = CPDF_Array::Create();
while (1) {
CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, TRUE);
if (pObj == NULL) {
if (m_WordSize == 0 || m_WordBuffer[0] == ']') {
return pArray;
}
if (m_WordBuffer[0] == '[') {
continue;
}
} else {
pArray->Add(pObj);
}
}
}
if (m_WordSize == 4) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
return CPDF_Boolean::Create(TRUE);
}
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
return CPDF_Null::Create();
}
} else if (m_WordSize == 5) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
return CPDF_Boolean::Create(FALSE);
}
}
return NULL;
}