本文整理汇总了C++中HPDF_Error_GetCode函数的典型用法代码示例。如果您正苦于以下问题:C++ HPDF_Error_GetCode函数的具体用法?C++ HPDF_Error_GetCode怎么用?C++ HPDF_Error_GetCode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HPDF_Error_GetCode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HPDF_LineAnnot_SetCaption
HPDF_LineAnnot_SetCaption (HPDF_Annotation annot, HPDF_BOOL showCaption, HPDF_LineAnnotCapPosition position, HPDF_INT horzOffset, HPDF_INT vertOffset)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_Array capOffset;
HPDF_PTRACE((" HPDF_LineAnnot_SetCaption\n"));
ret += HPDF_Dict_AddBoolean ( annot, "Cap", showCaption);
ret += HPDF_Dict_AddName( annot, "CP", HPDF_LINE_ANNOT_CAP_POSITION_NAMES[(HPDF_INT)position]);
if (ret != HPDF_OK)
return HPDF_Error_GetCode ( annot->error);
capOffset = HPDF_Array_New ( annot->mmgr);
if ( !capOffset)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "CO", capOffset)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddNumber (capOffset, horzOffset);
ret += HPDF_Array_AddNumber (capOffset, vertOffset);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (capOffset->error);
return HPDF_OK;
}
示例2: HPDF_TextMarkupAnnot_SetQuadPoints
HPDF_TextMarkupAnnot_SetQuadPoints ( HPDF_Annotation annot, HPDF_Point lb, HPDF_Point rb, HPDF_Point lt, HPDF_Point rt) /* l-left, r-right, b-bottom, t-top positions */
{
HPDF_Array quadPoints;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_TextMarkupAnnot_SetQuadPoints\n"));
quadPoints = HPDF_Array_New ( annot->mmgr);
if ( !quadPoints)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "QuadPoints", quadPoints)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddReal (quadPoints, lb.x);
ret += HPDF_Array_AddReal (quadPoints, lb.y);
ret += HPDF_Array_AddReal (quadPoints, rb.x);
ret += HPDF_Array_AddReal (quadPoints, rb.y);
ret += HPDF_Array_AddReal (quadPoints, lt.x);
ret += HPDF_Array_AddReal (quadPoints, lt.y);
ret += HPDF_Array_AddReal (quadPoints, rt.x);
ret += HPDF_Array_AddReal (quadPoints, rt.y);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (quadPoints->error);
return HPDF_OK;
}
示例3: Get3DStreamType
static HPDF_STATUS Get3DStreamType (HPDF_Stream stream, const char **type)
{
HPDF_BYTE tag[4];
HPDF_UINT len;
HPDF_PTRACE ((" HPDF_U3D_Get3DStreamType\n"));
len = 4;
if (HPDF_Stream_Read (stream, tag, &len) != HPDF_OK) {
return HPDF_Error_GetCode (stream->error);
}
if (HPDF_Stream_Seek (stream, 0, HPDF_SEEK_SET) != HPDF_OK) {
return HPDF_Error_GetCode (stream->error);
}
if (HPDF_MemCmp(tag, (HPDF_BYTE *)u3d, 4/* yes, \0 is required */) == 0) {
*type = u3d;
return HPDF_OK;
}
if (HPDF_MemCmp(tag, (HPDF_BYTE *)prc, 3) == 0) {
*type = prc;
return HPDF_OK;
}
return HPDF_INVALID_U3D_DATA;
}
示例4: HPDF_FreeTextAnnot_Set3PointCalloutLine
HPDF_FreeTextAnnot_Set3PointCalloutLine ( HPDF_Annotation annot, HPDF_Point startPoint, HPDF_Point kneePoint, HPDF_Point endPoint) /* Callout line will be in default user space */
{
HPDF_Array clPoints;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_FreeTextAnnot_Set3PointCalloutLine\n"));
clPoints = HPDF_Array_New ( annot->mmgr);
if ( !clPoints)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "CL", clPoints)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddReal (clPoints, startPoint.x);
ret += HPDF_Array_AddReal (clPoints, startPoint.y);
ret += HPDF_Array_AddReal (clPoints, kneePoint.x);
ret += HPDF_Array_AddReal (clPoints, kneePoint.y);
ret += HPDF_Array_AddReal (clPoints, endPoint.x);
ret += HPDF_Array_AddReal (clPoints, endPoint.y);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (clPoints->error);
return HPDF_OK;
}
示例5: AddResource
HPDF_STATUS
AddResource (HPDF_Page page)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_Dict resource;
HPDF_Array procset;
HPDF_PTRACE((" HPDF_Page_AddResource\n"));
resource = HPDF_Dict_New (page->mmgr);
if (!resource)
return HPDF_Error_GetCode (page->error);
/* althoth ProcSet-entry is obsolete, add it to resouce for
* compatibility
*/
ret += HPDF_Dict_Add (page, "Resources", resource);
procset = HPDF_Array_New (page->mmgr);
if (!procset)
return HPDF_Error_GetCode (page->error);
ret += HPDF_Dict_Add (resource, "ProcSet", procset);
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "PDF"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "Text"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "ImageB"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "ImageC"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "ImageI"));
return ret;
}
示例6: HPDF_MarkupAnnot_SetRectDiff
HPDF_MarkupAnnot_SetRectDiff (HPDF_Annotation annot, HPDF_Rect rect) /* RD entry : this is the difference between Rect and the text annotation rectangle */
{
HPDF_Array array;
HPDF_STATUS ret = HPDF_OK;
HPDF_REAL tmp;
HPDF_PTRACE((" HPDF_MarkupAnnot_SetRectDiff\n"));
array = HPDF_Array_New ( annot->mmgr);
if ( !array)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "RD", array)) != HPDF_OK)
return ret;
if (rect.top < rect.bottom) {
tmp = rect.top;
rect.top = rect.bottom;
rect.bottom = tmp;
}
ret += HPDF_Array_AddReal (array, rect.left);
ret += HPDF_Array_AddReal (array, rect.bottom);
ret += HPDF_Array_AddReal (array, rect.right);
ret += HPDF_Array_AddReal (array, rect.top);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (array->error);
return HPDF_OK;
}
示例7: HPDF_Xref_Add
HPDF_STATUS
HPDF_Xref_Add (HPDF_Xref xref,
void *obj)
{
HPDF_XrefEntry entry;
HPDF_Obj_Header *header;
HPDF_PTRACE((" HPDF_Xref_Add\n"));
if (!obj) {
if (HPDF_Error_GetCode (xref->error) == HPDF_OK)
return HPDF_SetError (xref->error, HPDF_INVALID_OBJECT, 0);
else
return HPDF_INVALID_OBJECT;
}
header = (HPDF_Obj_Header *)obj;
if (header->obj_id & HPDF_OTYPE_DIRECT ||
header->obj_id & HPDF_OTYPE_INDIRECT)
return HPDF_SetError(xref->error, HPDF_INVALID_OBJECT, 0);
if (xref->entries->count >= HPDF_LIMIT_MAX_XREF_ELEMENT) {
HPDF_SetError(xref->error, HPDF_XREF_COUNT_ERR, 0);
goto Fail;
}
/* in the following, we have to dispose the object when an error is
* occured.
*/
entry = (HPDF_XrefEntry)HPDF_GetMem (xref->mmgr,
sizeof(HPDF_XrefEntry_Rec));
if (entry == NULL)
goto Fail;
if (HPDF_List_Add(xref->entries, entry) != HPDF_OK) {
HPDF_FreeMem (xref->mmgr, entry);
goto Fail;
}
entry->entry_typ = HPDF_IN_USE_ENTRY;
entry->byte_offset = 0;
entry->gen_no = 0;
entry->obj = obj;
header->obj_id = xref->start_offset + xref->entries->count - 1 +
HPDF_OTYPE_INDIRECT;
header->gen_no = entry->gen_no;
return HPDF_OK;
Fail:
HPDF_Obj_ForceFree(xref->mmgr, obj);
return HPDF_Error_GetCode (xref->error);
}
示例8: HPDF_EncryptDict_Prepare
HPDF_STATUS
HPDF_EncryptDict_Prepare (HPDF_EncryptDict dict,
HPDF_Dict info,
HPDF_Xref xref)
{
HPDF_STATUS ret;
HPDF_Encrypt attr = (HPDF_Encrypt)dict->attr;
HPDF_Binary user_key;
HPDF_Binary owner_key;
HPDF_PTRACE((" HPDF_EncryptDict_Prepare\n"));
HPDF_EncryptDict_CreateID (dict, info, xref);
HPDF_Encrypt_CreateOwnerKey (attr);
HPDF_Encrypt_CreateEncryptionKey (attr);
HPDF_Encrypt_CreateUserKey (attr);
owner_key = HPDF_Binary_New (dict->mmgr, attr->owner_key, HPDF_PASSWD_LEN);
if (!owner_key)
return HPDF_Error_GetCode (dict->error);
if ((ret = HPDF_Dict_Add (dict, "O", owner_key)) != HPDF_OK)
return ret;
user_key = HPDF_Binary_New (dict->mmgr, attr->user_key, HPDF_PASSWD_LEN);
if (!user_key)
return HPDF_Error_GetCode (dict->error);
if ((ret = HPDF_Dict_Add (dict, "U", user_key)) != HPDF_OK)
return ret;
ret += HPDF_Dict_AddName (dict, "Filter", "Standard");
if (attr->mode == HPDF_ENCRYPT_R2) {
ret += HPDF_Dict_AddNumber (dict, "V", 1);
ret += HPDF_Dict_AddNumber (dict, "R", 2);
} else if (attr->mode == HPDF_ENCRYPT_R3) {
ret += HPDF_Dict_AddNumber (dict, "V", 2);
ret += HPDF_Dict_AddNumber (dict, "R", 3);
ret += HPDF_Dict_AddNumber (dict, "Length", attr->key_len * 8);
}
ret += HPDF_Dict_AddNumber (dict, "P", attr->permission);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (dict->error);
return HPDF_OK;
}
示例9: HPDF_Array_Add
HPDF_STATUS
HPDF_Array_Add (HPDF_Array array,
void *obj)
{
HPDF_Obj_Header *header;
HPDF_STATUS ret;
HPDF_PTRACE((" HPDF_Array_Add\n"));
if (!obj) {
if (HPDF_Error_GetCode (array->error) == HPDF_OK)
return HPDF_SetError (array->error, HPDF_INVALID_OBJECT, 0);
else
return HPDF_INVALID_OBJECT;
}
header = (HPDF_Obj_Header *)obj;
if (header->obj_id & HPDF_OTYPE_DIRECT)
return HPDF_SetError (array->error, HPDF_INVALID_OBJECT, 0);
if (array->list->count >= HPDF_LIMIT_MAX_ARRAY) {
HPDF_PTRACE((" HPDF_Array_Add exceed limitatin of array count(%d)\n",
HPDF_LIMIT_MAX_ARRAY));
HPDF_Obj_Free (array->mmgr, obj);
return HPDF_SetError (array->error, HPDF_ARRAY_COUNT_ERR, 0);
}
if (header->obj_id & HPDF_OTYPE_INDIRECT) {
HPDF_Proxy proxy = HPDF_Proxy_New (array->mmgr, obj);
if (!proxy) {
HPDF_Obj_Free (array->mmgr, obj);
return HPDF_Error_GetCode (array->error);
}
proxy->header.obj_id |= HPDF_OTYPE_DIRECT;
obj = proxy;
} else
header->obj_id |= HPDF_OTYPE_DIRECT;
ret = HPDF_List_Add (array->list, obj);
if (ret != HPDF_OK)
HPDF_Obj_Free (array->mmgr, obj);
return ret;
}
示例10: HPDF_GetError
HPDF_GetError (HPDF_Doc pdf)
{
if (!HPDF_Doc_Validate (pdf))
return HPDF_INVALID_DOCUMENT;
return HPDF_Error_GetCode (&pdf->error);
}
示例11: Resize
static HPDF_STATUS
Resize (HPDF_List list,
HPDF_UINT count)
{
void **new_obj;
HPDF_PTRACE((" HPDF_List_Resize\n"));
if (list->count >= count) {
if (list->count == count)
return HPDF_OK;
else
return HPDF_INVALID_PARAMETER;
}
new_obj = (void **)HPDF_GetMem (list->mmgr, count * sizeof(void *));
if (!new_obj)
return HPDF_Error_GetCode (list->error);
if (list->obj)
HPDF_MemCpy ((HPDF_BYTE *)new_obj, (HPDF_BYTE *)list->obj,
list->block_siz * sizeof(void *));
list->block_siz = count;
if (list->obj)
HPDF_FreeMem (list->mmgr, list->obj);
list->obj = new_obj;
return HPDF_OK;
}
示例12: AddAnnotation
static HPDF_STATUS
AddAnnotation (HPDF_Page page,
HPDF_Annotation annot)
{
HPDF_Array array;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_Pages\n"));
/* find "Annots" entry */
array = HPDF_Dict_GetItem (page, "Annots", HPDF_OCLASS_ARRAY);
if (!array) {
array = HPDF_Array_New (page->mmgr);
if (!array)
return HPDF_Error_GetCode (page->error);
ret = HPDF_Dict_Add (page, "Annots", array);
if (ret != HPDF_OK)
return ret;
}
if ((ret = HPDF_Array_Add (array, annot)) != HPDF_OK)
return ret;
/* Add Parent to the annotation */
ret = HPDF_Dict_Add( annot, "P", page);
return ret;
}
示例13: HPDF_EXPORT
HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_Add3DView(HPDF_U3D u3d, HPDF_Dict view)
{
HPDF_Array views = NULL;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE ((" HPDF_Add3DView\n"));
if (u3d == NULL || view == NULL) {
return HPDF_INVALID_U3D_DATA;
}
views = (HPDF_Array)HPDF_Dict_GetItem (u3d, "VA", HPDF_OCLASS_ARRAY);
if (views == NULL) {
views = HPDF_Array_New (u3d->mmgr);
if (!views) {
return HPDF_Error_GetCode (u3d->error);
}
ret = HPDF_Dict_Add (u3d, "VA", views);
if (ret == HPDF_OK) {
ret = HPDF_Dict_AddNumber (u3d, "DV", 0);
} else {
HPDF_Array_Free (views);
return ret;
}
}
if (ret == HPDF_OK) {
ret = HPDF_Array_Add( views, view);
}
return ret;
}
示例14: HPDF_String_SetValue
HPDF_STATUS
HPDF_String_SetValue (HPDF_String obj,
const char *value)
{
HPDF_UINT len;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_String_SetValue\n"));
if (obj->value) {
HPDF_FreeMem (obj->mmgr, obj->value);
obj->len = 0;
}
len = HPDF_StrLen(value, HPDF_LIMIT_MAX_STRING_LEN + 1);
if (len > HPDF_LIMIT_MAX_STRING_LEN)
return HPDF_SetError (obj->error, HPDF_STRING_OUT_OF_RANGE, 0);
obj->value = HPDF_GetMem (obj->mmgr, len + 1);
if (!obj->value)
return HPDF_Error_GetCode (obj->error);
HPDF_StrCpy ((char *)obj->value, value, (char *)obj->value + len);
obj->len = len;
return ret;
}
示例15: Pages_BeforeWrite
HPDF_STATUS
Pages_BeforeWrite (HPDF_Dict obj)
{
HPDF_Array kids = (HPDF_Array )HPDF_Dict_GetItem (obj, "Kids",
HPDF_OCLASS_ARRAY);
HPDF_Number count = (HPDF_Number)HPDF_Dict_GetItem (obj, "Count",
HPDF_OCLASS_NUMBER);
HPDF_STATUS ret;
HPDF_PTRACE((" HPDF_Pages_BeforeWrite\n"));
if (!kids)
return HPDF_SetError (obj->error, HPDF_PAGES_MISSING_KIDS_ENTRY, 0);
if (count)
count->value = GetPageCount (obj);
else {
count = HPDF_Number_New (obj->mmgr, GetPageCount (obj));
if (!count)
return HPDF_Error_GetCode (obj->error);
if ((ret = HPDF_Dict_Add (obj, "Count", count)) != HPDF_OK)
return ret;
}
return HPDF_OK;
}