language = "C"

# An optional name to use as an include guard
# default: doesn't emit an include guard
include_guard = "ETEBASE_H"

cpp_compat = true

# An optional string of text to output between major sections of the generated
# file as a warning against manual editing
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"

# Whether to include a comment with the version of cbindgen used to generate the file
# default: false
include_version = true

after_includes = """
// +1 so we fake ceil it
#define ETEBASE_UTILS_FROM_BASE64_MAX_LEN(X) (((X) * 3U / 4U) + 1U)

// +2 so we fake ceil it + terminating null
#define ETEBASE_UTILS_TO_BASE64_MAX_LEN(X) (((X) * 4U / 3U) + 2U)

#define ETEBASE_UTILS_C_ARRAY_LEN(arr) (sizeof(arr) / sizeof((arr)[0]))
"""

# Codegen Options

# When generating a C header, the kind of declaration style to use for structs
# or enums.
#
# possible values:
# * "type": typedef struct { ... } MyType;
# * "tag": struct MyType { ... };
# * "both": typedef struct MyType { ... } MyType;
#
# default: "both"
style = "both"

[export]
prefix = "Etebase"
renaming_overrides_prefixing = true

exclude = ["CURRENT_VERSION", "SYMMETRIC_KEY_SIZE", "SYMMETRIC_NONCE_SIZE", "SYMMETRIC_TAG_SIZE"]

[export.rename]
"ETEBASE_UTILS_PRETTY_FINGERPRINT_SIZE" = "ETEBASE_UTILS_PRETTY_FINGERPRINT_SIZE"

[fn]
# An optional prefix to put before every function declaration
# default: no prefix added
# prefix = "WR_START_FUNC"

# An optional postfix to put after any function declaration
# default: no postix added
# postfix = "WR_END_FUNC"

sort_by = "None"

[struct]
# A rule to use to rename struct field names. The renaming assumes the input is
# the Rust standard snake_case, however it acccepts all the different rename_args
# inputs. This means many options here are no-ops or redundant.
#
# possible values (that actually do something):
# * "CamelCase": my_arg => myArg
# * "PascalCase": my_arg => MyArg
# * "GeckoCase": my_arg => mMyArg
# * "ScreamingSnakeCase": my_arg => MY_ARG
# * "None": apply no renaming
#
# technically possible values (that shouldn't have a purpose here):
# * "SnakeCase": apply no renaming
# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
# * "UpperCase": same as ScreamingSnakeCase in this context
# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
#
# default: "None"
rename_fields = "None"


[enum]
# A rule to use to rename enum variants, and the names of any fields those
# variants have. This should probably be split up into two separate options, but
# for now, they're the same! See the documentation for `[struct]rename_fields`
# for how this applies to fields. Renaming of the variant assumes that the input
# is the Rust standard PascalCase. In the case of QualifiedScreamingSnakeCase,
# it also assumed that the enum's name is PascalCase.
#
# possible values (that actually do something):
# * "CamelCase": MyVariant => myVariant
# * "SnakeCase": MyVariant => my_variant
# * "ScreamingSnakeCase": MyVariant => MY_VARIANT
# * "QualifiedScreamingSnakeCase": MyVariant => ENUM_NAME_MY_VARIANT
# * "LowerCase": MyVariant => myvariant
# * "UpperCase": MyVariant => MYVARIANT
# * "None": apply no renaming
#
# technically possible values (that shouldn't have a purpose for the variants):
# * "PascalCase": apply no renaming
# * "GeckoCase": apply no renaming
#
# default: "None"
rename_variants = "ScreamingSnakeCase"
prefix_with_name = true

[parse]
parse_deps = true
include = ["etebase"]
extra_bindings = ["etebase"]
