LCOV - code coverage report
Current view: top level - dom/indexedDB - IDBKeyRange.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 20 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef mozilla_dom_idbkeyrange_h__
       8             : #define mozilla_dom_idbkeyrange_h__
       9             : 
      10             : #include "js/RootingAPI.h"
      11             : #include "js/Value.h"
      12             : #include "mozilla/Attributes.h"
      13             : #include "mozilla/dom/IndexedDatabaseManager.h"
      14             : #include "mozilla/dom/indexedDB/Key.h"
      15             : #include "nsCOMPtr.h"
      16             : #include "nsCycleCollectionParticipant.h"
      17             : #include "nsISupports.h"
      18             : #include "nsString.h"
      19             : 
      20             : class mozIStorageStatement;
      21             : 
      22             : namespace mozilla {
      23             : 
      24             : class ErrorResult;
      25             : 
      26             : namespace dom {
      27             : 
      28             : class GlobalObject;
      29             : 
      30             : namespace indexedDB {
      31             : class SerializedKeyRange;
      32             : } // namespace indexedDB
      33             : 
      34             : class IDBKeyRange
      35             :   : public nsISupports
      36             : {
      37             : protected:
      38             :   nsCOMPtr<nsISupports> mGlobal;
      39             :   indexedDB::Key mLower;
      40             :   indexedDB::Key mUpper;
      41             :   JS::Heap<JS::Value> mCachedLowerVal;
      42             :   JS::Heap<JS::Value> mCachedUpperVal;
      43             : 
      44             :   const bool mLowerOpen : 1;
      45             :   const bool mUpperOpen : 1;
      46             :   const bool mIsOnly : 1;
      47             :   bool mHaveCachedLowerVal : 1;
      48             :   bool mHaveCachedUpperVal : 1;
      49             :   bool mRooted : 1;
      50             : 
      51             : public:
      52             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      53           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBKeyRange)
      54             : 
      55             :   // aCx is allowed to be null, but only if aVal.isUndefined().
      56             :   static nsresult
      57             :   FromJSVal(JSContext* aCx,
      58             :             JS::Handle<JS::Value> aVal,
      59             :             IDBKeyRange** aKeyRange);
      60             : 
      61             :   static already_AddRefed<IDBKeyRange>
      62             :   FromSerialized(const indexedDB::SerializedKeyRange& aKeyRange);
      63             : 
      64             :   static already_AddRefed<IDBKeyRange>
      65             :   Only(const GlobalObject& aGlobal,
      66             :        JS::Handle<JS::Value> aValue,
      67             :        ErrorResult& aRv);
      68             : 
      69             :   static already_AddRefed<IDBKeyRange>
      70             :   LowerBound(const GlobalObject& aGlobal,
      71             :              JS::Handle<JS::Value> aValue,
      72             :              bool aOpen,
      73             :              ErrorResult& aRv);
      74             : 
      75             :   static already_AddRefed<IDBKeyRange>
      76             :   UpperBound(const GlobalObject& aGlobal,
      77             :              JS::Handle<JS::Value> aValue,
      78             :              bool aOpen,
      79             :              ErrorResult& aRv);
      80             : 
      81             :   static already_AddRefed<IDBKeyRange>
      82             :   Bound(const GlobalObject& aGlobal,
      83             :         JS::Handle<JS::Value> aLower,
      84             :         JS::Handle<JS::Value> aUpper,
      85             :         bool aLowerOpen,
      86             :         bool aUpperOpen,
      87             :         ErrorResult& aRv);
      88             : 
      89             :   void
      90           0 :   AssertIsOnOwningThread() const
      91             :   {
      92           0 :     NS_ASSERT_OWNINGTHREAD(IDBKeyRange);
      93           0 :   }
      94             : 
      95             :   void
      96             :   ToSerialized(indexedDB::SerializedKeyRange& aKeyRange) const;
      97             : 
      98             :   const indexedDB::Key&
      99           0 :   Lower() const
     100             :   {
     101           0 :     return mLower;
     102             :   }
     103             : 
     104             :   indexedDB::Key&
     105           0 :   Lower()
     106             :   {
     107           0 :     return mLower;
     108             :   }
     109             : 
     110             :   const indexedDB::Key&
     111           0 :   Upper() const
     112             :   {
     113           0 :     return mIsOnly ? mLower : mUpper;
     114             :   }
     115             : 
     116             :   indexedDB::Key&
     117           0 :   Upper()
     118             :   {
     119           0 :     return mIsOnly ? mLower : mUpper;
     120             :   }
     121             : 
     122             :   bool
     123             :   Includes(JSContext* aCx,
     124             :            JS::Handle<JS::Value> aKey,
     125             :            ErrorResult& aRv) const;
     126             : 
     127             :   bool
     128           0 :   IsOnly() const
     129             :   {
     130           0 :     return mIsOnly;
     131             :   }
     132             : 
     133             :   void
     134             :   GetBindingClause(const nsACString& aKeyColumnName,
     135             :                    nsACString& _retval) const;
     136             : 
     137             :   nsresult
     138             :   BindToStatement(mozIStorageStatement* aStatement) const;
     139             : 
     140             :   void
     141             :   DropJSObjects();
     142             : 
     143             :   // WebIDL
     144             :   bool
     145             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     146             : 
     147             :   nsISupports*
     148           0 :   GetParentObject() const
     149             :   {
     150           0 :     return mGlobal;
     151             :   }
     152             : 
     153             :   void
     154             :   GetLower(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
     155             :            ErrorResult& aRv);
     156             : 
     157             :   void
     158             :   GetUpper(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
     159             :            ErrorResult& aRv);
     160             : 
     161             :   bool
     162           0 :   LowerOpen() const
     163             :   {
     164           0 :     return mLowerOpen;
     165             :   }
     166             : 
     167             :   bool
     168           0 :   UpperOpen() const
     169             :   {
     170           0 :     return mUpperOpen;
     171             :   }
     172             : 
     173             : protected:
     174             :   IDBKeyRange(nsISupports* aGlobal,
     175             :               bool aLowerOpen,
     176             :               bool aUpperOpen,
     177             :               bool aIsOnly);
     178             : 
     179             :   virtual ~IDBKeyRange();
     180             : };
     181             : 
     182             : class IDBLocaleAwareKeyRange final
     183             :   : public IDBKeyRange
     184             : {
     185             :   IDBLocaleAwareKeyRange(nsISupports* aGlobal,
     186             :                          bool aLowerOpen,
     187             :                          bool aUpperOpen,
     188             :                          bool aIsOnly);
     189             : 
     190             :   ~IDBLocaleAwareKeyRange();
     191             : 
     192             : public:
     193             :   static already_AddRefed<IDBLocaleAwareKeyRange>
     194             :   Bound(const GlobalObject& aGlobal,
     195             :         JS::Handle<JS::Value> aLower,
     196             :         JS::Handle<JS::Value> aUpper,
     197             :         bool aLowerOpen,
     198             :         bool aUpperOpen,
     199             :         ErrorResult& aRv);
     200             : 
     201             :   NS_DECL_ISUPPORTS_INHERITED
     202             : 
     203             :   // WebIDL
     204             :   bool
     205             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     206             : };
     207             : 
     208             : } // namespace dom
     209             : } // namespace mozilla
     210             : 
     211             : #endif // mozilla_dom_idbkeyrange_h__

Generated by: LCOV version 1.13