]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/lua-base4.hh
Merge pull request #7909 from qvr/expungebyname-stats
[thirdparty/pdns.git] / pdns / lua-base4.hh
1 #pragma once
2 #include "namespaces.hh"
3 #include <boost/variant/variant.hpp>
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7
8 class LuaContext;
9
10 #if defined(HAVE_LUA)
11 #include "ext/luawrapper/include/LuaContext.hpp"
12 #endif
13
14 class BaseLua4 : public boost::noncopyable
15 {
16 protected:
17 #ifdef HAVE_LUA
18 std::unique_ptr<LuaContext> d_lw; // this is way on top because it must get destroyed _last_
19 #endif
20
21 public:
22 BaseLua4();
23 void loadFile(const std::string &fname);
24 void loadString(const std::string &script);
25 void loadStream(std::istream &is);
26 virtual ~BaseLua4(); // this is so unique_ptr works with an incomplete type
27 protected:
28 void prepareContext();
29 virtual void postPrepareContext() = 0;
30 virtual void postLoad() = 0;
31 typedef vector<pair<string, int> > in_t;
32 vector<pair<string, boost::variant<int, in_t, struct timeval* > > > d_pd;
33 };