]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/filesystem/example/tut5.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / filesystem / example / tut5.cpp
CommitLineData
7c673cae
FG
1// filesystem tut5.cpp ---------------------------------------------------------------//
2
3// Copyright Beman Dawes 2010
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
8// Library home page: http://www.boost.org/libs/filesystem
9
10#include <boost/filesystem/fstream.hpp>
11#include <string>
12#include <list>
1e59de90 13
7c673cae
FG
14namespace fs = boost::filesystem;
15
16int main()
17{
1e59de90
TL
18 // \u263A is "Unicode WHITE SMILING FACE = have a nice day!"
19 std::string narrow_string("smile2");
20 std::wstring wide_string(L"smile2\u263A");
21 std::list< char > narrow_list;
22 narrow_list.push_back('s');
23 narrow_list.push_back('m');
24 narrow_list.push_back('i');
25 narrow_list.push_back('l');
26 narrow_list.push_back('e');
27 narrow_list.push_back('3');
28 std::list< wchar_t > wide_list;
29 wide_list.push_back(L's');
30 wide_list.push_back(L'm');
31 wide_list.push_back(L'i');
32 wide_list.push_back(L'l');
33 wide_list.push_back(L'e');
34 wide_list.push_back(L'3');
35 wide_list.push_back(L'\u263A');
36
37 {
38 fs::ofstream f("smile");
39 }
40 {
41 fs::ofstream f(L"smile\u263A");
42 }
43 {
44 fs::ofstream f(narrow_string);
45 }
46 {
47 fs::ofstream f(wide_string);
48 }
49 {
50 fs::ofstream f(narrow_list);
51 }
52 {
53 fs::ofstream f(wide_list);
54 }
55 narrow_list.pop_back();
56 narrow_list.push_back('4');
57 wide_list.pop_back();
58 wide_list.pop_back();
59 wide_list.push_back(L'4');
60 wide_list.push_back(L'\u263A');
61 {
62 fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end()));
63 }
64 {
65 fs::ofstream f(fs::path(wide_list.begin(), wide_list.end()));
66 }
67
68 return 0;
7c673cae 69}