#ifndef SBK_EXCEPTIONWRAPPER_H
#define SBK_EXCEPTIONWRAPPER_H

// Workaround to access protected functions
#ifndef protected
#  define protected public
#endif

#include <exceptions.h>

#include <sbkpython.h>

#include <array>
namespace Shiboken { struct AutoDecRef; class GilState; }

class ExceptionWrapper : public KCalendarCore::Exception
{
public:
    ExceptionWrapper(const ::KCalendarCore::Exception::ErrorCode code, const ::QStringList & arguments = QStringList());
    ExceptionWrapper(const ExceptionWrapper &) = delete;
    ExceptionWrapper& operator=(const ExceptionWrapper &) = delete;
    ExceptionWrapper(ExceptionWrapper &&) = delete;
    ExceptionWrapper& operator=(ExceptionWrapper &&) = delete;
    ~ExceptionWrapper() override;

    ::QStringList arguments() const override;
    static ::QStringList sbk_o_arguments([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride);
    ::KCalendarCore::Exception::ErrorCode code() const override;
    static ::KCalendarCore::Exception::ErrorCode sbk_o_code([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride);
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

private:
    mutable std::array<PyObject *, 2> m_PyMethodCache = {nullptr, nullptr};
};

#endif // SBK_EXCEPTIONWRAPPER_H
