本文整理汇总了C++中Obj::print方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::print方法的具体用法?C++ Obj::print怎么用?C++ Obj::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
const int test = argc > 1 ? atoi(argv[1]) : 0;
const bool verbose = argc > 2;
const bool veryVerbose = argc > 3;
const bool veryVeryVerbose = argc > 4;
const bool veryVeryVeryVerbose = argc > 5;
(void) veryVerbose;
(void) veryVeryVerbose;
(void) veryVeryVeryVerbose;
cout << "TEST " << __FILE__ << " CASE " << test << endl;
switch (test) { case 0:
case 8: {
// --------------------------------------------------------------------
// USAGE EXAMPLE
// Extracted from component header file.
//
// Concerns:
//: 1 The usage example provided in the component header file compiles,
//: links, and runs as shown.
//
// Plan:
//: 1 Incorporate usage example from header into test driver, remove
//: leading comment characters and replace 'assert' with 'ASSERT'.
//: (C-1)
//
// Testing:
// USAGE EXAMPLE
// --------------------------------------------------------------------
if (verbose) cout << endl
<< "USAGE EXAMPLE" << endl
<< "=============" << endl;
// Next, we need to create password for verification and call our function:
//..
bdld::DatumError error = verifyNewPassword("Test");
//..
// Then, check the results:
//..
ASSERT(bdld::DatumError() != error);
ASSERT(3 == error.code());
//..
// Finally, we can print the result to the output stream:
//..
ostringstream out;
error.print(out);
//..
} break;
case 7: {
// --------------------------------------------------------------------
// TESTING TYPE TRAITS
// The object is trivially copyable and should have appropriate bsl
// type traits to reflect this.
//
// Concerns:
//: 1 The class has the bsl::is_trivially_copyable trait.
//
// Plan:
//: 1 ASSERT the presence of each trait required by the type. (C-1)
//
// Testing:
// TYPE TRAITS
// --------------------------------------------------------------------
if (verbose) cout << endl
<< "TESTING TYPE TRAITS" << endl
<< "===================" << endl;
ASSERT((bsl::is_trivially_copyable<Obj>::value));
} break;
case 6: {
// --------------------------------------------------------------------
// TESTING RELATIONAL-COMPARISON OPERATORS
//
// Concerns:
//: 1 Each relational operator function reports the intended logical
//: relationship.
//:
//: 2 Comparison is symmetric with respect to user-defined conversion
//: (i.e., all relational-comparison operators are free functions).
//:
//: 3 Non-modifiable objects can be compared (i.e., objects or
//: references providing only non-modifiable access).
//:
//: 4 The relational-comparison operators' signatures and return types
//: are standard.
//
// Plan:
//: 1 Create 'DatumError' objects with different values. Verify the
//: correctness of operators. (C-1..3)
//:
//: 2 Use the respective addresses of operators to initialize function
//: pointers having the appropriate signatures and return types for
//: the operators defined in this component. (C-4)
//
// Testing:
// bool operator<(const DatumError&, const DatumError&);
// bool operator<=(const DatumError&, const DatumError&);
// bool operator>(const DatumError&, const DatumError&);
//.........这里部分代码省略.........