LCOV - code coverage report
Current view: top level - toolkit/components/places - nsNavHistoryQuery.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 41 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 32 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             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : /**
       7             :  * The definitions of nsNavHistoryQuery and nsNavHistoryQueryOptions. This
       8             :  * header file should only be included from nsNavHistory.h, include that if
       9             :  * you want these classes.
      10             :  */
      11             : 
      12             : #ifndef nsNavHistoryQuery_h_
      13             : #define nsNavHistoryQuery_h_
      14             : 
      15             : // nsNavHistoryQuery
      16             : //
      17             : //    This class encapsulates the parameters for basic history queries for
      18             : //    building UI, trees, lists, etc.
      19             : 
      20             : #include "mozilla/Attributes.h"
      21             : 
      22             : #define NS_NAVHISTORYQUERY_IID \
      23             : { 0xb10185e0, 0x86eb, 0x4612, { 0x95, 0x7c, 0x09, 0x34, 0xf2, 0xb1, 0xce, 0xd7 } }
      24             : 
      25             : class nsNavHistoryQuery final : public nsINavHistoryQuery
      26             : {
      27             : public:
      28             :   nsNavHistoryQuery();
      29             :   nsNavHistoryQuery(const nsNavHistoryQuery& aOther);
      30             : 
      31             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_NAVHISTORYQUERY_IID)
      32             :   NS_DECL_ISUPPORTS
      33             :   NS_DECL_NSINAVHISTORYQUERY
      34             : 
      35           0 :   int32_t MinVisits() { return mMinVisits; }
      36           0 :   int32_t MaxVisits() { return mMaxVisits; }
      37           0 :   PRTime BeginTime() { return mBeginTime; }
      38           0 :   uint32_t BeginTimeReference() { return mBeginTimeReference; }
      39           0 :   PRTime EndTime() { return mEndTime; }
      40           0 :   uint32_t EndTimeReference() { return mEndTimeReference; }
      41           0 :   const nsString& SearchTerms() { return mSearchTerms; }
      42           0 :   bool OnlyBookmarked() { return mOnlyBookmarked; }
      43           0 :   bool DomainIsHost() { return mDomainIsHost; }
      44           0 :   const nsCString& Domain() { return mDomain; }
      45           0 :   nsIURI* Uri() { return mUri; } // NOT AddRef-ed!
      46           0 :   bool AnnotationIsNot() { return mAnnotationIsNot; }
      47           0 :   const nsCString& Annotation() { return mAnnotation; }
      48           0 :   const nsTArray<int64_t>& Folders() const { return mFolders; }
      49           0 :   const nsTArray<nsString>& Tags() const { return mTags; }
      50           0 :   nsresult SetTags(const nsTArray<nsString>& aTags)
      51             :   {
      52           0 :     if (!mTags.ReplaceElementsAt(0, mTags.Length(), aTags))
      53           0 :       return NS_ERROR_OUT_OF_MEMORY;
      54             : 
      55           0 :     return NS_OK;
      56             :   }
      57           0 :   bool TagsAreNot() { return mTagsAreNot; }
      58             : 
      59           0 :   const nsTArray<uint32_t>& Transitions() const { return mTransitions; }
      60           0 :   nsresult SetTransitions(const nsTArray<uint32_t>& aTransitions)
      61             :   {
      62           0 :     if (!mTransitions.ReplaceElementsAt(0, mTransitions.Length(),
      63             :                                         aTransitions))
      64           0 :       return NS_ERROR_OUT_OF_MEMORY;
      65             : 
      66           0 :     return NS_OK;
      67             :   }
      68             : 
      69             : private:
      70           0 :   ~nsNavHistoryQuery() {}
      71             : 
      72             : protected:
      73             : 
      74             :   int32_t mMinVisits;
      75             :   int32_t mMaxVisits;
      76             :   PRTime mBeginTime;
      77             :   uint32_t mBeginTimeReference;
      78             :   PRTime mEndTime;
      79             :   uint32_t mEndTimeReference;
      80             :   nsString mSearchTerms;
      81             :   bool mOnlyBookmarked;
      82             :   bool mDomainIsHost;
      83             :   nsCString mDomain; // Default is IsVoid, empty string is valid query
      84             :   nsCOMPtr<nsIURI> mUri;
      85             :   bool mAnnotationIsNot;
      86             :   nsCString mAnnotation;
      87             :   nsTArray<int64_t> mFolders;
      88             :   nsTArray<nsString> mTags;
      89             :   bool mTagsAreNot;
      90             :   nsTArray<uint32_t> mTransitions;
      91             : };
      92             : 
      93             : NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryQuery, NS_NAVHISTORYQUERY_IID)
      94             : 
      95             : // nsNavHistoryQueryOptions
      96             : 
      97             : #define NS_NAVHISTORYQUERYOPTIONS_IID \
      98             : {0x95f8ba3b, 0xd681, 0x4d89, {0xab, 0xd1, 0xfd, 0xae, 0xf2, 0xa3, 0xde, 0x18}}
      99             : 
     100             : class nsNavHistoryQueryOptions final : public nsINavHistoryQueryOptions
     101             : {
     102             : public:
     103           0 :   nsNavHistoryQueryOptions()
     104           0 :   : mSort(0)
     105             :   , mResultType(0)
     106             :   , mExcludeItems(false)
     107             :   , mExcludeQueries(false)
     108             :   , mExcludeReadOnlyFolders(false)
     109             :   , mExpandQueries(true)
     110             :   , mIncludeHidden(false)
     111             :   , mMaxResults(0)
     112             :   , mQueryType(nsINavHistoryQueryOptions::QUERY_TYPE_HISTORY)
     113           0 :   , mAsyncEnabled(false)
     114           0 :   { }
     115             : 
     116             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_NAVHISTORYQUERYOPTIONS_IID)
     117             : 
     118             :   NS_DECL_ISUPPORTS
     119             :   NS_DECL_NSINAVHISTORYQUERYOPTIONS
     120             : 
     121           0 :   uint16_t SortingMode() const { return mSort; }
     122           0 :   uint16_t ResultType() const { return mResultType; }
     123           0 :   bool ExcludeItems() const { return mExcludeItems; }
     124           0 :   bool ExcludeQueries() const { return mExcludeQueries; }
     125           0 :   bool ExcludeReadOnlyFolders() const { return mExcludeReadOnlyFolders; }
     126           0 :   bool ExpandQueries() const { return mExpandQueries; }
     127           0 :   bool IncludeHidden() const { return mIncludeHidden; }
     128           0 :   uint32_t MaxResults() const { return mMaxResults; }
     129           0 :   uint16_t QueryType() const { return mQueryType; }
     130           0 :   bool AsyncEnabled() const { return mAsyncEnabled; }
     131             : 
     132             :   nsresult Clone(nsNavHistoryQueryOptions **aResult);
     133             : 
     134             : private:
     135           0 :   ~nsNavHistoryQueryOptions() {}
     136             :   nsNavHistoryQueryOptions(const nsNavHistoryQueryOptions& other) {} // no copy
     137             : 
     138             :   // IF YOU ADD MORE ITEMS:
     139             :   //  * Add a new getter for C++ above if it makes sense
     140             :   //  * Add to the serialization code (see nsNavHistory::QueriesToQueryString())
     141             :   //  * Add to the deserialization code (see nsNavHistory::QueryStringToQueries)
     142             :   //  * Add to the nsNavHistoryQueryOptions::Clone() function
     143             :   //  * Add to the nsNavHistory.cpp::GetSimpleBookmarksQueryFolder function if applicable
     144             :   uint16_t mSort;
     145             :   nsCString mSortingAnnotation;
     146             :   nsCString mParentAnnotationToExclude;
     147             :   uint16_t mResultType;
     148             :   bool mExcludeItems;
     149             :   bool mExcludeQueries;
     150             :   bool mExcludeReadOnlyFolders;
     151             :   bool mExpandQueries;
     152             :   bool mIncludeHidden;
     153             :   uint32_t mMaxResults;
     154             :   uint16_t mQueryType;
     155             :   bool mAsyncEnabled;
     156             : };
     157             : 
     158             : NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryQueryOptions, NS_NAVHISTORYQUERYOPTIONS_IID)
     159             : 
     160             : #endif // nsNavHistoryQuery_h_

Generated by: LCOV version 1.13