nx_metadata_sdk 1.0 Metadata SDK

Macros | Enumerations | Functions | Variables
ini_config_c.h File Reference
`#include <stdbool.h>`

Go to the source code of this file.

## Macros
#define | NX_INI_FLAG(DEFAULT, PARAM, DESCR) bool PARAM
#define | NX_INI_INT(DEFAULT, PARAM, DESCR) int PARAM
#define | NX_INI_STRING(DEFAULT, PARAM, DESCR) const char* PARAM
#define | NX_INI_FLOAT(DEFAULT, PARAM, DESCR) float PARAM
#define | NX_INI_DOUBLE(DEFAULT, PARAM, DESCR) double PARAM
#define | NX_KIT_C_API

## Enumerations
enum | NxIniOutput { NX_INI_OUTPUT_NONE, NX_INI_OUTPUT_STDOUT, NX_INI_OUTPUT_STDERR }

## Functions
NX_KIT_C_API bool | nx_ini_isEnabled (void)
NX_KIT_C_API void | nx_ini_setOutput (enum NxIniOutput output)
NX_KIT_C_API void | nx_ini_reload (void)
NX_KIT_C_API const char * | nx_ini_iniFile (void)
NX_KIT_C_API void | nx_ini_setIniFilesDir (const char *value)
NX_KIT_C_API const char * | nx_ini_iniFilesDir (void)
NX_KIT_C_API const char * | nx_ini_iniFilePath (void)

## Variables
struct Ini | NX_INI_STRUCT
NX_KIT_C_API struct Ini | ini

## Detailed Description

C99 wrapper for C++ module "ini_config". Only one .ini instance is supported. Can be included in both C++ and C99 source files.

If compiled into a library, define -DNX_KIT_C_API as needed for import/export directives.

In your C99 program, use .ini file as follows:

        #include "ini.h"
        ...
        int main()
        {
            nx_ini_reload();
            ...
            if (ini.myFlag)
                ...
        }

In your C99 project, add nx/kit/ini_config.cpp and the following files:

ini.h:

        #pragma once

        #define NX_INI_FILE "my_module.ini"
        #define NX_INI_STRUCT \
        { \
            NX_INI_FLAG(0, myFlag, "Description"); \
            NX_INI_INT(7, myInt, "Description"); \
            NX_INI_STRING("default value", myStr, "Description"); \
        }

        #include <ini_config_c.h>

ini.cpp:

    #include "ini.h"

    #include <ini_config_c_impl.h>