mozStorageStatementParams.h (1964B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : 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 #ifndef MOZSTORAGESTATEMENTPARAMS_H 8 #define MOZSTORAGESTATEMENTPARAMS_H 9 10 #include "nsPIDOMWindow.h" 11 #include "nsWrapperCache.h" 12 13 namespace mozilla { 14 class ErrorResult; 15 16 namespace storage { 17 18 class Statement; 19 20 class StatementParams final : public nsISupports, public nsWrapperCache { 21 public: 22 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 23 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(StatementParams) 24 25 explicit StatementParams(nsPIDOMWindowInner* aWindow, Statement* aStatement); 26 27 void NamedGetter(JSContext* aCx, const nsAString& aName, bool& aFound, 28 JS::MutableHandle<JS::Value> aResult, 29 mozilla::ErrorResult& aRv); 30 31 void NamedSetter(JSContext* aCx, const nsAString& aName, 32 JS::Handle<JS::Value> aValue, mozilla::ErrorResult& aRv); 33 34 uint32_t Length() const { return mParamCount; } 35 36 void IndexedGetter(JSContext* aCx, uint32_t aIndex, bool& aFound, 37 JS::MutableHandle<JS::Value> aResult, 38 mozilla::ErrorResult& aRv); 39 40 void IndexedSetter(JSContext* aCx, uint32_t aIndex, 41 JS::Handle<JS::Value> aValue, mozilla::ErrorResult& aRv); 42 43 void GetSupportedNames(nsTArray<nsString>& aNames); 44 45 JSObject* WrapObject(JSContext* aCx, 46 JS::Handle<JSObject*> aGivenProto) override; 47 48 nsPIDOMWindowInner* GetParentObject() const { return mWindow; } 49 50 private: 51 ~StatementParams() {} 52 53 nsCOMPtr<nsPIDOMWindowInner> mWindow; 54 Statement* mStatement; 55 uint32_t mParamCount; 56 57 friend class StatementParamsHolder; 58 }; 59 60 } // namespace storage 61 } // namespace mozilla 62 63 #endif /* MOZSTORAGESTATEMENTPARAMS_H */