Teach versekey to increment

This commit is contained in:
Greg Hellings
2025-06-29 12:04:03 -05:00
parent 4d60a6f73f
commit 5b7d736891
4 changed files with 13 additions and 0 deletions
+1
View File
@@ -86,6 +86,7 @@ pub mod ffi {
fn set_chapter(self: Pin<&mut VerseKey>, chapter: u8); fn set_chapter(self: Pin<&mut VerseKey>, chapter: u8);
fn set_verse(self: Pin<&mut VerseKey>, verse: u8); fn set_verse(self: Pin<&mut VerseKey>, verse: u8);
fn set_versification(self: Pin<&mut VerseKey>, versification: &String); fn set_versification(self: Pin<&mut VerseKey>, versification: &String);
fn increment(self: Pin<&mut VerseKey>);
} }
} }
+6
View File
@@ -161,6 +161,12 @@ namespace sword_rs {
} }
} }
void VerseKey::increment() {
if (ptr) {
ptr->increment();
}
}
bool VerseKey::is_valid() const { bool VerseKey::is_valid() const {
return ptr != nullptr; return ptr != nullptr;
} }
+2
View File
@@ -59,6 +59,8 @@ namespace sword_rs {
void set_verse(uint8_t verse); void set_verse(uint8_t verse);
void set_versification(const rust::String &versification); void set_versification(const rust::String &versification);
void increment();
bool is_valid() const; bool is_valid() const;
}; };
+4
View File
@@ -185,6 +185,10 @@ impl VerseKey {
pub fn set_versification(&mut self, versification: &String) { pub fn set_versification(&mut self, versification: &String) {
self.as_pin_mut().set_versification(versification) self.as_pin_mut().set_versification(versification)
} }
pub fn increment(&mut self) {
self.as_pin_mut().increment()
}
} }
impl Default for VerseKey { impl Default for VerseKey {