diff options
author | sgeerken <devnull@localhost> | 2012-06-27 23:08:21 +0200 |
---|---|---|
committer | sgeerken <devnull@localhost> | 2012-06-27 23:08:21 +0200 |
commit | a8b898689f534f8218d707aa4c41292903126b27 (patch) | |
tree | 23ab3bae65a384b5b0c581c8f390cd63941f92ad /test/liang.cc | |
parent | d3dd7eb3379c495cfd9a138d36e40a410188f202 (diff) |
Changed interface (but not yet implementation) of Hyphenator.
Diffstat (limited to 'test/liang.cc')
-rw-r--r-- | test/liang.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/test/liang.cc b/test/liang.cc index e6cda15d..d878420c 100644 --- a/test/liang.cc +++ b/test/liang.cc @@ -1,21 +1,23 @@ #include "../dw/fltkcore.hh" #include "../dw/hyphenator.hh" -using namespace lout::object; -using namespace lout::container::typed; - void hyphenateWord (dw::core::Platform *p, const char *word) { dw::Hyphenator *h = dw::Hyphenator::getHyphenator (p, "de"); - - Vector <String> *pieces = h->hyphenateWord (word); - for (int i = 0; i < pieces->size (); i++) { + + int numBreaks; + int *breakPos = h->hyphenateWord (word, &numBreaks); + for (int i = 0; i < numBreaks + 1; i++) { if (i != 0) putchar ('-'); - printf ("%s", pieces->get(i)->chars ()); + int start = (i == 0 ? 0 : breakPos[i - 1]); + int end = (i == numBreaks ? strlen (word) : breakPos[i]); + for (int j = start; j < end; j++) + putchar (word[j]); } putchar ('\n'); - delete pieces; + if (breakPos) + delete breakPos; } int main (int argc, char *argv[]) |