Pajdeg  0.2.2
Pajdeg
Files | Typedefs | Enumerations

A Pajdeg pipe task. More...

Files

file  PDTask.h
 

Typedefs

typedef struct PDTaskPDTaskRef
 
typedef PDTaskResult(* PDTaskFunc) (PDPipeRef pipe, PDTaskRef task, PDObjectRef object, void *info)
 

Enumerations

enum  PDFType {
  PDFTypePage = 1, PDFTypePages, PDFTypeCatalog, PDFTypeAnnot,
  PDFTypeFont, PDFTypeFontDescriptor, PDFTypeAction, _PDFTypeCount
}
 
enum  PDPropertyType {
  PDPropertyObjectId = 1, PDPropertyRootObject, PDPropertyInfoObject, PDPropertyPDFType,
  PDPropertyPage
}
 
enum  PDTaskResult { PDTaskFailure = -1, PDTaskDone = 0, PDTaskSkipRest = 1, PDTaskUnload = 2 }
 

Creating and manipulating filters



PDTaskRef PDTaskCreateFilter (PDPropertyType propertyType)
 
PDTaskRef PDTaskCreateFilterWithValue (PDPropertyType propertyType, PDInteger value)
 
PDTaskRef PDTaskCreateMutator (PDTaskFunc mutatorFunc)
 
void PDTaskAppendTask (PDTaskRef parentTask, PDTaskRef childTask)
 
void PDTaskSetInfo (PDTaskRef task, void *info)
 
PDTaskResult PDTaskExec (PDTaskRef task, PDPipeRef pipe, PDObjectRef object)
 

Convenience functions



PDTaskRef PDTaskCreateMutatorForObject (long objectID, PDTaskFunc mutatorFunc)
 
PDTaskRef PDTaskCreateMutatorForPropertyType (PDPropertyType propertyType, PDTaskFunc mutatorFunc)
 
PDTaskRef PDTaskCreateMutatorForPropertyTypeWithValue (PDPropertyType propertyType, PDInteger value, PDTaskFunc mutatorFunc)
 

Detailed Description

A Pajdeg pipe task.

Typedef Documentation

typedef PDTaskResult(* PDTaskFunc) (PDPipeRef pipe, PDTaskRef task, PDObjectRef object, void *info)

Function signature for task callbacks.

typedef struct PDTask* PDTaskRef

A task.

Enumeration Type Documentation

enum PDFType

PDF object types.

Note
If this is modified, typeHash in PDPipe.c must be updated accordingly.
Enumerator
PDFTypePage 

all page objects

PDFTypePages 

all pages objects; pages objects are dictionaries with arrays of page objects (the "Kids")

PDFTypeCatalog 

all catalog objects; normally, the Root object is the only catalog in a PDF

PDFTypeAnnot 

all annotation objects, such as links

PDFTypeFont 

font objects

PDFTypeFontDescriptor 

font descriptor objects

PDFTypeAction 

action objects; usually associated with a link annotation

_PDFTypeCount 

enum item count

Task filter property type.

Enumerator
PDPropertyObjectId 

value = object ID; only called for the live object, even if multiple copies exist

PDPropertyRootObject 

triggered when root object is encountered

PDPropertyInfoObject 

triggered when info object is encountered

PDPropertyPDFType 

triggered for each object of the given PDFType value

PDPropertyPage 

value = page number

Task result type.

Tasks are chained together. When triggered, the first task in the list of tasks for the specific state is executed. Before moving on to the next task in the list, each task has a number of options specified in the task result.

  • A task has the option of canceling the entire PDF creation process due to some serious issue, via PDTaskFailure.
  • It may also `filter' out its child tasks dynamically by returning PDTaskSkipRest for given conditions. This will stop the iterator, and any tasks remaining in the queue will be skipped.

Returning PDTaskDone means the task ended normally, and that the next task, if any, may execute. This is usually the preferred return value.

Enumerator
PDTaskFailure 

the entire pipe operation is terminated and the destination file is left unfinished

PDTaskDone 

the task ended as normal

PDTaskSkipRest 

the task ended, and requires that remaining tasks in its pipeline are skipped

PDTaskUnload 

the task ended as normal; additionally, it should never be called again

Function Documentation

void PDTaskAppendTask ( PDTaskRef  parentTask,
PDTaskRef  childTask 
)

Append a child task to a task. Child tasks are executed after their parent tasks, unless the parent decides to stop the chain. The child is appended to the end, as one would intuitively expect. Adding child A, followed by adding child B, to parent P, will result in the execution order

P -> A -> B

PDTaskRef PDTaskCreateFilter ( PDPropertyType  propertyType)

Create a filtering task. Filtering tasks find objects in a pipe based on given criteria and forward these to their child tasks.

PDTaskRef PDTaskCreateFilterWithValue ( PDPropertyType  propertyType,
PDInteger  value 
)

Create a filtering task with the given argument.

PDTaskRef PDTaskCreateMutator ( PDTaskFunc  mutatorFunc)

Create a mutator task. Mutator tasks receive objects from the pipe if their parent tasks pass them through. A mutator task can be a filter, if it uses PDTaskSkipRest to abort for objects that should be skipped.

PDTaskRef PDTaskCreateMutatorForObject ( long  objectID,
PDTaskFunc  mutatorFunc 
)

Create a mutator for the given object ID.

PDTaskRef PDTaskCreateMutatorForPropertyType ( PDPropertyType  propertyType,
PDTaskFunc  mutatorFunc 
)

Create a mutator for the given (value-less) property type.

PDTaskRef PDTaskCreateMutatorForPropertyTypeWithValue ( PDPropertyType  propertyType,
PDInteger  value,
PDTaskFunc  mutatorFunc 
)

Create a mutator for the given property type with the given value.

PDTaskResult PDTaskExec ( PDTaskRef  task,
PDPipeRef  pipe,
PDObjectRef  object 
)

Execute a task, possibly resulting in a chain of tasks executing if the task has children.

void PDTaskSetInfo ( PDTaskRef  task,
void *  info 
)

Set the info object for a task.

The info object is passed as is to the task upon execution.

Parameters
taskThe task.
infoThe info object.