diff options
author | Your Name <you@example.com> | 2020-11-05 15:50:11 -0500 |
---|---|---|
committer | Your Name <you@example.com> | 2020-11-05 15:50:11 -0500 |
commit | 2fe897e2cf750339a7e466aeafe64f45fb650f10 (patch) | |
tree | d27bbda7c1ef5368a90704843deea014e6c810de /libbible.h | |
download | libbible-2fe897e2cf750339a7e466aeafe64f45fb650f10.tar.gz libbible-2fe897e2cf750339a7e466aeafe64f45fb650f10.tar.bz2 libbible-2fe897e2cf750339a7e466aeafe64f45fb650f10.zip |
Initial commit
Diffstat (limited to 'libbible.h')
-rw-r--r-- | libbible.h | 98 |
1 files changed, 98 insertions, 0 deletions
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 <string> +#include <vector> +#include <map> + +namespace libbible { + + struct text { + int chapter; + int verse; + std::string book; + std::string bookShort; + std::string text; + std::vector<std::string> 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<std::string, std::vector<std::string>> getModules(void); + + /* + * @return Vector of valid single full-chapter passages for a book + */ + std::vector<struct passage> getPassages(std::string modName, std::string book); + + /* + * @return Text for a passage + */ + std::vector<struct text> 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<std::string, std::vector<std::string>> 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); + +} |