| 15 | const char * say_what(bool b) { return b ? "true" : "false"; } |
| 16 | |
| 17 | int main(int argc, char* argv[]) |
| 18 | { |
| 19 | if (argc < 2) |
| 20 | { |
| 21 | cout << "Usage: path_info path-portion...\n" |
| 22 | "Example: path_info foo/bar baz\n" |
| 23 | # ifdef BOOST_POSIX_API |
| 24 | " would report info about the composed path foo/bar/baz\n"; |
| 25 | # else // BOOST_WINDOWS_API |
| 26 | " would report info about the composed path foo/bar\\baz\n"; |
| 27 | # endif |
| 28 | return 1; |
| 29 | } |
| 30 | |
| 31 | path p; // compose a path from the command line arguments |
| 32 | |
| 33 | for (; argc > 1; --argc, ++argv) |
| 34 | p /= argv[1]; |
| 35 | |
| 36 | cout << "\ncomposed path:\n"; |
| 37 | cout << " cout << -------------: " << p << "\n"; |
| 38 | cout << " make_preferred()----------: " << path(p).make_preferred() << "\n"; |
| 39 | |
| 40 | cout << "\nelements:\n"; |
| 41 | |
| 42 | for (path::iterator it(p.begin()), it_end(p.end()); it != it_end; ++it) |
| 43 | cout << " " << *it << '\n'; |
| 44 | |
| 45 | cout << "\nobservers, native format:" << endl; |
| 46 | # ifdef BOOST_POSIX_API |
| 47 | cout << " native()-------------: " << p.native() << endl; |
| 48 | cout << " c_str()--------------: " << p.c_str() << endl; |
| 49 | # else // BOOST_WINDOWS_API |
| 50 | wcout << L" native()-------------: " << p.native() << endl; |
| 51 | wcout << L" c_str()--------------: " << p.c_str() << endl; |
| 52 | # endif |
| 53 | cout << " string()-------------: " << p.string() << endl; |
| 54 | wcout << L" wstring()------------: " << p.wstring() << endl; |
| 55 | |
| 56 | cout << "\nobservers, generic format:\n"; |
| 57 | cout << " generic_string()-----: " << p.generic_string() << endl; |
| 58 | wcout << L" generic_wstring()----: " << p.generic_wstring() << endl; |
| 59 | |
| 60 | cout << "\ndecomposition:\n"; |
| 61 | cout << " root_name()----------: " << p.root_name() << '\n'; |
| 62 | cout << " root_directory()-----: " << p.root_directory() << '\n'; |
| 63 | cout << " root_path()----------: " << p.root_path() << '\n'; |
| 64 | cout << " relative_path()------: " << p.relative_path() << '\n'; |
| 65 | cout << " parent_path()--------: " << p.parent_path() << '\n'; |
| 66 | cout << " filename()-----------: " << p.filename() << '\n'; |
| 67 | cout << " stem()---------------: " << p.stem() << '\n'; |
| 68 | cout << " extension()----------: " << p.extension() << '\n'; |
| 69 | |
| 70 | cout << "\nquery:\n"; |
| 71 | cout << " empty()--------------: " << say_what(p.empty()) << '\n'; |
| 72 | cout << " is_absolute()--------: " << say_what(p.is_absolute()) << '\n'; |
| 73 | cout << " has_root_name()------: " << say_what(p.has_root_name()) << '\n'; |
| 74 | cout << " has_root_directory()-: " << say_what(p.has_root_directory()) << '\n'; |
nothing calls this directly
no test coverage detected