diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2006-08-27 08:57:12 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2006-08-27 08:57:12 +0000 |
| commit | aa84fb8205229b1aaa94e5e9aa954ca6e59a8892 (patch) | |
| tree | 97cf420af8fc99659c701221baa1d0c3a6e96dad /src/dom/jsengine.h | |
| parent | Added key bindings that optimize the layout for drawing on a tablet with the ... (diff) | |
| download | inkscape-aa84fb8205229b1aaa94e5e9aa954ca6e59a8892.tar.gz inkscape-aa84fb8205229b1aaa94e5e9aa954ca6e59a8892.zip | |
New files. These will be the basis for ECMA-DOM binding using Spidermonkey.
(bzr r1642)
Diffstat (limited to 'src/dom/jsengine.h')
| -rw-r--r-- | src/dom/jsengine.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/src/dom/jsengine.h b/src/dom/jsengine.h new file mode 100644 index 000000000..1390afe7e --- /dev/null +++ b/src/dom/jsengine.h @@ -0,0 +1,126 @@ +#ifndef __JSENGINE_H__ +#define __JSENGINE_H__ +/** + * Phoebe DOM Implementation. + * + * This is a C++ approximation of the W3C DOM model, which follows + * fairly closely the specifications in the various .idl files, copies of + * which are provided for reference. Most important is this one: + * + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html + * + * Authors: + * Bob Jamison + * + * Copyright (C) 2006 Bob Jamison + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "js/jsapi.h" + + +namespace org +{ +namespace w3c +{ +namespace dom +{ + +/** + * + */ +class JavascriptEngine +{ +public: + + /** + * + */ + JavascriptEngine() + { init(); } + + /** + * + */ + JavascriptEngine(const JavascriptEngine &other) + { assign(other); } + + /** + * + */ + JavascriptEngine &operator=(const JavascriptEngine &other) + { assign(other); return *this; } + + /** + * + */ + bool startup(); + + /** + * + */ + bool shutdown(); + + /** + * + */ + virtual ~JavascriptEngine() + {} + + +private: + + void init() + { + rt = NULL; + cx = NULL; + globalObj = NULL; + } + + void assign(const JavascriptEngine &other) + { + rt = other.rt; + cx = other.cx; + globalObj = other.globalObj; + } + + /** + * + */ + bool createClasses(); + + void error(char *fmt, ...); + void trace(char *fmt, ...); + + JSRuntime *rt; + + JSContext *cx; + + JSObject *globalObj; + +}; + + + +} // namespace dom +} // namespace w3c +} // namespace org + + +#endif /* __JSENGINE_H__ */ + + |
