diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-01-11 00:08:41 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-01-11 00:08:41 +0100 |
commit | 1efade1a7667e4e1a34265fb3cf310faf8c80bb6 (patch) | |
tree | bd311ac3de5500daae633fbfdb585faf737607ba /include/file.h | |
parent | 825049026dd2b2e906cdb46279faa39580d931d1 (diff) |
refactored script class to have a seperate opcodes class, added file class that uses this same opcodes class
Diffstat (limited to 'include/file.h')
-rw-r--r-- | include/file.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/include/file.h b/include/file.h new file mode 100644 index 0000000..093431e --- /dev/null +++ b/include/file.h @@ -0,0 +1,76 @@ +/** + * File.h + * + * Extended script, a PHP source file name can be passed to a Php::File object + * to have it evaluated. + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2014 Copernica BV + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +class File +{ +public: + /** + * Constructor + * + * The constructor receives a filename as parameter. It uses the normal + * PHP include path resolve algorithms to find the location of the file. + * + * @param name the filename + * @param size size of the filename + */ + File(const char *name, size_t size); + + /** + * Alternative constructor with just a filename + * + * @param name the filename + */ + File(const char *name) : File(name, ::strlen(name)) {} + + /** + * Destructor + */ + virtual ~File(); + + /** + * Include the file once + * @return Php::Value + */ + Value once(); + + /** + * Execute the file + * @return Php::Value + */ + Value execute(); + +private: + /** + * The full resolved path name + * @var const char * + */ + char *_path = nullptr; + + /** + * The opcodes of this file + * @var Opcodes + */ + Opcodes *_opcodes = nullptr; + +}; + +/** + * End of namespace + */ +} + |