本文整理汇总了C++中CTokenizer::getItTop方法的典型用法代码示例。如果您正苦于以下问题:C++ CTokenizer::getItTop方法的具体用法?C++ CTokenizer::getItTop怎么用?C++ CTokenizer::getItTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTokenizer
的用法示例。
在下文中一共展示了CTokenizer::getItTop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
// Launch unit test.
EUnitTestResult test()
{ CALL
CString test;
Tuint offsets[] = { 1, 2, 3 };
CWrappedArray<Tuint> offsetarray(offsets);
CTokenizerFunctionOffsetDelimiters tf;
CTokenizer tokenizer;
CTokenizer::TIterator it;
// Prepare tokenizer with default offset tokenizer function (initialized with a single offset value (1)).
UT_ASSERT(tokenizer.setTokenizerFunction(tf));
// Perform testing.
test = STR("1234567890");
UT_ASSERT(tokenizer.setInputContainer(test));
it = tokenizer.getItTop();
UT_ASSERT_EQUAL(*it, CString(STR("1")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("2")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("3")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("4")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("5")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("6")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("7")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("8")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("9")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("0")));
UT_ASSERT_EQUAL(it.stepForward(), 0);
// Prepare tokenizer with offset tokenizer function which wraps offsets and returns last partially parser token.
UT_ASSERT(tf.set(offsetarray.getItFirst(), true, true));
UT_ASSERT(tokenizer.setTokenizerFunction(tf));
// Perform testing.
test = STR("1234567890ABCDEF");
UT_ASSERT(tokenizer.setInputContainer(test));
it = tokenizer.getItTop();
UT_ASSERT_EQUAL(*it, CString(STR("1")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("23")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("456")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("7")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("89")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("0AB")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("C")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("DE")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("F")));
UT_ASSERT_EQUAL(it.stepForward(), 0);
// Prepare tokenizer with offset tokenizer function which wraps offsets but does not return last partially parser token.
UT_ASSERT(tf.set(offsetarray.getItFirst(), true, false));
UT_ASSERT(tokenizer.setTokenizerFunction(tf));
// Perform testing.
test = STR("1234567890ABCDEF");
UT_ASSERT(tokenizer.setInputContainer(test));
it = tokenizer.getItTop();
UT_ASSERT_EQUAL(*it, CString(STR("1")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("23")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("456")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("7")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("89")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("0AB")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("C")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("DE")));
UT_ASSERT_EQUAL(it.stepForward(), 0);
// Prepare tokenizer with offset tokenizer function which does not wrap offsets and return last partially parser token.
UT_ASSERT(tf.set(true, offsetarray, false, false));
UT_ASSERT(tokenizer.setTokenizerFunction(tf));
// Perform testing.
test = STR("1234567890ABCDEF");
UT_ASSERT(tokenizer.setInputContainer(test));
it = tokenizer.getItTop();
UT_ASSERT_EQUAL(*it, CString(STR("1")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("23")));
UT_ASSERT_EQUAL(it.stepForward(), 1);
UT_ASSERT_EQUAL(*it, CString(STR("456")));
UT_ASSERT_EQUAL(it.stepForward(), 0);
//.........这里部分代码省略.........