1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 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 WTF8Chars; 32 class UTF8CharsZ; 33 34 using ValueVector = JS::GCVector<JS::Value>; 35 using IdVector = JS::GCVector<jsid>; 36 using ScriptVector = JS::GCVector<JSScript*>; 37 38 template <typename UnitT> 39 class SourceText; 40 41 class HandleValueArray; 42 43 class ObjectOpResult; 44 class PropertyResult; 45 46 enum class SymbolCode : uint32_t; 47 48 } // namespace JS 49 50 // Do the importing. 51 namespace js { 52 53 using JS::BooleanValue; 54 using JS::DoubleValue; 55 using JS::Float32Value; 56 using JS::Int32Value; 57 using JS::MagicValue; 58 using JS::NullValue; 59 using JS::NumberValue; 60 using JS::ObjectOrNullValue; 61 using JS::ObjectValue; 62 using JS::PrivateGCThingValue; 63 using JS::PrivateUint32Value; 64 using JS::PrivateValue; 65 using JS::StringValue; 66 using JS::UndefinedValue; 67 using JS::Value; 68 using JS::ValueType; 69 70 using JS::ConstTwoByteChars; 71 using JS::Latin1Char; 72 using JS::Latin1Chars; 73 using JS::Latin1CharsZ; 74 using JS::TwoByteChars; 75 using JS::TwoByteCharsZ; 76 using JS::UniqueChars; 77 using JS::UniqueTwoByteChars; 78 using JS::UTF8Chars; 79 using JS::UTF8CharsZ; 80 using JS::WTF8Chars; 81 82 using JS::Ok; 83 using JS::OOM; 84 using JS::Result; 85 86 using JS::HandleIdVector; 87 using JS::HandleObjectVector; 88 using JS::HandleValueVector; 89 using JS::MutableHandleIdVector; 90 using JS::MutableHandleObjectVector; 91 using JS::MutableHandleValueVector; 92 using JS::RootedIdVector; 93 using JS::RootedObjectVector; 94 using JS::RootedValueVector; 95 96 using JS::IdVector; 97 using JS::ScriptVector; 98 using JS::ValueVector; 99 100 using JS::GCHashMap; 101 using JS::GCHashSet; 102 using JS::GCVector; 103 104 using JS::CallArgs; 105 using JS::CallNonGenericMethod; 106 using JS::IsAcceptableThis; 107 using JS::NativeImpl; 108 109 using JS::Rooted; 110 using JS::RootedBigInt; 111 using JS::RootedFunction; 112 using JS::RootedId; 113 using JS::RootedObject; 114 using JS::RootedScript; 115 using JS::RootedString; 116 using JS::RootedSymbol; 117 using JS::RootedValue; 118 119 using JS::PersistentRooted; 120 using JS::PersistentRootedBigInt; 121 using JS::PersistentRootedFunction; 122 using JS::PersistentRootedId; 123 using JS::PersistentRootedObject; 124 using JS::PersistentRootedScript; 125 using JS::PersistentRootedString; 126 using JS::PersistentRootedSymbol; 127 using JS::PersistentRootedValue; 128 129 using JS::Handle; 130 using JS::HandleBigInt; 131 using JS::HandleFunction; 132 using JS::HandleId; 133 using JS::HandleObject; 134 using JS::HandleScript; 135 using JS::HandleString; 136 using JS::HandleSymbol; 137 using JS::HandleValue; 138 139 using JS::MutableHandle; 140 using JS::MutableHandleBigInt; 141 using JS::MutableHandleFunction; 142 using JS::MutableHandleId; 143 using JS::MutableHandleObject; 144 using JS::MutableHandleScript; 145 using JS::MutableHandleString; 146 using JS::MutableHandleSymbol; 147 using JS::MutableHandleValue; 148 149 using JS::FalseHandleValue; 150 using JS::NullHandleValue; 151 using JS::TrueHandleValue; 152 using JS::UndefinedHandleValue; 153 154 using JS::HandleValueArray; 155 156 using JS::ObjectOpResult; 157 using JS::PropertyResult; 158 159 using JS::Compartment; 160 using JS::Realm; 161 using JS::Zone; 162 163 using JS::Symbol; 164 using JS::SymbolCode; 165 166 using JS::BigInt; 167 168 } /* namespace js */ 169 170 #endif /* NamespaceImports_h */ 171