#include "module.h" namespace sword_rs { Module::Module(sword::SWModule* module) : module(module) { } void Module::decrement() { this->module->decrement(); } rust::String Module::get_name() const { return rust::String(this->module->getName()); } rust::String Module::get_type() const { return rust::String(this->module->getType()); } VerseKey* Module::get_verse_key() const { sword::VerseKey* key = dynamic_cast(this->module->getKey()); if (key) { // Create a borrowed VerseKey on the heap - caller must delete but not the inner ptr VerseKey* result = new VerseKey{key, false}; return result; } return nullptr; } void Module::increment() { this->module->increment(); } bool Module::is_skip_consecutive_links() const { return this->module->isSkipConsecutiveLinks(); } rust::String Module::render_text() { return std::string( (const char*) this->module->renderText() ); } void Module::set_key_text(const rust::String& keyText) { this->module->setKeyText(std::string(keyText).c_str()); } void Module::set_skip_consecutive_links(bool skip) { this->module->setSkipConsecutiveLinks(skip); } rust::String Module::strip_text() { return std::string( (const char*) this->module->stripText() ); } }