[sword-devel] Verse mapping patch

Ben Morgan benpmorgan at gmail.com
Thu Apr 30 20:25:00 MST 2009

This adds a (very simple) versification mapping class, and fixes a slight
problem in versekey with v11n of bounds.

API is something like this (I'm not sure I like the names, though...):

VerseMapMgr {
 static VerseMapMgr* getSystemVerseMapMgr()
 SWVerseMapper* getMapper(char* v11n_from, char* v11n_to);
 SWVerseMapper* getMapper(VerseMgr::System* v11n_from, VerseMgr::System*

SWVerseMapper {
 VerseKey* map(VerseKey* from);

The rules of this verse mapper are very simple (i.e. it doesn't do a proper
if bound set:
  l = map(lower bound)
  u = map(upper bound)
  if u is NULL: set u to the end of l's book
  if l is NULL: set l to the start of u's book
  swap u and l if u is before l (i.e. book order is different, and bounds go
across border)
  return versekey composed of u and l
if book of from key isn't in to v11n: return NULL
if chapter isn't in destination v11n:
  return last verse in book in destination v11n
if verse isn't in destination v11n:
  return last verse in chapter in destination v11n

otherwise, return the same verse, but in new v11n.

This serves two purposes:
1) it defines an API which we can use later. By making getMapper return a
more intelligent mapper, we can put proper mapping in later very easily.
2) it will do a better job than just copying the text across (because it
clips, not normalizes)

God Bless,
Multitudes, multitudes,
   in the valley of decision!
For the day of the LORD is near
   in the valley of decision.

Giôên 3:14 (ESV)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20090501/4602396d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: versemapper.patch
Type: text/x-patch
Size: 10562 bytes
Desc: not available
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20090501/4602396d/attachment-0001.bin>

More information about the sword-devel mailing list