1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 * vim: set ts=8 sts=4 et sw=4 tw=99: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 // This file contains public type declarations that are used *frequently*. If 8 // it doesn't occur at least 10 times in Gecko, it probably shouldn't be in 9 // here. 10 // 11 // It includes only: 12 // - forward declarations of structs and classes; 13 // - typedefs; 14 // - enums (maybe). 15 // It does *not* contain any struct or class definitions. 16 17 #ifndef js_TypeDecls_h 18 #define js_TypeDecls_h 19 20 #include <stddef.h> 21 #include <stdint.h> 22 23 #pragma GCC visibility push(default) 24 25 #include "js-config.h" 26 27 typedef uint8_t jsbytecode; 28 29 class JSAtom; 30 struct JSCompartment; 31 struct JSContext; 32 class JSFunction; 33 class JSObject; 34 struct JSRuntime; 35 class JSScript; 36 class JSString; 37 class JSAddonId; 38 struct JSFreeOp; 39 40 struct jsid; 41 42 namespace JS { 43 44 typedef unsigned char Latin1Char; 45 46 class Symbol; 47 class Value; 48 class Realm; 49 struct Runtime; 50 struct Zone; 51 52 template <typename T> 53 class Handle; 54 template <typename T> 55 class MutableHandle; 56 template <typename T> 57 class Rooted; 58 template <typename T> 59 class PersistentRooted; 60 61 typedef Handle<JSFunction*> HandleFunction; 62 typedef Handle<jsid> HandleId; 63 typedef Handle<JSObject*> HandleObject; 64 typedef Handle<JSScript*> HandleScript; 65 typedef Handle<JSString*> HandleString; 66 typedef Handle<JS::Symbol*> HandleSymbol; 67 typedef Handle<Value> HandleValue; 68 69 typedef MutableHandle<JSFunction*> MutableHandleFunction; 70 typedef MutableHandle<jsid> MutableHandleId; 71 typedef MutableHandle<JSObject*> MutableHandleObject; 72 typedef MutableHandle<JSScript*> MutableHandleScript; 73 typedef MutableHandle<JSString*> MutableHandleString; 74 typedef MutableHandle<JS::Symbol*> MutableHandleSymbol; 75 typedef MutableHandle<Value> MutableHandleValue; 76 77 typedef Rooted<JSObject*> RootedObject; 78 typedef Rooted<JSFunction*> RootedFunction; 79 typedef Rooted<JSScript*> RootedScript; 80 typedef Rooted<JSString*> RootedString; 81 typedef Rooted<JS::Symbol*> RootedSymbol; 82 typedef Rooted<jsid> RootedId; 83 typedef Rooted<JS::Value> RootedValue; 84 85 typedef PersistentRooted<JSFunction*> PersistentRootedFunction; 86 typedef PersistentRooted<jsid> PersistentRootedId; 87 typedef PersistentRooted<JSObject*> PersistentRootedObject; 88 typedef PersistentRooted<JSScript*> PersistentRootedScript; 89 typedef PersistentRooted<JSString*> PersistentRootedString; 90 typedef PersistentRooted<JS::Symbol*> PersistentRootedSymbol; 91 typedef PersistentRooted<Value> PersistentRootedValue; 92 93 } // namespace JS 94 95 #pragma GCC visibility pop 96 97 #endif /* js_TypeDecls_h */ 98