From 2fe897e2cf750339a7e466aeafe64f45fb650f10 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 5 Nov 2020 15:50:11 -0500 Subject: Initial commit --- libbible.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 libbible.h (limited to 'libbible.h') diff --git a/libbible.h b/libbible.h new file mode 100644 index 0000000..d21639a --- /dev/null +++ b/libbible.h @@ -0,0 +1,98 @@ +#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; + std::string reference; + 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); + + /* + * @return Text for a passage + */ + std::vector getText(struct passage pass); + + /************************** + * Methods dealing with mods + ***************************/ + + class Status { + public: + void update(unsigned long totalBytes, unsigned long completedBytes, std::string message); + }; + + /** + * @param status Status update method is called asynchronously as download progresses + * @return A mapping from language to bible version names + */ + std::map> downloadModsAvailable(Status *status = nullptr); + + /** + * 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() + */ + void installModFromInternet(std::string language, std::string name); + + /** + * @param filename Path to the .zip compressed module to be installed + */ + void 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