1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Qt search document APIs |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef _QCPIXDOCUMENT_H |
|
19 #define _QCPIXDOCUMENT_H |
|
20 |
|
21 #ifdef BUILD_DLL |
|
22 #define DLL_EXPORT Q_DECL_EXPORT |
|
23 #else |
|
24 #define DLL_EXPORT Q_DECL_IMPORT |
|
25 #endif |
|
26 |
|
27 /** |
|
28 * @file |
|
29 * @ingroup Qt Search ClientAPI |
|
30 * @brief Contains CCPixDocument APIs |
|
31 */ |
|
32 |
|
33 #include <QObject> |
|
34 |
|
35 //Forward Declaration |
|
36 class QCPixDocumentPrivate; |
|
37 class QCPixDocumentField; |
|
38 |
|
39 /** |
|
40 * @brief Represents the document returned as a result of a search query. |
|
41 * @ingroup ClientAPI |
|
42 * |
|
43 * Link against: QCPixSearchClient.lib |
|
44 */ |
|
45 class DLL_EXPORT QCPixDocument: public QObject |
|
46 { |
|
47 Q_OBJECT |
|
48 public: |
|
49 //@TODO: The following enums are copied over from S60. They need to |
|
50 // be moved to a common file so that they can be shared by s60, qt and openc. |
|
51 /** |
|
52 * TStored defines wheter the value is stored to database. |
|
53 * If value is stored to database, it can be retrieved from search result. |
|
54 */ |
|
55 enum TStored |
|
56 { |
|
57 EStoreYes = 1, |
|
58 EStoreNo = 2 |
|
59 }; |
|
60 |
|
61 /** |
|
62 * TIndexed defines how the value of the field is indexed. |
|
63 * If value is indexed, it can be searched. |
|
64 */ |
|
65 enum TIndexed |
|
66 { |
|
67 EIndexNo = 16, |
|
68 EIndexTokenized = 32, |
|
69 EIndexUnTokenized = 64 |
|
70 }; |
|
71 |
|
72 /** |
|
73 * TAggregated defines how the value of the field are exposed |
|
74 * for aggregation. Aggregated field can be found with generic searches. |
|
75 * If aggregation is not specified, all indexed field are aggeregated by |
|
76 * default. Note: that also non-indexed fields can be aggregated. |
|
77 */ |
|
78 enum TAggregated |
|
79 { |
|
80 EAggregateNo = 1<<30, |
|
81 EAggregateYes = 1<<31, |
|
82 EAggregateDefault = 0 |
|
83 }; |
|
84 /** |
|
85 * By default, field value is stored to database and it's indexed as tokenized strings. |
|
86 */ |
|
87 static const TInt KDefaultConfig = EStoreYes | EIndexTokenized | EAggregateDefault; |
|
88 |
|
89 static const TReal32 KDefaultBoost; |
|
90 |
|
91 public: |
|
92 /** |
|
93 * Constructor. |
|
94 * Creates a QCPixDocument object and return a pointer to the created object. |
|
95 * @return A pointer to the created instance of CCPixDocument. |
|
96 */ |
|
97 static QCPixDocument* newInstance(); |
|
98 |
|
99 /** |
|
100 * Destructor |
|
101 */ |
|
102 virtual ~QCPixDocument(); |
|
103 |
|
104 /** |
|
105 * Getter: Gets the document identifier. |
|
106 * @return document identifier. |
|
107 */ |
|
108 QString docId() const; |
|
109 |
|
110 /** |
|
111 * Getter: Gets the document excert. |
|
112 * @return document excerpt. |
|
113 */ |
|
114 QString excerpt() const; |
|
115 |
|
116 /** |
|
117 * Getter: Gets the document's base app class. |
|
118 * @return document's base app class. |
|
119 */ |
|
120 QString baseAppClass() const; |
|
121 |
|
122 /** |
|
123 * Getter: Gets the field at aIndex in the document. |
|
124 * @param aIndex index of the field that is to be retrieved. |
|
125 * @return QCPixDocumentField that was at aIndex. |
|
126 */ |
|
127 const QCPixDocumentField& field( const int aIndex ) const; |
|
128 |
|
129 /** |
|
130 * Getter: Gets the field count. |
|
131 * @return The number of the fields in the document. |
|
132 */ |
|
133 int fieldCount() const; |
|
134 |
|
135 /** |
|
136 * Setter: Sets the document identifier for the document. |
|
137 * @param aDocId the document identifier to be set. |
|
138 */ |
|
139 void setDocId(const QString aDocId); |
|
140 |
|
141 /** |
|
142 * Setter: Sets the excerpt for the document. |
|
143 * @param aExcerpt the excerpt to be set. |
|
144 */ |
|
145 void setExcerpt(const QString aExcerpt); |
|
146 |
|
147 /** |
|
148 * Setter: Sets the base app class for the document. |
|
149 * @param aBaseAppClass the base app class to be set. |
|
150 */ |
|
151 void setBaseAppClass(const QString aBaseAppClass); |
|
152 |
|
153 /** |
|
154 * Setter: Adds a field with aName, aValue and aConfig to the document. |
|
155 * @param aName The name of the field |
|
156 * @param aValue The value of the field |
|
157 * @param aConfig The config of the field |
|
158 * @return the QCPixDocumentField that was added to the document. |
|
159 */ |
|
160 void addField(const QString aName, const QString aValue, const int aConfig = QCPixDocument::KDefaultConfig); |
|
161 |
|
162 private: |
|
163 /** |
|
164 * Default constructor |
|
165 */ |
|
166 QCPixDocument(); |
|
167 |
|
168 private: |
|
169 QCPixDocumentPrivate* const iPvtImpl; |
|
170 Q_DECLARE_PRIVATE_D( iPvtImpl, QCPixDocument ) |
|
171 }; |
|
172 |
|
173 #endif //_QCPIXDOCUMENT_H |
|