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 imports some common JS:: names into the js namespace so we can 8 // make unqualified references to them. 9 10 #ifndef NamespaceImports_h 11 #define NamespaceImports_h 12 13 // These includes are needed these for some typedefs (e.g. HandleValue) and 14 // functions (e.g. NullValue())... 15 #include "js/CallNonGenericMethod.h" 16 #include "js/GCHashTable.h" 17 #include "js/GCVector.h" 18 #include "js/TypeDecls.h" 19 #include "js/Value.h" 20 21 // ... but we do forward declarations of the structs and classes not pulled in 22 // by the headers included above. 23 namespace JS { 24 25 class Latin1Chars; 26 class Latin1CharsZ; 27 class ConstTwoByteChars; 28 class TwoByteChars; 29 class TwoByteCharsZ; 30 class UTF8Chars; 31 class UTF8CharsZ; 32 33 using AutoValueVector = AutoVector<Value>; 34 using AutoIdVector = AutoVector<jsid>; 35 using AutoObjectVector = AutoVector<JSObject*>; 36 37 using ValueVector = JS::GCVector<JS::Value>; 38 using IdVector = JS::GCVector<jsid>; 39 using ScriptVector = JS::GCVector<JSScript*>; 40 41 template <typename K, typename V> 42 class AutoHashMapRooter; 43 template <typename T> 44 class AutoHashSetRooter; 45 46 class MOZ_STACK_CLASS SourceBufferHolder; 47 48 class HandleValueArray; 49 50 class ObjectOpResult; 51 class PropertyResult; 52 53 enum class SymbolCode : uint32_t; 54 55 } // namespace JS 56 57 // Do the importing. 58 namespace js { 59 60 using JS::BooleanValue; 61 using JS::DoubleValue; 62 using JS::Float32Value; 63 using JS::Int32Value; 64 using JS::MagicValue; 65 using JS::NullValue; 66 using JS::NumberValue; 67 using JS::ObjectOrNullValue; 68 using JS::ObjectValue; 69 using JS::PrivateGCThingValue; 70 using JS::PrivateUint32Value; 71 using JS::PrivateValue; 72 using JS::StringValue; 73 using JS::UndefinedValue; 74 using JS::Value; 75 76 using JS::ConstTwoByteChars; 77 using JS::Latin1Char; 78 using JS::Latin1Chars; 79 using JS::Latin1CharsZ; 80 using JS::TwoByteChars; 81 using JS::TwoByteCharsZ; 82 using JS::UTF8Chars; 83 using JS::UTF8CharsZ; 84 using JS::UniqueChars; 85 using JS::UniqueTwoByteChars; 86 87 using JS::OOM; 88 using JS::Ok; 89 using JS::Result; 90 91 using JS::AutoIdVector; 92 using JS::AutoObjectVector; 93 using JS::AutoValueVector; 94 95 using JS::IdVector; 96 using JS::ScriptVector; 97 using JS::ValueVector; 98 99 using JS::AutoHashMapRooter; 100 using JS::AutoHashSetRooter; 101 102 using JS::GCHashMap; 103 using JS::GCHashSet; 104 using JS::GCVector; 105 106 using JS::CallArgs; 107 using JS::CallNonGenericMethod; 108 using JS::CompileOptions; 109 using JS::IsAcceptableThis; 110 using JS::NativeImpl; 111 using JS::OwningCompileOptions; 112 using JS::ReadOnlyCompileOptions; 113 using JS::SourceBufferHolder; 114 using JS::TransitiveCompileOptions; 115 116 using JS::Rooted; 117 using JS::RootedFunction; 118 using JS::RootedId; 119 using JS::RootedObject; 120 using JS::RootedScript; 121 using JS::RootedString; 122 using JS::RootedSymbol; 123 using JS::RootedValue; 124 125 using JS::PersistentRooted; 126 using JS::PersistentRootedFunction; 127 using JS::PersistentRootedId; 128 using JS::PersistentRootedObject; 129 using JS::PersistentRootedScript; 130 using JS::PersistentRootedString; 131 using JS::PersistentRootedSymbol; 132 using JS::PersistentRootedValue; 133 134 using JS::Handle; 135 using JS::HandleFunction; 136 using JS::HandleId; 137 using JS::HandleObject; 138 using JS::HandleScript; 139 using JS::HandleString; 140 using JS::HandleSymbol; 141 using JS::HandleValue; 142 143 using JS::MutableHandle; 144 using JS::MutableHandleFunction; 145 using JS::MutableHandleId; 146 using JS::MutableHandleObject; 147 using JS::MutableHandleScript; 148 using JS::MutableHandleString; 149 using JS::MutableHandleSymbol; 150 using JS::MutableHandleValue; 151 152 using JS::FalseHandleValue; 153 using JS::NullHandleValue; 154 using JS::TrueHandleValue; 155 using JS::UndefinedHandleValue; 156 157 using JS::HandleValueArray; 158 159 using JS::ObjectOpResult; 160 using JS::PropertyResult; 161 162 using JS::Zone; 163 164 using JS::Symbol; 165 using JS::SymbolCode; 166 167 } /* namespace js */ 168 169 #endif /* NamespaceImports_h */ 170