From 7007fd56221cb2c19444051ad34afb758c89706b Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Thu, 5 Jul 2018 18:04:19 +0000 Subject: Create content mark APIs to get values by key. Bug: pdfium:1037 Change-Id: Ie887c0bbf3e543676adec6d8411b0b3254677d3c Reviewed-on: https://pdfium-review.googlesource.com/37170 Reviewed-by: Ryan Harrison Commit-Queue: Henrique Nakashima --- public/fpdf_edit.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) (limited to 'public') diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h index 6490c18c6a..380a0a236e 100644 --- a/public/fpdf_edit.h +++ b/public/fpdf_edit.h @@ -368,7 +368,18 @@ FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark, unsigned long index); // Experimental API. -// Get the value of an int property in a content mark. +// Get the type of the value of a property in a content mark by key. +// +// mark - handle to a content mark. +// key - string key of the property. +// +// Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of failure. +FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV +FPDFPageObjMark_GetParamValueTypeByKey(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key); + +// Experimental API. +// Get the value of a number property in a content mark as int. // FPDFPageObjMark_GetParamValueType() should have returned FPDF_OBJECT_NUMBER // for this property. // @@ -379,13 +390,29 @@ FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark, FPDF_EXPORT int FPDF_CALLCONV FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark, unsigned long index); +// Experimental API. +// Get the value of a number property in a content mark by key as int. +// FPDFPageObjMark_GetParamValueType() should have returned FPDF_OBJECT_NUMBER +// for this property. +// +// mark - handle to a content mark. +// key - string key of the property. +// out_value - pointer to variable that will receive the value. Not filled if +// false is returned. +// +// Returns TRUE if the key maps to a number value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamIntValueByKey(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + int* out_value); + // Experimental API. // Get the value of a string property in a content mark. -// |buffer| is only modified if |buflen| is longer than the length of the key. +// |buffer| is only modified if |buflen| is longer than the length of the value. // // mark - handle to a content mark. // index - index of the property. -// buffer - buffer for holding the returned key in UTF16-LE. +// buffer - buffer for holding the returned value in UTF16-LE. // buflen - length of the buffer. // // Returns the length of the value. @@ -395,6 +422,25 @@ FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark, void* buffer, unsigned long buflen); +// Experimental API. +// Get the value of a string property in a content mark by key. +// |buffer| is only modified if |buflen| is longer than the length of the value. +// +// mark - handle to a content mark. +// key - string key of the property. +// buffer - buffer for holding the returned value in UTF16-LE. +// buflen - length of the buffer. +// out_buflen - pointer to variable that will receive the length of the value. +// Not filled if false is returned. +// +// Returns TRUE if the key maps to a string value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamStringValueByKey(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + // Load an image from a JPEG image file and then set it into |image_object|. // // pages - pointer to the start of all loaded pages, may be NULL. -- cgit v1.2.3