However that's for your snippets, I could speed up some things here.
That should have read "thanks" instead of "that's".
No problem, Troy. I appreciate your fast replies for questions.
It works for me, so don't stress yourself.
Manfred
Am 12.03.2009 um 16:30 schrieb Troy A. Griffitts:
Thanks Manfred,
I have your previous posts on this one in my inbox still to debug.
I really appreciated the feedback even if I don't always reply right
away. Please don't stop reminding me though.
-Troy.
Manfred Bergmann wrote:
Hi Troy.
The speed of the library is good but we're producing some overhead
for display like adding markers to the text in order to synchronize
between views and such.
The overall speed is still ok but if the user pulls more books like
1-5Mose then it can take 7 - 10 secs.
However that's for your snippets, I could speed up some things here.
Here is something interesting:
(a not existing key is used in the examples).
---------------------------
sword::VerseKey vk;
sword::ListKey lk = vk.ParseVerseList("Par.1.1", vk, true);
lk.Persist(true);
swModule->setKey(lk);
for ((*swModule) = sword::TOP; !swModule->Error(); (*swModule)++) {
// do something
...
}
--------------------------
The above crashes at (*swModule) = sword::TOP.
---------------------------
sword::VerseKey vk;
sword::ListKey lk = vk.ParseVerseList("Par.1.1", vk, true);
//lk.Persist(true);
swModule->setKey(lk);
for ((*swModule) = sword::TOP; !swModule->Error(); (*swModule)++) {
// do something
...
}
--------------------------
This doesn't crash but iteration starts at Gen 1.
Note, Persist() is commented.
--------------------------
sword::VerseKey vk;
sword::ListKey lk = vk.ParseVerseList("Par.1.1", vk, true);
for (lk = sword::TOP; !lk.Error(); lk++) {
swModule->setKey(lk);
// do something
}
--------------------------
This produces the correct output - nothing, loop is not entered.
Regards,
Manfred
Am 12.03.2009 um 13:19 schrieb Troy A. Griffitts:
Manfred,
Are you specifically asking about how to obtain the ordinal count
of a traversable SWKey?
If so, the official answer is, "you can't without counting
yourself". SWKey's which return true for isTraversible() don't
contractually offer their set count. This is fairly common with
optimized object containers who's set count is not easily derived
(think of linked lists).
Having said this, SWKey offers a bookmarking facility with long
SWKey::Index(), SWKey::Index(long).
The longs can _usually_ be used to practically bound a 'range'.
e.g.
VerseKey *parser = (VerseKey *)kjv->getKey();
ListKey keySet = parser->ParseVerseList("matt-jn", parser, true);
keySet = TOP;
long start = keySet.Index();
keySet = BOTTOM;
long end = keySet.Index();
progressBar.setStart(start);
progressBar.setEnd(end);
for (keySet = TOP; !keySet.Error(); keySet++) {
progressBar.setValue(keySet.Index());
// process text here...
}
// Having said this, a few points:
obvious fail case: "gen; rev22:21"
true ordinal count:
long i = 0; for (keySet = TOP; !keySet.Error(); keySet++) i++;
finally, processing a set of display data should really not take
humanly noticeable times on even old desktop computers (or even
reasonably recent mobile devices). We've actually, recently been
trying to optimize things on mobile devices for SwordReader and as
we continue to make improvements for these devices you should see
improvements on all platforms. Please let us know with a snippet
of code which demonstrates an iteration which takes any noticeable
time to complete.
-Troy.
Manfred Bergmann wrote:
Hi.
Another APi question:
In order to show a progress indicator to not bore the user when
the cursor ball spins and a text pull takes a little longer I
want to know how many verses need to be pulled before actually
doing it.
This can be for any reference the user enters, "gen" or "gen
1,6,9" or anything like that.
What is the fastest way to do that?
Regards,
Manfred
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page