本文整理汇总了C++中TextStyle::output方法的典型用法代码示例。如果您正苦于以下问题:C++ TextStyle::output方法的具体用法?C++ TextStyle::output怎么用?C++ TextStyle::output使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextStyle
的用法示例。
在下文中一共展示了TextStyle::output方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inner
int
main()
{
string orig = "<font color=\"$style\">$text</font>";
string expected = "<font color=\"green\">foo</font>";
string transformed;
TextStyle textStyle1(orig);
transformed = textStyle1.output("foo", "green");
cout << "orig: " << textStyle1.toString() << endl;
cout << "transformed: " << transformed << endl;
assertEquals(true, textStyle1.containsStyleVar());
assertEquals(expected, transformed);
orig = "<b>$text</b>";
expected = "<b>foo</b>";
textStyle1 = TextStyle(orig);
transformed = textStyle1.output("foo", "green");
cout << "orig: " << textStyle1.toString() << endl;
cout << "transformed: " << transformed << endl;
assertEquals(false, textStyle1.containsStyleVar());
assertEquals(expected, transformed);
TextStyle inner("<i>$text</i>");
TextStyle composed = textStyle1.compose(inner);
transformed = composed.output("foo");
cout << "orig:" << composed.toString() << endl;
cout << "transformed: " << transformed << endl;
assertEquals("<b><i>foo</i></b>", transformed);
expected = "(\\foo)";
textStyle1 = TextStyle();
transformed = textStyle1.output("(\\foo)", "green");
cout << "orig: " << textStyle1.toString() << endl;
cout << "transformed: " << transformed << endl;
assertEquals(expected, transformed);
cout << "test_textstyle: SUCCESS!" << endl;
return 0;
}