CAPS Universe documentation  1.0.4
All you need to know to be successful
Functions
Managing some configuration information

Configuration related helper functions. More...

Functions

const char * caps_drv_setup_value_get (struct caps_drv *cdrv, const char *section, const char *key)
 
int caps_drv_setup_boolean_get (struct caps_drv *cdrv, const char *section, const char *key)
 

Detailed Description

Various INI files configure the behaviour of the framework and the specific printer driver. The functions in this section can be used from within the printer driver to retrieve these settings.

They can be used after a call to caps_drv_run()

Function Documentation

◆ caps_drv_setup_value_get()

const char * caps_drv_setup_value_get ( struct caps_drv cdrv,
const char *  section,
const char *  key 
)

Read a value of an INI file section/key pair

Parameters
[in]cdrvlibcapsdriver handle
[in]sectionThe INI file section to search for the key (can be NULL)
[in]keyThe INI file key to get its value from
Return values
stringValue of the section/key INI entry
NULLIf the section or key doesn't exist

libcapsdriver ensures the regular INI files for printer drivers are already read-in when the caps_generic_driver::printer_adaptions() callback in your driver is called.

Details about already existing sections and keys can be found in Device Description INI files. An overview about the INI files hirarchy can be found in Printing Device INI files hierarchy.

Precondition
Successful call to caps_drv_run() and no call to caps_drv_exit() yet
Can be used in the caps_generic_driver::printer_adaptions() callback

◆ caps_drv_setup_boolean_get()

int caps_drv_setup_boolean_get ( struct caps_drv cdrv,
const char *  section,
const char *  key 
)

Read a boolean value of an INI file section/key pair

Parameters
[in]cdrvlibcapsdriver handle
[in]sectionThe INI file section to search for the key (can be NULL)
[in]keyThe INI file key to get its value from
Return values
1The section/key exists and is somehow true
0The section/key does not exist or is somehow false

This is a special variant of the caps_drv_setup_value_get() function, which tests internally the boolean type of value.

A boolean section/key is true if its value is "true", "on", "yes" or "1". And it is false if its value is "false", "off", "no" or "0".

Note
The boolean section/key is also true, if its value is empty or contains an unknown keyword (according to caps_helper_boolean_check()).

libcapsdriver ensures the regular INI files for printer drivers are already read-in when the caps_generic_driver::printer_adaptions() callback in your driver is called.

Details about already existing sections and keys can be found in Device Description INI files. An overview about the INI files hirarchy can be found in Printing Device INI files hierarchy.

Note
This function is a wrapper around caps_helper_boolean_check()
Precondition
Successful call to caps_drv_run() and no call to caps_drv_exit() yet
Can be used in the caps_generic_driver::printer_adaptions() callback