// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#ifndef RCPP_gdtools_RCPPEXPORTS_H_GEN_
#define RCPP_gdtools_RCPPEXPORTS_H_GEN_

#include "gdtools_types.h"
#include <Rcpp.h>

namespace gdtools {

    using namespace Rcpp;

    namespace {
        void validateSignature(const char* sig) {
            Rcpp::Function require = Rcpp::Environment::base_env()["require"];
            require("gdtools", Rcpp::Named("quietly") = true);
            typedef int(*Ptr_validate)(const char*);
            static Ptr_validate p_validate = (Ptr_validate)
                R_GetCCallable("gdtools", "_gdtools_RcppExport_validate");
            if (!p_validate(sig)) {
                throw Rcpp::function_not_exported(
                    "C++ function with signature '" + std::string(sig) + "' not found in gdtools");
            }
        }
    }

    inline XPtrCairoContext context_create() {
        typedef SEXP(*Ptr_context_create)();
        static Ptr_context_create p_context_create = NULL;
        if (p_context_create == NULL) {
            validateSignature("XPtrCairoContext(*context_create)()");
            p_context_create = (Ptr_context_create)R_GetCCallable("gdtools", "_gdtools_context_create");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_context_create();
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<XPtrCairoContext >(rcpp_result_gen);
    }

    inline bool context_set_font(XPtrCairoContext cc, std::string fontname, double fontsize, bool bold, bool italic, std::string fontfile = "") {
        typedef SEXP(*Ptr_context_set_font)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_context_set_font p_context_set_font = NULL;
        if (p_context_set_font == NULL) {
            validateSignature("bool(*context_set_font)(XPtrCairoContext,std::string,double,bool,bool,std::string)");
            p_context_set_font = (Ptr_context_set_font)R_GetCCallable("gdtools", "_gdtools_context_set_font");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_context_set_font(Shield<SEXP>(Rcpp::wrap(cc)), Shield<SEXP>(Rcpp::wrap(fontname)), Shield<SEXP>(Rcpp::wrap(fontsize)), Shield<SEXP>(Rcpp::wrap(bold)), Shield<SEXP>(Rcpp::wrap(italic)), Shield<SEXP>(Rcpp::wrap(fontfile)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<bool >(rcpp_result_gen);
    }

    inline FontMetric context_extents(XPtrCairoContext cc, std::string x) {
        typedef SEXP(*Ptr_context_extents)(SEXP,SEXP);
        static Ptr_context_extents p_context_extents = NULL;
        if (p_context_extents == NULL) {
            validateSignature("FontMetric(*context_extents)(XPtrCairoContext,std::string)");
            p_context_extents = (Ptr_context_extents)R_GetCCallable("gdtools", "_gdtools_context_extents");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_context_extents(Shield<SEXP>(Rcpp::wrap(cc)), Shield<SEXP>(Rcpp::wrap(x)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<FontMetric >(rcpp_result_gen);
    }

}

#endif // RCPP_gdtools_RCPPEXPORTS_H_GEN_
