BibleTime
cplaintextexportrendering.cpp
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
14 
15 #include <memory>
16 #include <QtGlobal>
17 #include "../../util/btassert.h"
18 #include "../drivers/btmodulelist.h"
19 #include "../drivers/cswordmoduleinfo.h"
20 #include "../keys/cswordkey.h"
21 
22 
23 
24 namespace Rendering {
25 
27  CSwordKey * k) const
28 {
29  Q_UNUSED(k)
30 
31  if (!m_addText)
32  return QString(i.key()).append('\n');
33 
34  auto const modules = i.modules();
35  BT_ASSERT(!modules.isEmpty());
36  std::unique_ptr<CSwordKey> const key(modules.first()->createKey());
37  auto renderedText = i.key();
38  if (modules.count() > 1)
39  for (auto const * const module : modules)
40  renderedText += QStringLiteral(" ") + module->name();
41  renderedText += QStringLiteral(":\n");
42 
43  for (auto const * const module : modules) {
44  key->setModule(module);
45  key->setKey(i.key());
46  QString entry = key->strippedText().append('\n');
47  if (modules.count() > 1)
48  entry.append('\n');
49  renderedText.append(entry);
50  }
51  return renderedText;
52 }
53 
54 QString CPlainTextExportRendering::finishText(QString const & text,
55  KeyTree const & tree) const
56 {
57  Q_UNUSED(tree)
58  return text;
59 }
60 
61 }
#define BT_ASSERT(...)
Definition: btassert.h:17
QString finishText(QString const &text, KeyTree const &tree) const override
QString renderEntry(KeyTreeItem const &item, CSwordKey *key=nullptr) const override
BtConstModuleList const & modules() const
std::list< KeyTreeItem > KeyTree