2014-09-09 23:31:32 -04:00
|
|
|
/**
|
|
|
|
* Created by bspeice on 9/9/14.
|
|
|
|
*/
|
|
|
|
package org.bspeice.minimalbible.service.format.osisparser
|
|
|
|
|
|
|
|
import com.google.gson.Gson
|
|
|
|
import org.crosswire.jsword.passage.Verse
|
|
|
|
import java.util.ArrayList
|
|
|
|
|
2014-09-14 16:26:43 -04:00
|
|
|
//TODO: JSON Streaming parsing? http://instagram-engineering.tumblr.com/post/97147584853/json-parsing
|
2014-09-14 16:30:12 -04:00
|
|
|
class VerseContent(v: Verse) {
|
2014-11-11 10:09:47 -05:00
|
|
|
val id = v.getOrdinal()
|
|
|
|
val bookName = v.getName()
|
|
|
|
val chapter = v.getChapter()
|
|
|
|
val verseNum = v.getVerse()
|
|
|
|
val chapterTitle = ""
|
|
|
|
val paraTitle = ""
|
|
|
|
val references: MutableList<VerseReference> = ArrayList()
|
2014-09-09 23:31:32 -04:00
|
|
|
var content = ""
|
2014-11-11 10:09:47 -05:00
|
|
|
|
|
|
|
public val json: String
|
|
|
|
get() = Gson().toJson(this)
|
2014-09-09 23:31:32 -04:00
|
|
|
|
|
|
|
public fun toJson(): String {
|
|
|
|
// Lazy load Gson - not likely that we'll call this method multiple times, so
|
|
|
|
// don't have to worry about a penalty there.
|
2014-10-22 22:21:42 -04:00
|
|
|
return Gson().toJson(this)
|
2014-09-09 23:31:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public fun appendContent(content: String) {
|
|
|
|
this.content += content
|
|
|
|
}
|
|
|
|
}
|