Export as JSON array.
More...
#include <remwharead/export/json.hpp>
Export as JSON array.
- Since
- 0.8.0
◆ ExportBase()
remwharead::Export::ExportBase::ExportBase |
|
explicit |
Export list of Database::entry.
- Parameters
-
list< Database::entry > sort_entries(list< Database::entry > entries) const
Sort entries from newest to oldest and remove duplicates.
Definition: export.cpp:28
◆ print()
void remwharead::Export::JSON::print |
( |
| ) |
const |
|
overridevirtual |
Print output to std::ostream.
Implements remwharead::Export::ExportBase.
32 Poco::JSON::Array root = Poco::JSON::Array();
34 for (
const Database::entry &entry : _entries)
36 Poco::JSON::Object json_entry = Poco::JSON::Object();
38 json_entry.set(
"uri", entry.uri);
39 json_entry.set(
"archive_uri", entry.archive_uri);
40 json_entry.set(
"datetime", timepoint_to_string(entry.datetime));
41 Poco::JSON::Array tags = Poco::JSON::Array();
42 for (
const string &tag : entry.tags)
46 json_entry.set(
"tags", tags);
47 json_entry.set(
"title", entry.title);
48 json_entry.set(
"description", entry.description);
49 json_entry.set(
"fulltext", entry.fulltext);
57 catch (std::exception &e)
59 cerr <<
"Error in " << __func__ <<
": " << e.what() << endl;
The documentation for this class was generated from the following files:
- include/export/json.hpp
- src/lib/export/json.cpp