-rw-r--r-- | lib/acomponent.cc | 47 |
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 @@ +#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(); + } +} |