]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/lua-base4.hh
Merge pull request #8223 from PowerDNS/omoerbeek-patch-1
[thirdparty/pdns.git] / pdns / lua-base4.hh
CommitLineData
f03de9dc
AT
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
8class LuaContext;
9
10#if defined(HAVE_LUA)
f03de9dc 11#include "ext/luawrapper/include/LuaContext.hpp"
f03de9dc
AT
12#endif
13
14class BaseLua4 : public boost::noncopyable
15{
16protected:
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
21public:
9694e14f
AT
22 BaseLua4();
23 void loadFile(const std::string &fname);
24 void loadString(const std::string &script);
25 void loadStream(std::istream &is);
f03de9dc
AT
26 virtual ~BaseLua4(); // this is so unique_ptr works with an incomplete type
27protected:
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};