lensfun: Auxiliary definitions and functions

lensfun 0.3.1.0

- Main Page
- Related Pages
- Modules
- Classes
- Files
- Examples

Macros | Typedefs | Enumerations | Functions
Auxiliary definitions and functions

These functions will help handling basic structures of the library. More...

## Macros
#define | LF_VERSION_MAJOR 0
| Major library version number.
#define | LF_VERSION_MINOR 3
| Minor library version number.
#define | LF_VERSION_MICRO 1
| Library micro version number.
#define | LF_VERSION_BUGFIX 0
| Library bugfix number.
#define | LF_VERSION ((LF_VERSION_MAJOR << 24) | (LF_VERSION_MINOR << 16) | (LF_VERSION_MICRO << 8) | LF_VERSION_BUGFIX)
| Full library version.
#define | LF_MAX_DATABASE_VERSION 1
| Latest database version supported by this release.
#define | LF_EXPORT
| This macro expands to an appropiate symbol visibility declaration.
#define | DEPRECATED
| For marking deprecated functions, see http://stackoverflow.com/a/21265197.
#define | cbool int
| C-compatible bool type; don't bother to define Yet Another Boolean Type.

## Typedefs
typedef char * | lfMLstr

## Enumerations
enum | lfError { LF_NO_ERROR = 0, LF_WRONG_FORMAT }

## Functions
void | lf_free (void *data)
const char * | lf_mlstr_get (const lfMLstr str)
| Get a string corresponding to current locale from a multi-language string. More...
lfMLstr | lf_mlstr_add (lfMLstr str, const char *lang, const char *trstr)
| Add a new translated string to a multi-language string. More...
lfMLstr | lf_mlstr_dup (const lfMLstr str)
| Create a complete copy of a multi-language string. More...

## Detailed Description

These functions will help handling basic structures of the library.

## Typedef Documentation

typedef char* lfMLstr

The storage of "multi-language" strings is simple yet flexible, handy and effective. The first (default) string comes first, terminated by \0 as usual, after that a language code follows, then \0 again, then the translated value and so on. The list terminates as soon as a \0 is encountered instead of next string, e.g. last string in list is terminated with two null characters.

## Enumeration Type Documentation

enum lfError

liblensfun error codes: negative codes are -errno, positive are here

Enumerator
LF_NO_ERROR | No error occured
LF_WRONG_FORMAT | Wrong XML data format

## Function Documentation

void lf_free | ( | void * | data | ) |

The basics of memory allocation: never free objects allocated by the library yourselves, instead use this function. It is a direct equivalent of standard C free(), however you should not use free() in the event that the library uses a separate heap.

Parameters

  data | A pointer to memory to be freed.

Examples:
  lenstool.cpp, and tfun.cpp.

lfMLstr lf_mlstr_add | ( | lfMLstr | str,
|  | const char * | lang,
|  | const char * | trstr
| ) |  |

Add a new translated string to a multi-language string.

This uses realloc() so returned value may differ from input.

Parameters

  str | The string to append to. Can be NULL.
  lang | The language for the new added string. If NULL, the default string is replaced (the first one in list, without a language designator).
  trstr | The translated string

Returns
  The reallocated multi-language string. To free a multi-language string, use lf_free().

lfMLstr lf_mlstr_dup | ( | const lfMLstr | str | ) |

Create a complete copy of a multi-language string.

Parameters

  str | The string to create a copy of

Returns
  A new allocated multi-language string

const char* lf_mlstr_get | ( | const lfMLstr | str | ) |

Get a string corresponding to current locale from a multi-language string.

Current locale is determined from LC_MESSAGES category at the time of the call, e.g. if you change LC_MESSAGES at runtime, next calls to lf_mlstr_get() will return the string for the new locale.

Examples:
  example.c, and tfun.cpp.