digiKam
parseresults.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-09-14
7  * Description : a parse results map for token management
8  *
9  * Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_PARSE_RESULTS_H
25 #define DIGIKAM_PARSE_RESULTS_H
26 
27 // Qt includes
28 
29 #include <QPair>
30 #include <QString>
31 #include <QMultiMap>
32 
33 namespace Digikam
34 {
35 
37 {
38 public:
39 
40  typedef QPair<int, int> ResultsKey;
41  typedef QPair<QString, QString> ResultsValue;
42  typedef QMultiMap<ResultsKey, ResultsValue> ResultsMap;
43 
44 public:
45 
46  explicit ParseResults()
47  {
48  };
49 
51  {
52  };
53 
54  void addEntry(const ResultsKey& key, const ResultsValue& value);
55  void deleteEntry(const ResultsKey& key);
56 
57  QList<ResultsKey> keys() const;
59 
60  bool hasKey(const ResultsKey& key);
61 
62  QString result(const ResultsKey& key) const;
63  QString token(const ResultsKey& key) const;
64 
65  int offset(const ResultsKey& key) const;
66 
67  ResultsKey keyAtPosition(int pos) const;
68  bool hasKeyAtPosition(int pos) const;
69 
70  ResultsKey keyAtApproximatePosition(int pos) const;
71  bool hasKeyAtApproximatePosition(int pos) const;
72 
73  bool isEmpty() const;
74 
75  void append(const ParseResults &results);
76  void clear();
77 
78  QString replaceTokens(const QString& markedString) const;
79 
80  void debug() const;
81 
82 private:
83 
84  ResultsKey createInvalidKey() const;
85  bool keyIsValid(const ResultsKey& key) const;
86 
87 private:
88 
89  ResultsMap m_results;
90 };
91 
92 } // namespace Digikam
93 
94 #endif // DIGIKAM_PARSE_RESULTS_H
Definition: parseresults.h:37
QString token(const ResultsKey &key) const
Definition: parseresults.cpp:75
int offset(const ResultsKey &key) const
Definition: parseresults.cpp:86
void debug() const
Definition: parseresults.cpp:193
bool hasKeyAtPosition(int pos) const
Definition: parseresults.cpp:117
ParseResults()
Definition: parseresults.h:46
QString result(const ResultsKey &key) const
Definition: parseresults.cpp:63
void append(const ParseResults &results)
Definition: parseresults.cpp:150
QPair< int, int > ResultsKey
Definition: parseresults.h:40
QPair< QString, QString > ResultsValue
Definition: parseresults.h:41
bool isEmpty() const
Definition: parseresults.cpp:155
~ParseResults()
Definition: parseresults.h:50
void addEntry(const ResultsKey &key, const ResultsValue &value)
Definition: parseresults.cpp:38
void clear()
Definition: parseresults.cpp:145
bool hasKeyAtApproximatePosition(int pos) const
Definition: parseresults.cpp:139
void deleteEntry(const ResultsKey &key)
Definition: parseresults.cpp:43
ResultsKey keyAtPosition(int pos) const
Definition: parseresults.cpp:104
QList< ResultsValue > values() const
Definition: parseresults.cpp:58
bool hasKey(const ResultsKey &key)
Definition: parseresults.cpp:53
QList< ResultsKey > keys() const
Definition: parseresults.cpp:48
QMultiMap< ResultsKey, ResultsValue > ResultsMap
Definition: parseresults.h:42
ResultsKey keyAtApproximatePosition(int pos) const
Definition: parseresults.cpp:123
QString replaceTokens(const QString &markedString) const
Definition: parseresults.cpp:170
Definition: piwigotalker.h:48
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43