本文整理汇总了C++中Nibbler::skipRx方法的典型用法代码示例。如果您正苦于以下问题:C++ Nibbler::skipRx方法的具体用法?C++ Nibbler::skipRx怎么用?C++ Nibbler::skipRx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nibbler
的用法示例。
在下文中一共展示了Nibbler::skipRx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
t.notok (n.skip (' '), " 'a' : skip (' ') -> false");
t.notok (n.depleted (), " 'a' : depleted () -> false");
t.ok (n.skip ('a'), " 'a' : skip ('a') -> true");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipAll (char);
t.diag ("Nibbler::skipAll");
n = Nibbler ("aaaabb");
t.ok (n.skipAll ('a'), " 'aaaabb' : skipAll ('a') -> true");
t.notok (n.skipAll ('a'), " 'bb' : skipAll ('a') -> false");
t.ok (n.skipAll ('b'), " 'bb' : skipAll ('b') -> true");
t.notok (n.skipAll ('b'), " '' : skipAll ('b') -> false");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipAllOneOf (const std::string&);
t.diag ("Nibbler::skipAllOneOf");
n = Nibbler ("abababcc");
t.ok (n.skipAllOneOf ("ab"), "'abababcc' : skipAllOneOf ('ab') -> true");
t.notok (n.skipAllOneOf ("ab"), " 'cc' : skipAllOneOf ('ab') -> false");
t.ok (n.skipAllOneOf ("c"), " 'cc' : skipAllOneOf ('ab') -> false");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipWS ();
t.diag ("Nibbler::skipWS");
n = Nibbler (" \tfoo");
t.ok (n.skipWS (), " ' \\tfoo' : skipWS () -> true");
t.notok (n.skipWS (), " 'foo' : skipWS () -> false");
t.ok (n.getUntilEOS (s), " 'foo' : getUntilEOS () -> true");
t.is (s, "foo", " 'foo' : getUntilEOS () -> 'foo'");
t.ok (n.depleted (), " '' : depleted () -> true");
#ifdef NIBBLER_FEATURE_REGEX
// bool skipRx (const std::string&);
t.diag ("Nibbler::skipRx");
n = Nibbler ("one two");
t.ok (n.skipRx ("o."), " 'one two' : skipRx ('o.') -> true");
t.notok (n.skipRx ("A+"), " 'e two' : skipRx ('A+') -> false");
t.ok (n.skipRx ("e+"), " 'e two' : skipRx ('e+') -> true");
t.ok (n.skipRx ("...."), " ' two' : skipRx ('....') -> true");
t.ok (n.depleted (), " '' : depleted () -> true");
#endif
// bool backN (const int quantity = 1);
t.diag ("Nibbler::backN");
n = Nibbler ("/a/b/");
t.ok (n.getQuoted ('/', s), " '/a/b/' : getQuoted ('/') -> true");
t.is (s, "a", " 'b/' : getQuoted ('/') -> 'a'");
t.ok (n.backN (), " 'b/' : backN () -> true");
t.ok (n.getQuoted ('/', s), " '/b/' : getQuoted ('/') -> true");
t.is (s, "b", " '/b/' : getQuoted ('/') -> 'b'");
// bool getQuoted (char, std::string&);
t.diag ("Nibbler::getQuoted");
n = Nibbler ("''");
t.ok (n.getQuoted ('\'', s), " '''' : getQuoted (''') -> true");
t.is (s, "", " '''' : getQuoted (''') -> ''");
n = Nibbler ("'\"'");
t.ok (n.getQuoted ('\'', s), " ''\"'' : getQuoted (''') -> true");
t.is (s, "\"", " ''\"'' : getQuoted (''') -> '\"'");
n = Nibbler ("'x'");
t.ok (n.getQuoted ('\'', s), " ''x'' : getQuoted (''') -> true");
t.is (s, "x", " ''x'' : getQuoted (''') -> ''");
n = Nibbler ("'x");