File enum.hpp

File List > include > simplesquirrel > enum.hpp

Go to the documentation of this file.

#pragma once
#ifndef SSQ_ENUM_HEADER_H
#define SSQ_ENUM_HEADER_H

#include "class.hpp"

namespace ssq {
    class SSQ_API Enum: public Object {
    public:
        Enum();
        virtual ~Enum() = default;
        explicit Enum(const Object& other);
        explicit Enum(HSQUIRRELVM vm);
        Enum(const Enum& other);
        Enum(Enum&& other) NOEXCEPT;
        template<typename T>
        void addSlot(const char* name, const T& value) {
            sq_pushobject(vm, obj);
            sq_pushstring(vm, name, strlen(name));
            detail::push<T>(vm, value);
            sq_newslot(vm, -3, false);
            sq_pop(vm,1); // pop table
        }
        Enum& operator = (const Enum& other);
        Enum& operator = (Enum&& other) NOEXCEPT;
    };
}

#endif