pdfedit-core-dev.h File Reference

#include "xpdf/GlobalParams.h"

Classes

struct  pdfedit_core_dev_init

Functions

int pdfedit_core_dev_init (int *argc=NULL, char ***argv=NULL, const struct pdfedit_core_dev_init *init=NULL) WARN_UNUSED_RESULT
bool pdfedit_core_dev_init_check () WARN_UNUSED_RESULT
void pdfedit_core_dev_destroy ()

Function Documentation

void pdfedit_core_dev_destroy (  ) 

Clean up pdfedit_core_dev environment. This function should be called in the final cleanup. Future call to pdfedit_core_dev_init is possible.

References initialized.

int pdfedit_core_dev_init ( int *  argc = NULL,
char ***  argv = NULL,
const struct pdfedit_core_dev_init init = NULL 
)

Initialization routine for pdfedit_core_dev library.

Parameters:
argc Pointer to the argv elements count (ignored if NULL).
argv Pointer to arguments array (ignoder if NULL).
init Additional init parameters (ignored if NULL).

This function must be called before any other function from pdfedit_core_dev library is called. All global wide configuration is done here (and only here).
At this moment, it contains only xpdf core initialization (globalParams and base fonts).
Function can be called with no parameters and all required values for initialization will be set to default values. Nevertheless, it is highly recommended to provide at least first two parameters for future compatibility and possible changes (without need to change also the code which uses this functionality). You can simply use &argc and &argv values given to the main function.

 int main(int argc, char ** argv)
 {
        ...
        if (pdfedit_core_dev_init(&argc, &argv))
        {
                // not able to initialize pdfedit-core-dev
                return 1;
        }

        // hadle the rest of argc, argv
        // work the rest of the code
      // final cleanup
      pdfedit_core_dev_destroy();
 }


If some of argc parameters are used by initialization code, they are removed from the array and argc value is decreased appropriatelly. It is recommended to call this function before any command line parameters are handled by application.
If either argc or argv is NULL they must be NULL both of them. Also *argv array must contain at least argc numbers of elements. Any violation of these rules are reported as error and initialization fails.
The last init parameter can be used to set configuration not covered by command line parameters. It is required only when very specific configuration is required. Please

See also:
struct pdfedit_core_dev_init.


Repeated calls (without pdfedit_core_dev_destroy) are ignored.

Returns:
0 on success, -error code otherwise.

References init_stream_filterwriters(), init_xpdf_core(), initialized, and parse_command_line().

Referenced by main().

bool pdfedit_core_dev_init_check (  ) 

Checks whether global pdfedit_core_dev_init has been called. This method is for internal purposes only and should be called by all methods which could possible deal with global wide configuration (e.g. xpdf globalParams).
If this method returns with false, caller should triger PDFedit_devException.

Returns:
true on success, false otherwise.

References initialized.

Referenced by pdfobjects::CPdf::getInstance(), and pdfobjects::CXref::init().