summaryrefslogtreecommitdiffabout
path: root/lib/acomponent.cc
Unidiff
Diffstat (limited to 'lib/acomponent.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/acomponent.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/acomponent.cc b/lib/acomponent.cc
new file mode 100644
index 0000000..8dfeee4
--- a/dev/null
+++ b/lib/acomponent.cc
@@ -0,0 +1,47 @@
1#ifdef USE_PCH
2 #include "pch.h"
3#else
4 #include <cstdarg>
5 #include <fstream>
6 #include <konforka/exception.h>
7 using namespace std;
8 #include "sitecing/acomponent.h"
9#endif
10
11namespace sitecing {
12
13 acomponent::acomponent()
14 : __SCIF(NULL) {
15 }
16 acomponent::~acomponent() {
17 }
18
19 void acomponent::__set_interface(sitecing_interface* scif) {
20 sitecing_interface *o = __SCIF;
21 __SCIF = scif;
22 if(o!=scif) {
23 __on_change_interface(o);
24 __do_imports();
25 __on_imports();
26 }
27 }
28
29 void acomponent::__on_change_interface(sitecing_interface *oscif) { }
30 void acomponent::__do_imports() { }
31 void acomponent::__on_imports() { }
32
33 void acomponent::run(int _magic,...) {
34 va_list va;
35 va_start(va,_magic);
36 main(_magic,va);
37 va_end(va);
38 }
39
40
41 void acomponent::pass_file_through(const char *fn) {
42 ifstream ifs(fn,ios::in|ios::binary);
43 if(!ifs)
44 throw konforka::exception(CODEPOINT,"failed to open file");
45 (*(__SCIF->out)) << ifs.rdbuf();
46 }
47}