From 55d58a16e2511741cc625e203205dec86144faf3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 18 Feb 2022 20:35:38 -0500 Subject: Reorganized repository layout --- src/lib/libbible.h | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/lib/libbible.h (limited to 'src/lib/libbible.h') diff --git a/src/lib/libbible.h b/src/lib/libbible.h new file mode 100644 index 0000000..f77dc8c --- /dev/null +++ b/src/lib/libbible.h @@ -0,0 +1,115 @@ +#include +#include +#include + +namespace libbible { + + struct text { + int chapter; + int verse; + std::string book; + std::string bookShort; + std::string text; + std::vector modifiers; // e.g., paragraph, line indent0, divineName, wordsOfJesus + }; + + struct passage { + std::string modName; + std::string book; + std::string bookShort; + int chapterStart; + int verseStart; + int chapterEnd; + int verseEnd; + }; + + /* + * @return Map of modName to supported books + */ + std::map> getModules(void); + + /* + * @return Vector of valid single full-chapter passages for a book + */ + std::vector getPassages(std::string modName, std::string book); + + /* + * @param modName the module to use for determining the passage + * @param reference a human-readable reference, e.g., "gen 1:26-27" + * @return the passage matching the reference + */ + passage getPassage(std::string modName, std::string reference); + + /* + * @return Text for a passage + */ + std::vector getText(struct passage pass); + + /************************** + * Methods dealing with mods + ***************************/ + + class Status { + public: + virtual void update(unsigned long totalBytes, unsigned long completedBytes, std::string message) {} + }; + + /** + * @param status Status update method is called asynchronously as download progresses + */ + void setStatusReporter(Status& status); + + /** + * @return A mapping from language to bible version names + */ + std::map> downloadModsAvailable(); + + /** + * @return A mapping from language abbreviations to full language names + */ + std::map getLanguageNames(); + + /** + * Cancel an in-progress download + */ + void terminateDownload(void); + + /** + * @param language The language of the mod to install as provided from downloadModsAvailable + * @param name The name of the bible version as provided from downloadModsAvailable + * @see downloadModsAvailable() + * @return true on success, false otherwise + */ + bool installModFromInternet(std::string language, std::string name); + + /** + * @param filename Path to the .zip compressed module to be installed + * @return true on success, false otherwise + */ + bool installModFromZip(std::string filename); + + /** + * @param modname The name of the module to be removed + */ + void uninstallMod(std::string modname); + + /****************************** + * Methods dealing with settings + *******************************/ + + /* + * From already established code, valid and useful values are: + * int fontsize: the last used size of the font + * string passage: the last looked-up passage + * string module: the last used module + */ + + void settingsWrite(std::string key, std::string value); + + std::string settingsRead(std::string key); + + void settingsWriteInt(std::string key, int value); + + int settingsReadInt(std::string key); + +} -- cgit v1.2.3