summaryrefslogtreecommitdiffabout
path: root/lib/acomponent.cc
blob: 8dfeee490c00d45c353686730bb435696bafd08b (plain)
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
44
45
46
47
#ifdef USE_PCH
 #include "pch.h"
#else
 #include <cstdarg>
 #include <fstream>
 #include <konforka/exception.h>
 using namespace std;
 #include "sitecing/acomponent.h"
#endif

namespace sitecing {

    acomponent::acomponent()
	: __SCIF(NULL) {
	}
    acomponent::~acomponent() {
    }
    
    void acomponent::__set_interface(sitecing_interface* scif) {
	sitecing_interface *o = __SCIF;
	__SCIF = scif;
	if(o!=scif) {
	    __on_change_interface(o);
	    __do_imports();
	    __on_imports();
	}
    }

    void acomponent::__on_change_interface(sitecing_interface *oscif) { }
    void acomponent::__do_imports() { }
    void acomponent::__on_imports() { }

    void acomponent::run(int _magic,...) {
	va_list va;
	va_start(va,_magic);
	main(_magic,va);
	va_end(va);
    }


    void acomponent::pass_file_through(const char *fn) {
	ifstream ifs(fn,ios::in|ios::binary);
	if(!ifs)
	    throw konforka::exception(CODEPOINT,"failed to open file");
	(*(__SCIF->out)) << ifs.rdbuf();
    }
}