aboutsummaryrefslogtreecommitdiff
path: root/include/interpreter.h
blob: 21b1f362843331416d18e3082966add548526b17 (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
#ifndef NEWSBEUTER_INTERPRETER__H
#define NEWSBEUTER_INTERPRETER__H

#include <string>
#include <view.h>
#include <controller.h>
#include <configparser.h>
#if HAVE_RUBY
#	include <ruby.h>
#endif

namespace newsbeuter {

	class script_interpreter : public config_action_handler {
		public:
			script_interpreter();
			virtual ~script_interpreter();
			void load_script(const std::string& path);
			void run_function(const std::string& name);
			virtual action_handler_status handle_action(const std::string& action, const std::vector<std::string>& params);

			void set_view(view * vv);
			inline view * get_view() { return v; }

			void set_controller(controller * cc);
			inline controller * get_controller() { return c; }

		private:
			view * v;
			controller * c;
#if HAVE_RUBY
			VALUE rv;
			VALUE rc;
#endif
	};

#if HAVE_RUBY
script_interpreter * GetInterpreter();
#endif

}

#endif