cpp_compat = true

header = """// Copyright 2025 Adobe. All rights reserved.
// This file is licensed to you under the Apache License,
// Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
// or the MIT license (http://opensource.org/licenses/MIT),
// at your option.

// Unless required by applicable law or agreed to in writing,
// this software is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or
// implied. See the LICENSE-MIT and LICENSE-APACHE files for the
// specific language governing permissions and limitations under
// each license.

// This file is generated by cbindgen. Do not edit by hand."""

# Specify the language for the bindings
language = "C"

# End with a newline since some C compilers require it
# to avoid warnings
trailer = "\n"

include_guard = "c2pa_bindings_h"

after_includes = """

#if defined(C2PA_DYNAMIC_LOADING) && C2PA_DYNAMIC_LOADING
    #define C2PA_API
#else
    #if defined(_WIN32) || defined(_WIN64)
        #if defined(C2PA_DLL) && C2PA_DLL
            #if defined(__GNUC__) && __GNUC__
                #define C2PA_API __attribute__((dllexport))
            #else
                #define C2PA_API __declspec(dllexport)
            #endif
        #else
            #if defined(__GNUC__) && __GNUC__
                #define C2PA_API __attribute__((dllimport))
            #else
                #define C2PA_API __declspec(dllimport)
            #endif
        #endif
    #else
        #if defined(__GNUC__) && __GNUC__
            #define C2PA_API __attribute__((visibility("default")))
        #else
            #define C2PA_API
        #endif
    #endif
#endif

/* Deprecation macros: produce compiler warnings when deprecated C2PA functions are called.
 * GCC/Clang __attribute__ is checked first because it is position-flexible
 * (works after 'extern'), whereas C++ [[deprecated]] is only valid at the
 * very start of a declaration and cbindgen emits the annotation after the
 * 'extern' keyword. */
#if defined(__GNUC__) || defined(__clang__)
    #define C2PA_DEPRECATED __attribute__((deprecated))
    #define C2PA_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#elif defined(__cplusplus) && __cplusplus >= 201402L
    #define C2PA_DEPRECATED [[deprecated]]
    #define C2PA_DEPRECATED_MSG(msg) [[deprecated(msg)]]
#elif defined(_MSC_VER)
    #define C2PA_DEPRECATED __declspec(deprecated)
    #define C2PA_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
#else
    #define C2PA_DEPRECATED
    #define C2PA_DEPRECATED_MSG(msg)
#endif


"""

[fn]
prefix = "C2PA_API extern"
deprecated = "C2PA_DEPRECATED"
deprecated_with_note = "C2PA_DEPRECATED_MSG({})"

[export]
# Exclude internal functions from C API
exclude = ["cimpl_free"]
