Pajdeg  0.2.2
Pajdeg
Files | Macros | Typedefs | Functions
PDArray

An array construct. More...

Files

file  PDArray.h
 

Macros

#define PDArrayGetString(a, i)   PDArrayGetTypedElement(a,i,PDInstanceTypeString)
 
#define PDArrayGetArray(a, i)   PDArrayGetTypedElement(a,i,PDInstanceTypeArray)
 
#define PDArrayGetDictionary(a, i)   PDArrayGetTypedElement(a,i,PDInstanceTypeDict)
 
#define PDArrayGetReference(a, i)   PDArrayGetTypedElement(a,i,PDInstanceTypeRef)
 
#define PDArrayGetObject(a, i)   PDArrayGetTypedElement(a,i,PDInstanceTypeObj)
 
#define PDArrayGetInteger(a, i)   PDNumberGetInteger(PDArrayGetElement(a,i))
 
#define encryptable(str)   (strlen(str) > 0 && str[0] == '(' && str[strlen(str)-1] == ')')
 

Typedefs

typedef struct PDArrayPDArrayRef
 

Functions

PDArrayRef PDArrayCreateWithCapacity (PDInteger capacity)
 
PDArrayRef PDArrayCreateWithStackList (pd_stack stack)
 
PDArrayRef PDArrayCreateWithComplex (pd_stack stack)
 
void PDArrayClear (PDArrayRef array)
 
PDInteger PDArrayGetCount (PDArrayRef array)
 
void * PDArrayGetElement (PDArrayRef array, PDInteger index)
 
void * PDArrayGetTypedElement (PDArrayRef array, PDInteger index, PDInstanceType type)
 
void PDArrayAppend (PDArrayRef array, void *value)
 
void PDArrayInsertAtIndex (PDArrayRef array, PDInteger index, void *value)
 
PDInteger PDArrayGetIndex (PDArrayRef array, void *value)
 
void PDArrayDeleteAtIndex (PDArrayRef array, PDInteger index)
 
void PDArrayReplaceAtIndex (PDArrayRef array, PDInteger index, void *value)
 
char * PDArrayToString (PDArrayRef array)
 
PDInteger PDArrayPrinter (void *inst, char **buf, PDInteger offs, PDInteger *cap)
 
void PDArrayPrint (PDArrayRef array)
 
void PDArrayAttachCrypto (PDArrayRef array, pd_crypto crypto, PDInteger objectID, PDInteger genNumber)
 

Detailed Description

An array construct.

PDArrays maintain a list of objects, such as PDStrings, PDReferences, PDObjects, etc. and are able to produce a string representation compatible with the PDF specification for their corresponding content.

Typedef Documentation

typedef struct PDArray* PDArrayRef

A low-performance array implementation.

The array construct.

Function Documentation

void PDArrayAppend ( PDArrayRef  array,
void *  value 
)

Append value to the end of the array.

Parameters
arrayThe array
valueThe value
void PDArrayAttachCrypto ( PDArrayRef  array,
pd_crypto  crypto,
PDInteger  objectID,
PDInteger  genNumber 
)

Supply a crypto object to an array, and associate the array with a specific object.

Parameters
arrayThe array
cryptoThe pd_crypt object
objectIDThe object ID of the owning object
genNumberGeneration number of the owning object
void PDArrayClear ( PDArrayRef  array)

Create a copy of the given array.

Parameters
arrayThe array to copy
Returns
A new array, identical to array Clear the given array, removing all entries.
Parameters
arrayThe array
PDArrayRef PDArrayCreateWithCapacity ( PDInteger  capacity)

Create a new, empty array with the given capacity.

Parameters
capacityThe number of slots to allocate for added elements
Returns
Empty array
PDArrayRef PDArrayCreateWithComplex ( pd_stack  stack)

Converts a PDF array stack into an array.

Parameters
stackThe PDF array stack
Returns
New PDArray based on the stack representation of a PDF array
PDArrayRef PDArrayCreateWithStackList ( pd_stack  stack)

Converts a list of entries in the form of a stack into an array.

Note
This simply takes each element as is. To convert a PDF array stack representation into a PDArray, use PDArrayCreateWithComplex().
Parameters
stackThe stack
Returns
New PDArray based on the stack
void PDArrayDeleteAtIndex ( PDArrayRef  array,
PDInteger  index 
)

Delete the element at the given index.

Parameters
arrayThe array
indexThe index of the element to delete
PDInteger PDArrayGetCount ( PDArrayRef  array)

Get the number of elements in the array

Parameters
arrayThe array
Returns
Number of elements
void* PDArrayGetElement ( PDArrayRef  array,
PDInteger  index 
)

Return the element at the given index.

Parameters
arrayThe array
indexThe index of the element to retrieve
Returns
An appropriate object.
PDInteger PDArrayGetIndex ( PDArrayRef  array,
void *  value 
)

Get the index of the given value in the array, or -1 if the value was not found.

Parameters
arrayThe array
valueThe value to search for
Returns
Index, or -1 if not found
void* PDArrayGetTypedElement ( PDArrayRef  array,
PDInteger  index,
PDInstanceType  type 
)

Return the element at the given index, provided that it's of the given type. Otherwise return NULL.

Parameters
arrayThe array
indexThe index of the element to retrieve
typeThe required type
Returns
Instance of given instance type, or NULL if the instance type does not match the encountered value
void PDArrayInsertAtIndex ( PDArrayRef  array,
PDInteger  index,
void *  value 
)

Insert value at the given index in the array.

Parameters
arrayThe array
indexThe index at which to insert the value
valueThe value
void PDArrayReplaceAtIndex ( PDArrayRef  array,
PDInteger  index,
void *  value 
)

Replace the element at the given index with value.

Parameters
arrayThe array
indexThe index whose value should be overwritten
valueThe new value
char* PDArrayToString ( PDArrayRef  array)

Generate a C string formatted according to the PDF specification for this array.

Note
The returned string must be freed.
Parameters
arrayThe array
Returns
C string representation of array