NeBuild dev
Loading...
Searching...
No Matches
Library Configuration

Preprocessor macros for configuring library functionality. \detail Define these before including toml++ to alter the way it functions. More...

Macros

#define TOML_SHARED_LIB   0
 
#define TOML_HEADER_ONLY   1
 Sets whether the library is entirely inline. \detail Defaults to 1.
 
#define TOML_IMPLEMENTATION   1
 Enables the library's implementation when TOML_HEADER_ONLY is disabled. \detail Not defined by default. Meaningless when TOML_HEADER_ONLY is enabled.
 
#define TOML_EXPORTED_CLASS
 An 'export' annotation to add to classes. \detail Not defined by default.
 
#define TOML_EXPORTED_MEMBER_FUNCTION
 An 'export' annotation to add to non-static class member functions. \detail Not defined by default.
 
#define TOML_EXPORTED_STATIC_FUNCTION
 An 'export' annotation to add to static class member functions. \detail Not defined by default.
 
#define TOML_EXPORTED_FREE_FUNCTION
 An 'export' annotation to add to free functions. \detail Not defined by default.
 
#define TOML_ENABLE_UNRELEASED_FEATURES   0
 Enables support for unreleased TOML language features not yet part of a numbered version. \detail Defaults to 0.
 
#define TOML_ENABLE_PARSER   1
 Sets whether the parser-related parts of the library are included. \detail Defaults to 1.
 
#define TOML_ENABLE_FORMATTERS   1
 Sets whether the various formatter classes are enabled. \detail Defaults to 1.
 
#define TOML_ENABLE_SIMD   1
 
#define TOML_ENABLE_WINDOWS_COMPAT   1
 Enables the use of wide strings (wchar_t, std::wstring) in various places throughout the library when building for Windows. \detail Defaults to 1 when building for Windows, 0 otherwise. Has no effect when building for anything other than Windows.
 
#define TOML_INCLUDE_WINDOWS_H   0
 
#define TOML_HAS_CUSTOM_OPTIONAL_TYPE   0
 
#define TOML_EXCEPTIONS   0
 Sets whether the library uses exceptions to report parsing failures. \detail Defaults to 1 or 0 according to your compiler's exception mode.
 
#define TOML_CALLCONV
 Calling convention to apply to exported free/static functions. \detail Not defined by default (let the compiler decide).
 
#define TOML_UNDEF_MACROS   1
 
#define TOML_MAX_NESTED_VALUES   256
 
#define TOML_LIFETIME_HOOKS   0
 
#define TOML_ASSERT(expr)   assert(expr)
 Sets the assert function used by the library. \detail Defaults to the standard C assert().
 
#define TOML_ASSERT_ASSUME(expr)   TOML_ASSERT(expr)
 
#define TOML_ENABLE_FLOAT16   0
 Enable support for the built-in _Float16 type. \detail Defaults to 0.
 

Variables

 TOML_DISABLE_WARNINGS
 
 TOML_ENABLE_WARNINGS
 

Detailed Description

Preprocessor macros for configuring library functionality. \detail Define these before including toml++ to alter the way it functions.

Remarks
Some of these options have ABI implications; inline namespaces are used to prevent you from trying to link incompatible combinations together.

Macro Definition Documentation

◆ TOML_ASSERT

#define TOML_ASSERT (   expr)    assert(expr)

Sets the assert function used by the library. \detail Defaults to the standard C assert().

◆ TOML_ASSERT_ASSUME

#define TOML_ASSERT_ASSUME (   expr)    TOML_ASSERT(expr)

◆ TOML_CALLCONV

#define TOML_CALLCONV

Calling convention to apply to exported free/static functions. \detail Not defined by default (let the compiler decide).

◆ TOML_ENABLE_FLOAT16

#define TOML_ENABLE_FLOAT16   0

Enable support for the built-in _Float16 type. \detail Defaults to 0.

◆ TOML_ENABLE_FORMATTERS

#define TOML_ENABLE_FORMATTERS   1

Sets whether the various formatter classes are enabled. \detail Defaults to 1.

Remarks
If you don't need to re-serialize TOML data, setting TOML_ENABLE_FORMATTERS to 0 can improve compilation speed and reduce binary size.
See also
  • toml::toml_formatter
  • toml::json_formatter
  • toml::yaml_formatter

◆ TOML_ENABLE_PARSER

#define TOML_ENABLE_PARSER   1

Sets whether the parser-related parts of the library are included. \detail Defaults to 1.

Remarks
If you don't parse any TOML from files or strings, setting TOML_ENABLE_PARSER to 0 can improve compilation speed and reduce binary size.

◆ TOML_ENABLE_SIMD

#define TOML_ENABLE_SIMD   1

◆ TOML_ENABLE_UNRELEASED_FEATURES

#define TOML_ENABLE_UNRELEASED_FEATURES   0

Enables support for unreleased TOML language features not yet part of a numbered version. \detail Defaults to 0.

See also
TOML Language Support

◆ TOML_ENABLE_WINDOWS_COMPAT

#define TOML_ENABLE_WINDOWS_COMPAT   1

Enables the use of wide strings (wchar_t, std::wstring) in various places throughout the library when building for Windows. \detail Defaults to 1 when building for Windows, 0 otherwise. Has no effect when building for anything other than Windows.

Remarks
This does not change the underlying string type used to represent TOML keys and string values; that will still be std::string. This setting simply enables some narrow <=> wide string conversions when necessary at various interface boundaries.

If you're building for Windows and you have no need for Windows' "Pretends-to-be-unicode" wide strings, you can safely set this to 0.

◆ TOML_EXCEPTIONS

#define TOML_EXCEPTIONS   0

Sets whether the library uses exceptions to report parsing failures. \detail Defaults to 1 or 0 according to your compiler's exception mode.

◆ TOML_EXPORTED_CLASS

#define TOML_EXPORTED_CLASS

An 'export' annotation to add to classes. \detail Not defined by default.

Remarks
You might override this with __declspec(dllexport) if you were building the library into the public API of a DLL on Windows.

◆ TOML_EXPORTED_FREE_FUNCTION

#define TOML_EXPORTED_FREE_FUNCTION

An 'export' annotation to add to free functions. \detail Not defined by default.

Remarks
You might override this with __declspec(dllexport) if you were building the library into the public API of a DLL on Windows.

◆ TOML_EXPORTED_MEMBER_FUNCTION

#define TOML_EXPORTED_MEMBER_FUNCTION

An 'export' annotation to add to non-static class member functions. \detail Not defined by default.

Remarks
You might override this with __declspec(dllexport) if you were building the library into the public API of a DLL on Windows.

◆ TOML_EXPORTED_STATIC_FUNCTION

#define TOML_EXPORTED_STATIC_FUNCTION

An 'export' annotation to add to static class member functions. \detail Not defined by default.

Remarks
You might override this with __declspec(dllexport) if you were building the library into the public API of a DLL on Windows.

◆ TOML_HAS_CUSTOM_OPTIONAL_TYPE

#define TOML_HAS_CUSTOM_OPTIONAL_TYPE   0

◆ TOML_HEADER_ONLY

#define TOML_HEADER_ONLY   1

Sets whether the library is entirely inline. \detail Defaults to 1.

Remarks
Disabling this means that you must define TOML_IMPLEMENTATION in exactly one translation unit in your project: \cpp // global_header_that_includes_toml++.h #define TOML_HEADER_ONLY 0 #include <toml.hpp>

// some_code_file.cpp #define TOML_IMPLEMENTATION #include "global_header_that_includes_toml++.h" \ecpp

◆ TOML_IMPLEMENTATION

#define TOML_IMPLEMENTATION   1

Enables the library's implementation when TOML_HEADER_ONLY is disabled. \detail Not defined by default. Meaningless when TOML_HEADER_ONLY is enabled.

◆ TOML_INCLUDE_WINDOWS_H

#define TOML_INCLUDE_WINDOWS_H   0

◆ TOML_LIFETIME_HOOKS

#define TOML_LIFETIME_HOOKS   0

◆ TOML_MAX_NESTED_VALUES

#define TOML_MAX_NESTED_VALUES   256

◆ TOML_SHARED_LIB

#define TOML_SHARED_LIB   0

◆ TOML_UNDEF_MACROS

#define TOML_UNDEF_MACROS   1

Variable Documentation

◆ TOML_DISABLE_WARNINGS

TOML_DISABLE_WARNINGS

◆ TOML_ENABLE_WARNINGS

TOML_ENABLE_WARNINGS