From 8728fc7e6e9c22a9d51bda8e5a8eaedd5a03d9e3 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 2 Nov 2019 08:13:06 +0100 Subject: [PATCH] 2019-11-02 --- docs/adoc_8hpp_source.html | 8 +- docs/annotated.html | 2 +- docs/bookmarks_8hpp_source.html | 10 +- docs/classes.html | 2 +- docs/classremwharead_1_1Database-members.html | 2 +- docs/classremwharead_1_1Database.html | 10 +- ...wharead_1_1Export_1_1AsciiDoc-members.html | 9 +- ...classremwharead_1_1Export_1_1AsciiDoc.html | 22 ++- ...haread_1_1Export_1_1Bookmarks-members.html | 9 +- ...lassremwharead_1_1Export_1_1Bookmarks.html | 22 ++- ...ssremwharead_1_1Export_1_1CSV-members.html | 9 +- docs/classremwharead_1_1Export_1_1CSV.html | 22 ++- ...aread_1_1Export_1_1ExportBase-members.html | 7 +- ...assremwharead_1_1Export_1_1ExportBase.html | 18 +- ...sremwharead_1_1Export_1_1JSON-members.html | 9 +- docs/classremwharead_1_1Export_1_1JSON.html | 22 ++- ...ssremwharead_1_1Export_1_1RSS-members.html | 9 +- docs/classremwharead_1_1Export_1_1RSS.html | 22 ++- ...emwharead_1_1Export_1_1Simple-members.html | 9 +- docs/classremwharead_1_1Export_1_1Simple.html | 22 ++- docs/classremwharead_1_1Search-members.html | 2 +- docs/classremwharead_1_1Search.html | 2 +- docs/classremwharead_1_1URI-members.html | 35 ++-- docs/classremwharead_1_1URI.html | 165 +++++++++++------- docs/csv_8hpp_source.html | 8 +- .../dir_529a3e0c72053aaa27e3266821c6a27e.html | 2 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- .../dir_a26cd56a311ed2c6b00868ab8167f874.html | 2 +- .../dir_c85d3e3c5052e9ad9ce18c6863244a25.html | 2 +- .../dir_d44c64559bbebec7f509842c48db8b23.html | 2 +- docs/export_8hpp_source.html | 8 +- docs/files.html | 2 +- docs/functions.html | 67 ++++++- docs/functions_func.html | 19 +- docs/functions_rela.html | 2 +- docs/hierarchy.html | 2 +- docs/index.html | 2 +- docs/json_8hpp_source.html | 8 +- docs/menudata.js | 14 +- docs/remwharead_8hpp_source.html | 2 +- docs/rss_8hpp_source.html | 8 +- docs/search/all_0.js | 2 +- docs/search/all_2.js | 3 +- docs/search/all_4.js | 4 +- docs/search/all_c.js | 4 +- docs/search/all_d.js | 2 +- docs/search/all_f.js | 2 +- docs/search/functions_0.js | 2 +- docs/search/functions_1.js | 2 +- docs/search/functions_2.js | 4 +- docs/search/functions_3.js | 4 +- docs/search/functions_4.js | 2 +- docs/search/functions_5.js | 2 +- docs/search/functions_6.js | 2 +- docs/search/functions_7.js | 2 +- docs/search/functions_8.js | 4 +- docs/search/functions_9.js | 11 +- docs/search/functions_a.js | 10 +- docs/search/functions_b.html | 30 ++++ docs/search/functions_b.js | 5 + docs/search/searchdata.js | 2 +- docs/search_8hpp_source.html | 4 +- docs/simple_8hpp_source.html | 8 +- docs/sqlite_8hpp_source.html | 12 +- ...mwharead_1_1Database_1_1entry-members.html | 2 +- ...structremwharead_1_1Database_1_1entry.html | 6 +- ...remwharead_1_1archive__answer-members.html | 2 +- docs/structremwharead_1_1archive__answer.html | 2 +- ...ctremwharead_1_1html__extract-members.html | 2 +- docs/structremwharead_1_1html__extract.html | 2 +- docs/time_8hpp.html | 6 +- docs/time_8hpp_source.html | 4 +- docs/types_8hpp.html | 2 +- docs/types_8hpp_source.html | 2 +- docs/uri_8hpp_source.html | 31 ++-- 75 files changed, 548 insertions(+), 237 deletions(-) create mode 100644 docs/search/functions_b.html create mode 100644 docs/search/functions_b.js diff --git a/docs/adoc_8hpp_source.html b/docs/adoc_8hpp_source.html index 6444477..3bfbbd6 100644 --- a/docs/adoc_8hpp_source.html +++ b/docs/adoc_8hpp_source.html @@ -22,7 +22,7 @@
remwharead -  0.8.4 +  0.8.5
@@ -70,9 +70,9 @@ $(function() {
adoc.hpp
-
1 /* This file is part of remwharead.
2  * Copyright © 2019 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef REMWHAREAD_EXPORT_ADOC_HPP
18 #define REMWHAREAD_EXPORT_ADOC_HPP
19 
20 #include "export.hpp"
21 #include "sqlite.hpp"
22 #include <map>
23 #include <string>
24 #include <vector>
25 
26 namespace remwharead
27 {
28 namespace Export
29 {
30 using std::string;
31 
39 class AsciiDoc : protected ExportBase
40 {
41 public:
43 
44  void print() const override;
45 
46 private:
47  using tagmap = std::map<string, list<Database::entry>>;
48  using replacemap = const std::map<const string, const string>;
49 
51  string replace(string text, const replacemap &replacements) const;
52 
54  string replace_in_tag(const string &text) const;
55 
57  string replace_in_title(const string &text) const;
58 
60  string replace_in_uri(const string &text) const;
61 
63  void print_tags(const tagmap &tags) const;
64 
66  string get_day(const Database::entry &entry) const;
67 
69  string get_time(const Database::entry &entry) const;
70 };
71 } // namespace Export
72 } // namespace remwharead
73 
74 #endif // REMWHAREAD_EXPORT_ADOC_HPP
Export as AsciiDoc document.
Definition: adoc.hpp:39
-
ExportBase(const list< Database::entry > &entries, ostream &out=cout)
Export list of Database::entry.
Definition: export.cpp:24
-
Base class for exports.
Definition: export.hpp:38
+
1 /* This file is part of remwharead.
2  * Copyright © 2019 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef REMWHAREAD_EXPORT_ADOC_HPP
18 #define REMWHAREAD_EXPORT_ADOC_HPP
19 
20 #include "export.hpp"
21 #include "sqlite.hpp"
22 #include <map>
23 #include <string>
24 #include <vector>
25 
26 namespace remwharead::Export
27 {
28 using std::string;
29 
37 class AsciiDoc : protected ExportBase
38 {
39 public:
41 
42  void print() const override;
43 
44 private:
45  using tagmap = std::map<string, list<Database::entry>>;
46  using replacemap = const std::map<const string, const string>;
47 
49  [[nodiscard]]
50  string replace(string text, const replacemap &replacements) const;
51 
53  [[nodiscard]]
54  string replace_in_tag(const string &text) const;
55 
57  [[nodiscard]]
58  string replace_in_title(const string &text) const;
59 
61  [[nodiscard]]
62  string replace_in_uri(const string &text) const;
63 
65  void print_tags(const tagmap &tags) const;
66 
68  [[nodiscard]]
69  string get_day(const Database::entry &entry) const;
70 
72  [[nodiscard]]
73  string get_time(const Database::entry &entry) const;
74 };
75 } // namespace remwharead::Export
76 
77 #endif // REMWHAREAD_EXPORT_ADOC_HPP
Export as AsciiDoc document.
Definition: adoc.hpp:37
+
ExportBase(const list< Database::entry > &entries, ostream &out=cout)
Export list of Database::entry.
Definition: export.cpp:22
+
Base class for exports.
Definition: export.hpp:36
Describes a database entry.
Definition: sqlite.hpp:55
void print() const override
Print output to std::ostream.
diff --git a/docs/annotated.html b/docs/annotated.html index 5cb1c73..1d3618b 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -22,7 +22,7 @@
remwharead -  0.8.4 +  0.8.5
diff --git a/docs/bookmarks_8hpp_source.html b/docs/bookmarks_8hpp_source.html index 8d5e1c7..1502656 100644 --- a/docs/bookmarks_8hpp_source.html +++ b/docs/bookmarks_8hpp_source.html @@ -22,7 +22,7 @@
remwharead -  0.8.4 +  0.8.5
@@ -70,10 +70,10 @@ $(function() {
bookmarks.hpp
-
1 /* This file is part of remwharead.
2  * Copyright © 2019 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef REMWHAREAD_EXPORT_BOOKMARKS_HPP
18 #define REMWHAREAD_EXPORT_BOOKMARKS_HPP
19 
20 #include "export.hpp"
21 
22 namespace remwharead
23 {
24 namespace Export
25 {
33  class Bookmarks : protected ExportBase
34  {
35  public:
37 
38  void print() const override;
39  };
40 } // namespace Export
41 } // namespace remwharead
42 
43 #endif // REMWHAREAD_EXPORT_BOOKMARKS_HPP
void print() const override
Print output to std::ostream.
Definition: bookmarks.cpp:29
-
ExportBase(const list< Database::entry > &entries, ostream &out=cout)
Export list of Database::entry.
Definition: export.cpp:24
-
Base class for exports.
Definition: export.hpp:38
-
Export as Netscape bookmark file.
Definition: bookmarks.hpp:33
+
1 /* This file is part of remwharead.
2  * Copyright © 2019 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef REMWHAREAD_EXPORT_BOOKMARKS_HPP
18 #define REMWHAREAD_EXPORT_BOOKMARKS_HPP
19 
20 #include "export.hpp"
21 
22 namespace remwharead::Export
23 {
31  class Bookmarks : protected ExportBase
32  {
33  public:
35 
36  void print() const override;
37  };
38 } // namespace remwharead::Export
39 
40 #endif // REMWHAREAD_EXPORT_BOOKMARKS_HPP
void print() const override
Print output to std::ostream.
Definition: bookmarks.cpp:29
+
ExportBase(const list< Database::entry > &entries, ostream &out=cout)
Export list of Database::entry.
Definition: export.cpp:22
+
Base class for exports.
Definition: export.hpp:36
+
Export as Netscape bookmark file.
Definition: bookmarks.hpp:31

Member Function Documentation

@@ -151,7 +151,7 @@ Public Member Functions

Returns true if connected to the database.

Since
0.6.0
-
64 {
65  return _connected;
66 }
+
62 {
63  return _connected;
64 }
@@ -182,7 +182,7 @@ Public Member Functions

Retrieve a list of Database::entry from the database.

Since
0.6.0
-
117 {
118  try
119  {
120  Database::entry entrybuf;
121  string datetime;
122  string strtags;
123  Statement select(*_session);
124 
125  // bind() copies the value.
126  select << "SELECT * FROM remwharead WHERE datetime "
127  "BETWEEN ? AND ? ORDER BY datetime DESC;",
128  bind(timepoint_to_string(start, true)),
129  bind(timepoint_to_string(end, true)),
130  into(entrybuf.uri), into(entrybuf.archive_uri), into(datetime),
131  into(strtags), into(entrybuf.title), into(entrybuf.description),
132  into(entrybuf.fulltext), range(0, 1);
133 
134  list<entry> entries;
135 
136  while(!select.done() && select.execute() != 0)
137  {
138  entrybuf.datetime = string_to_timepoint(datetime, true);
139 
140  vector<string> tags;
141  size_t pos = 0;
142  while (pos != string::npos)
143  {
144  const size_t newpos = strtags.find(',', pos);
145  const string tag = strtags.substr(pos, newpos - pos);
146  if (!tag.empty())
147  {
148  tags.push_back(tag);
149  }
150  pos = newpos;
151  if (pos != string::npos)
152  {
153  ++pos;
154  }
155  }
156  entrybuf.tags = tags;
157 
158  entries.push_back(entrybuf);
159  }
160 
161  return entries;
162  }
163  catch (std::exception &e)
164  {
165  cerr << "Error in " << __func__ << ": " << e.what() << endl;
166  }
167 
168  return {};
169 }
+
115 {
116  try
117  {
118  Database::entry entrybuf;
119  string datetime;
120  string strtags;
121  Statement select(*_session);
122 
123  // bind() copies the value.
124  select << "SELECT * FROM remwharead WHERE datetime "
125  "BETWEEN ? AND ? ORDER BY datetime DESC;",
126  bind(timepoint_to_string(start, true)),
127  bind(timepoint_to_string(end, true)),
128  into(entrybuf.uri), into(entrybuf.archive_uri), into(datetime),
129  into(strtags), into(entrybuf.title), into(entrybuf.description),
130  into(entrybuf.fulltext), range(0, 1);
131 
132  list<entry> entries;
133 
134  while(!select.done() && select.execute() != 0)
135  {
136  entrybuf.datetime = string_to_timepoint(datetime, true);
137 
138  vector<string> tags;
139  size_t pos = 0;
140  while (pos != string::npos)
141  {
142  const size_t newpos = strtags.find(',', pos);
143  const string tag = strtags.substr(pos, newpos - pos);
144  if (!tag.empty())
145  {
146  tags.push_back(tag);
147  }
148  pos = newpos;
149  if (pos != string::npos)
150  {
151  ++pos;
152  }
153  }
154  entrybuf.tags = tags;
155 
156  entries.push_back(entrybuf);
157  }
158 
159  return entries;
160  }
161  catch (std::exception &e)
162  {
163  cerr << "Error in " << __func__ << ": " << e.what() << endl;
164  }
165 
166  return {};
167 }
@@ -203,7 +203,7 @@ Public Member Functions

Store a Database::entry in the database.

Since
0.6.0
-
85 {
86  try
87  {
88  const string strdatetime = timepoint_to_string(data.datetime, true);
89  string strtags;
90  Statement insert(*_session);
91 
92  for (const string &tag : data.tags)
93  {
94  strtags += tag;
95  if (tag != *(data.tags.rbegin()))
96  {
97  strtags += ",";
98  }
99  }
100 
101  // useRef() uses the const reference.
102  insert << "INSERT INTO remwharead "
103  "VALUES(?, ?, ?, ?, ?, ?, ?);",
104  useRef(data.uri), useRef(data.archive_uri),
105  useRef(strdatetime), useRef(strtags), useRef(data.title),
106  useRef(data.description), useRef(data.fulltext);
107  insert.execute();
108  }
109  catch (std::exception &e)
110  {
111  cerr << "Error in " << __func__ << ": " << e.what() << endl;
112  }
113 }
+
83 {
84  try
85  {
86  const string strdatetime = timepoint_to_string(data.datetime, true);
87  string strtags;
88  Statement insert(*_session);
89 
90  for (const string &tag : data.tags)
91  {
92  strtags += tag;
93  if (tag != *(data.tags.rbegin()))
94  {
95  strtags += ",";
96  }
97  }
98 
99  // useRef() uses the const reference.
100  insert << "INSERT INTO remwharead "
101  "VALUES(?, ?, ?, ?, ?, ?, ?);",
102  useRef(data.uri), useRef(data.archive_uri),
103  useRef(strdatetime), useRef(strtags), useRef(data.title),
104  useRef(data.description), useRef(data.fulltext);
105  insert.execute();
106  }
107  catch (std::exception &e)
108  {
109  cerr << "Error in " << __func__ << ": " << e.what() << endl;
110  }
111 }

The documentation for this class was generated from the following files: