summaryrefslogtreecommitdiff
path: root/src/include/synext.hpp
blob: 6688c1c7951a1a047b16530ad08fb52f419077bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 */
#ifndef _SYNEXT_HPP_
#define _SYNEXT_HPP_

#include "../common.hpp"   // for mv$ and other things
#include <string>
#include <memory>

namespace AST {
    class MetaItem;
    class Path;
    class Module;
    class Struct;
}

class CDecoratorHandler
{
public:
    virtual void handle_item(AST::Module& mod, const AST::MetaItem& attr, const AST::Path& path, AST::Struct& str) const = 0;
};

#define STATIC_SYNEXT(_type, ident, _typename) \
    struct register_##_typename##_c {\
        register_##_typename##_c() {\
            Register_Synext_##_type( ident, ::std::unique_ptr<C##_type##Handler>(new _typename()) ); \
        } \
    } s_register_##_typename;

extern void Register_Synext_Decorator(::std::string name, ::std::unique_ptr<CDecoratorHandler> handler);

#endif