]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/lua-base4.hh
Merge pull request #11431 from jroessler-ox/docs-kskzskroll-update
[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 #include "ext/luawrapper/include/LuaContext.hpp"
8
9 class BaseLua4 : public boost::noncopyable
10 {
11 protected:
12 std::unique_ptr<LuaContext> d_lw; // this is way on top because it must get destroyed _last_
13
14 public:
15 BaseLua4();
16 void loadFile(const std::string& fname);
17 void loadString(const std::string& script);
18 void loadStream(std::istream& is);
19 virtual ~BaseLua4(); // this is so unique_ptr works with an incomplete type
20 protected:
21 void prepareContext();
22 virtual void postPrepareContext() = 0;
23 virtual void postLoad() = 0;
24 typedef vector<pair<string, int>> in_t;
25 vector<pair<string, boost::variant<int, in_t, struct timeval*>>> d_pd;
26 typedef vector<pair<string, boost::variant<string, bool, int, double>>> Features;
27 virtual void getFeatures(Features&);
28 };