BibleTime
referencemanager.h
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-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <QString>
16#include <optional>
17#include "../drivers/cswordmoduleinfo.h"
18
19
20/** Contains functions to work with references used for Drag & Drop and for hyperlinks used in our
21 * rendered HTML code.
22 */
24enum Type {
25 Unknown, /**< Unknown */
26 Bible, /**< Bibles */
27 Commentary, /**< Commentary */
28 Lexicon, /**< Lexicon */
29 GenericBook, /**< Generic Book */
30 MorphHebrew, /**< Module for hebrew morphology*/
31 MorphGreek, /**< Module for greek morphology */
32 StrongsHebrew, /**< Module for hebrew strongs */
33 StrongsGreek, /**< Module for greek strongs */
34};
35
38 CSwordModuleInfo * module;
39 QString key;
40};
41
42/** Turn a hyperlink into module, key and type.
43* Decodes the given hyperlink into module, key and type.
44* @param hyperlink The hyperlink to decode
45* @param module The string which will contain the module name after decoding
46* @param key The string which will contain the key after decoding
47* @param type The type param will contain the reference type after decoding
48*/
49std::optional<DecodedHyperlink> decodeHyperlink(QString const & hyperlink);
50
51/**
52* Returns a hyperlink used to be embedded in the display windows.
53* At the moment the format is sword://module/key
54* @param module The module to which to link.
55* @param key The key which is used to encode the hyperlink
56* @return The encoded hyperlink
57*/
58QString encodeHyperlink(CSwordModuleInfo const & module, QString const & key);
59
62 /* The following are only valid for verse-based destination modules: */
63 QString refBase;
65};
66
67/** Parses the given verse references using the given language and the module.
68* @param moduleName The name of the module to use. Required for the language checking before parsing the key.
69* @param ref The verse reference.
70* @param lang The language of the verse reference
71* @param newLang The language of the reference, which will be returned. For example: If BibleTime using an english environment parses a spanish ref (lang=es) the returned ref should be in english (newLang=en), because his english standard module only understands en.
72*/
73QString parseVerseReference(QString const & ref, ParseOptions const & options);
74
75}
QString parseVerseReference(QString const &ref, ParseOptions const &options)
QString encodeHyperlink(CSwordModuleInfo const &module, QString const &key)
std::optional< DecodedHyperlink > decodeHyperlink(QString const &hyperlink)