toolkit/components/places/nsNavHistoryQuery.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial