本文整理汇总了C++中Nibbler::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Nibbler::getName方法的具体用法?C++ Nibbler::getName怎么用?C++ Nibbler::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nibbler
的用法示例。
在下文中一共展示了Nibbler::getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
t.is (dt.day (), 1, "ctor (std::string) -> d");
t.is (dt.year (), 2010, "ctor (std::string) -> Y");
t.is (dt.hour (), 0, "ctor (std::string) -> h");
t.is (dt.minute (), 0, "ctor (std::string) -> N");
t.is (dt.second (), 0, "ctor (std::string) -> S");
n = Nibbler ("17:18:19");
t.ok (n.getDate ("H:N:S", ti), "H:N:S ok");
dt = Date (ti);
Date now = Date ();
t.is (dt.month (), now.month(), "ctor (std::string) -> m");
t.is (dt.day (), now.day(), "ctor (std::string) -> d");
t.is (dt.year (), now.year(), "ctor (std::string) -> Y");
t.is (dt.hour (), 17, "ctor (std::string) -> h");
t.is (dt.minute (), 18, "ctor (std::string) -> N");
t.is (dt.second (), 19, "ctor (std::string) -> S");
#endif
// bool getOneOf (const std::vector <std::string>&, std::string&);
t.diag ("Nibbler::getOneOf");
options.push_back ("one");
options.push_back ("two");
options.push_back ("three");
n = Nibbler ("onetwothreefour");
t.ok (n.getOneOf (options, s), "'onetwothreefour': getOneOf () -> true");
t.is (s, "one", "'onetwothreefour': getOneOf () -> one");
t.ok (n.getOneOf (options, s), " 'twothreefour': getOneOf () -> true");
t.is (s, "two", " 'twothreefour': getOneOf () -> two");
t.ok (n.getOneOf (options, s), " 'threefour': getOneOf () -> true");
t.is (s, "three", " 'threefour': getOneOf () -> three");
t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false");
// bool getName (std::string&);
t.diag ("Nibbler::getName");
n = Nibbler ("a1 one one.two 9 foo_bar");
t.ok (n.getName (s), "'a1 one one.two 9 foo_bar' getName -> ok");
t.is (s, "a1", " ' one one.two 9 foo_bar' getName -> 'a1'");
t.ok (n.skipWS (), " 'one one.two 9 foo_bar' skipWS -> ok");
t.ok (n.getName (s), " 'one one.two 9 foo_bar' getName -> ok");
t.is (s, "one", " ' one.two 9 foo_bar' getName -> 'one'");
t.ok (n.skipWS (), " 'one.two 9 foo_bar' skipWS -> ok");
t.ok (n.getName (s), " 'one.two 9 foo_bar' getName -> ok");
t.is (s, "one", " '.two 9 foo_bar' getName -> 'one'");
t.ok (n.skip ('.'), " 'two 9 foo_bar' skip . -> ok");
t.ok (n.getName (s), " 'two 9 foo_bar' getName -> ok");
t.is (s, "two", " ' 9 foo_bar' getName -> 'two'");
t.ok (n.skipWS (), " '9 foo_bar' skipWS -> ok");
t.notok (n.getName (s), " '9 foo_bar' getName -> not ok");
t.ok (n.skip ('9'), " ' foo_bar' skip 9 -> ok");
t.ok (n.skipWS (), " 'foo_bar' skipWS -> ok");
t.ok (n.getName (s), " 'foo_bar' getName -> ok");
t.is (s, "foo_bar", " '' getName -> 'foo_bar'");
t.ok (n.depleted (), "depleted");
n = Nibbler ("entrée");
t.ok (n.getName (s), "'entrée' -> ok");
t.is (s, "entrée", "'entrée' -> 'entrée'");
// bool getWord (std::string&);
t.diag ("Nibbler::getWord");
n = Nibbler ("one two th3ee");