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 #include "js-config.h" 24 25 struct JSContext; 26 class JSFunction; 27 class JSObject; 28 class JSScript; 29 class JSString; 30 class JSAddonId; 31 32 struct jsid; 33 34 namespace JS { 35 36 typedef unsigned char Latin1Char; 37 38 class Symbol; 39 class Value; 40 template <typename T> class Handle; 41 template <typename T> class MutableHandle; 42 template <typename T> class Rooted; 43 template <typename T> class PersistentRooted; 44 45 typedef Handle<JSFunction*> HandleFunction; 46 typedef Handle<jsid> HandleId; 47 typedef Handle<JSObject*> HandleObject; 48 typedef Handle<JSScript*> HandleScript; 49 typedef Handle<JSString*> HandleString; 50 typedef Handle<JS::Symbol*> HandleSymbol; 51 typedef Handle<Value> HandleValue; 52 53 typedef MutableHandle<JSFunction*> MutableHandleFunction; 54 typedef MutableHandle<jsid> MutableHandleId; 55 typedef MutableHandle<JSObject*> MutableHandleObject; 56 typedef MutableHandle<JSScript*> MutableHandleScript; 57 typedef MutableHandle<JSString*> MutableHandleString; 58 typedef MutableHandle<JS::Symbol*> MutableHandleSymbol; 59 typedef MutableHandle<Value> MutableHandleValue; 60 61 typedef Rooted<JSObject*> RootedObject; 62 typedef Rooted<JSFunction*> RootedFunction; 63 typedef Rooted<JSScript*> RootedScript; 64 typedef Rooted<JSString*> RootedString; 65 typedef Rooted<JS::Symbol*> RootedSymbol; 66 typedef Rooted<jsid> RootedId; 67 typedef Rooted<JS::Value> RootedValue; 68 69 typedef PersistentRooted<JSFunction*> PersistentRootedFunction; 70 typedef PersistentRooted<jsid> PersistentRootedId; 71 typedef PersistentRooted<JSObject*> PersistentRootedObject; 72 typedef PersistentRooted<JSScript*> PersistentRootedScript; 73 typedef PersistentRooted<JSString*> PersistentRootedString; 74 typedef PersistentRooted<JS::Symbol*> PersistentRootedSymbol; 75 typedef PersistentRooted<Value> PersistentRootedValue; 76 77 } // namespace JS 78 79 #endif /* js_TypeDecls_h */ 80