Skip to content

Commit 044b983

Browse files
committed
All char16_t/char32_t dependencies #ifdef'ed out. All test/msvc/filesystem.sln tests pass.
1 parent fcb9600 commit 044b983

10 files changed

Lines changed: 117 additions & 67 deletions

File tree

example/file_status.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ namespace
4747
"type_unknown"
4848
};
4949

50-
const char* file_type_c_str(enum file_type t)
50+
const char* file_type_c_str(BOOST_SCOPED_ENUM(file_type) t)
5151
{
52-
return file_type_tab[t];
52+
return file_type_tab[static_cast<int>(t)];
5353
}
5454

5555
void show_status(file_status s, boost::system::error_code ec)
@@ -68,7 +68,7 @@ namespace
6868
else
6969
cout << "clears ec.\n";
7070

71-
cout << "s.type() is " << s.type()
71+
cout << "s.type() is " << static_cast<int>(s.type())
7272
<< ", which is defined as \"" << file_type_c_str(s.type()) << "\"\n";
7373

7474
cout << "exists(s) is " << (exists(s) ? "true" : "false") << "\n";

include/boost/filesystem/path.hpp

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ namespace filesystem
332332

333333
void clear() { m_pathname.clear(); }
334334
path& make_preferred()
335-
# ifdef BOOST_POSIX_API
335+
# ifdef BOOST_POSIX_API
336336
{ return *this; } // POSIX no effect
337-
# else // BOOST_WINDOWS_API
337+
# else // BOOST_WINDOWS_API
338338
; // change slashes to backslashes
339-
# endif
339+
# endif
340340
path& remove_filename();
341341
path& replace_filename(const path& replacement)
342342
{
@@ -374,9 +374,13 @@ namespace filesystem
374374
template <class String>
375375
String string(const codecvt_type& cvt) const;
376376

377-
// Prototype the SG3 requested templated string() function. The real thing will have
377+
// TODO Prototype the SG3 requested templated string() function. The real thing will have
378378
// defaulted traits and Allocator template parameters, and will be named string().
379-
// Will have to enable_it current Boost version of string() template.
379+
// Will have to enable_if current Boost version of string() template.
380+
// Also must rename function, uncomment: //CHECK(p0.string() == (p0.basic_string<char,
381+
// // std::char_traits<char>, std::allocator<char> >()));
382+
// in path_unit_test.cpp
383+
#if 0
380384
template <class charT, class traits, class Allocator >
381385
std::basic_string<charT, traits, Allocator>
382386
basic_string(const Allocator& a = Allocator()) const
@@ -385,21 +389,27 @@ namespace filesystem
385389
typename boost::interop::select_codec<charT>::type, boost::interop::default_codec,
386390
std::basic_string<charT, traits, Allocator> >(m_pathname);
387391
}
392+
#endif
388393

389-
boost::u16string u16string() const
394+
# ifndef BOOST_NO_CXX11_CHAR16_T
395+
std::u16string u16string() const
390396
{
391397
return boost::interop::make_string<boost::interop::utf16,
392398
boost::interop::select_codec<value_type>::type,
393399
boost::u16string>(m_pathname);
394400
}
395-
boost::u32string u32string() const
401+
# endif
402+
403+
# ifndef BOOST_NO_CXX11_CHAR32_T
404+
std::u32string u32string() const
396405
{
397406
return boost::interop::make_string<boost::interop::utf32,
398407
boost::interop::select_codec<value_type>::type,
399408
boost::u32string>(m_pathname);
400409
}
410+
# endif
401411

402-
# ifdef BOOST_WINDOWS_API
412+
# ifdef BOOST_WINDOWS_API
403413
std::string string() const { return string(codecvt()); }
404414
std::string string(const codecvt_type& cvt) const
405415
{
@@ -414,7 +424,7 @@ namespace filesystem
414424
std::wstring wstring() const { return m_pathname; }
415425
std::wstring wstring(const codecvt_type&) const { return m_pathname; }
416426

417-
# else // BOOST_POSIX_API
427+
# else // BOOST_POSIX_API
418428
// string_type is std::string, so there is no conversion
419429
std::string string() const { return m_pathname; }
420430
std::string string(const codecvt_type&) const { return m_pathname; }
@@ -429,7 +439,7 @@ namespace filesystem
429439
return tmp;
430440
}
431441

432-
# endif
442+
# endif
433443

434444
// ----- generic format observers -----
435445

@@ -439,23 +449,27 @@ namespace filesystem
439449
template <class String>
440450
String generic_string(const codecvt_type& cvt) const;
441451

442-
# ifdef BOOST_WINDOWS_API
452+
# ifdef BOOST_WINDOWS_API
443453
std::string generic_string() const { return generic_string(codecvt()); }
444454
std::string generic_string(const codecvt_type& cvt) const;
445455
std::wstring generic_wstring() const;
446456
std::wstring generic_wstring(const codecvt_type&) const { return generic_wstring(); };
457+
# ifndef BOOST_NO_CXX11_CHAR16_T
447458
boost::u16string generic_u16string() const
448459
{
449460
return interop::make_string<interop::utf16, interop::wide,
450461
boost::u16string>(generic_wstring());
451462
}
463+
# endif
464+
# ifndef BOOST_NO_CXX11_CHAR32_T
452465
boost::u32string generic_u32string() const
453466
{
454467
return interop::make_string<interop::utf32, interop::wide,
455468
boost::u32string>(generic_wstring());
456469
}
470+
# endif
457471

458-
# else // BOOST_POSIX_API
472+
# else // BOOST_POSIX_API
459473
// On POSIX-like systems, the generic format is the same as the native format
460474
std::string generic_string() const { return m_pathname; }
461475
std::string generic_string(const codecvt_type&) const { return m_pathname; }
@@ -464,7 +478,7 @@ namespace filesystem
464478
boost::u16string generic_u16string() const {return u16string();}
465479
boost::u32string generic_u32string() const {return u32string();}
466480

467-
# endif
481+
# endif
468482

469483
// ----- compare -----
470484

@@ -497,11 +511,11 @@ namespace filesystem
497511
bool has_extension() const { return !extension().empty(); }
498512
bool is_absolute() const
499513
{
500-
# ifdef BOOST_WINDOWS_API
514+
# ifdef BOOST_WINDOWS_API
501515
return has_root_name() && has_root_directory();
502-
# else
516+
# else
503517
return has_root_directory();
504-
# endif
518+
# endif
505519
}
506520
bool is_relative() const { return !is_absolute(); }
507521

include/boost/filesystem/path_traits.hpp

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,31 @@ namespace path_traits {
6060
template<> struct is_pathable<const char*> {static const bool value = true;};
6161
template<> struct is_pathable<wchar_t*> {static const bool value = true;};
6262
template<> struct is_pathable<const wchar_t*> {static const bool value = true;};
63-
template<> struct is_pathable<boost::char16*> {static const bool value = true;};
64-
template<> struct is_pathable<const boost::char16*> {static const bool value = true;};
65-
template<> struct is_pathable<boost::char32*> {static const bool value = true;};
66-
template<> struct is_pathable<const boost::char32*> {static const bool value = true;};
6763
template<> struct is_pathable<std::string> {static const bool value = true;};
6864
template<> struct is_pathable<std::wstring> {static const bool value = true;};
69-
template<> struct is_pathable<boost::u16string> {static const bool value = true;};
70-
template<> struct is_pathable<boost::u32string> {static const bool value = true;};
7165
template<> struct is_pathable<std::vector<char> > {static const bool value = true;};
7266
template<> struct is_pathable<std::vector<wchar_t> > {static const bool value = true;};
73-
template<> struct is_pathable<std::vector<boost::char16> > {static const bool value = true;};
74-
template<> struct is_pathable<std::vector<boost::char32> > {static const bool value = true;};
7567
template<> struct is_pathable<std::list<char> > {static const bool value = true;};
7668
template<> struct is_pathable<std::list<wchar_t> > {static const bool value = true;};
77-
template<> struct is_pathable<std::list<boost::char16> > {static const bool value = true;};
78-
template<> struct is_pathable<std::list<boost::char32> > {static const bool value = true;};
7969
template<> struct is_pathable<directory_entry> {static const bool value = true;};
8070

71+
#ifndef BOOST_NO_CXX11_CHAR16_T
72+
template<> struct is_pathable<char16_t*> {static const bool value = true;};
73+
template<> struct is_pathable<const char16_t*> {static const bool value = true;};
74+
template<> struct is_pathable<std::u16string> {static const bool value = true;};
75+
template<> struct is_pathable<std::vector<char16_t> > {static const bool value = true;};
76+
template<> struct is_pathable<std::list<char16_t> > {static const bool value = true;};
77+
#endif
78+
79+
#ifndef BOOST_NO_CXX11_CHAR32_T
80+
template<> struct is_pathable<char32_t*> {static const bool value = true;};
81+
template<> struct is_pathable<const char32_t*> {static const bool value = true;};
82+
template<> struct is_pathable<std::u32string> {static const bool value = true;};
83+
template<> struct is_pathable<std::vector<char32_t> > {static const bool value = true;};
84+
template<> struct is_pathable<std::list<char32_t> > {static const bool value = true;};
85+
#endif
86+
87+
8188
// Pathable empty
8289

8390
template <class Container> inline
@@ -114,6 +121,7 @@ namespace path_traits {
114121
std::string& to,
115122
const codecvt_type& cvt);
116123

124+
#ifndef BOOST_NO_CXX11_CHAR16_T
117125
inline
118126
void convert(const char16* from,
119127
const char16* from_end,
@@ -127,7 +135,6 @@ namespace path_traits {
127135
for (; itr != iter_type(); ++itr)
128136
to.push_back(*itr);
129137
}
130-
131138
inline
132139
void convert(const char16* from,
133140
const char16* from_end,
@@ -141,7 +148,8 @@ namespace path_traits {
141148
for (; itr != iter_type(); ++itr)
142149
to.push_back(*itr);
143150
}
144-
151+
#endif
152+
#ifndef BOOST_NO_CXX11_CHAR32_T
145153
inline
146154
void convert(const char32* from,
147155
const char32* from_end,
@@ -169,6 +177,7 @@ namespace path_traits {
169177
for (; itr != iter_type(); ++itr)
170178
to.push_back(*itr);
171179
}
180+
#endif
172181

173182
inline
174183
void convert(const char* from,
@@ -188,7 +197,8 @@ namespace path_traits {
188197
convert(from, 0, to, cvt);
189198
}
190199

191-
inline
200+
#ifndef BOOST_NO_CXX11_CHAR16_T
201+
inline
192202
void convert(const char16* from,
193203
std::string& to,
194204
const codecvt_type& cvt)
@@ -198,17 +208,18 @@ namespace path_traits {
198208
}
199209

200210
inline
201-
void convert(const char32* from,
202-
std::string& to,
211+
void convert(const char16* from,
212+
std::wstring& to,
203213
const codecvt_type& cvt)
204214
{
205215
BOOST_ASSERT(from);
206216
convert(from, 0, to, cvt);
207217
}
208-
209-
inline
210-
void convert(const char16* from,
211-
std::wstring& to,
218+
#endif
219+
#ifndef BOOST_NO_CXX11_CHAR32_T
220+
inline
221+
void convert(const char32* from,
222+
std::string& to,
212223
const codecvt_type& cvt)
213224
{
214225
BOOST_ASSERT(from);
@@ -223,6 +234,7 @@ namespace path_traits {
223234
BOOST_ASSERT(from);
224235
convert(from, 0, to, cvt);
225236
}
237+
#endif
226238

227239
// value types same -----------------------------------------------------------------//
228240

test/msvc/common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<ItemDefinitionGroup>
77
<ClCompile>
88
<AdditionalIncludeDirectories>../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
9-
<PreprocessorDefinitions>BOOST_SYSTEM_NO_DEPRECATED;BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
9+
<PreprocessorDefinitions>BOOST_SYSTEM_NO_DEPRECATED;BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;BOOST_CHRONO_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
1010
<ExceptionHandling>Async</ExceptionHandling>
1111
<DisableLanguageExtensions>false</DisableLanguageExtensions>
1212
<WarningLevel>Level4</WarningLevel>
1313
</ClCompile>
1414
<Link>
15-
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
15+
<AdditionalLibraryDirectories>C:\boost\modular\develop\stage\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
1616
</Link>
1717
</ItemDefinitionGroup>
1818
</Project>

test/msvc/filesystem_lib/filesystem_lib.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</PrecompiledHeader>
6262
<WarningLevel>Level3</WarningLevel>
6363
<Optimization>Disabled</Optimization>
64-
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
64+
<PreprocessorDefinitions>BOOST_CHRONO_HEADER_ONLY;BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
6565
<AdditionalIncludeDirectories>../../../../..</AdditionalIncludeDirectories>
6666
</ClCompile>
6767
<Link>
@@ -77,7 +77,7 @@
7777
<Optimization>MaxSpeed</Optimization>
7878
<FunctionLevelLinking>true</FunctionLevelLinking>
7979
<IntrinsicFunctions>true</IntrinsicFunctions>
80-
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
80+
<PreprocessorDefinitions>BOOST_CHRONO_HEADER_ONLY;BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8181
<AdditionalIncludeDirectories>../../../../..</AdditionalIncludeDirectories>
8282
</ClCompile>
8383
<Link>

test/msvc/path_test_static/path_test_static.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</PrecompiledHeader>
5252
<WarningLevel>Level3</WarningLevel>
5353
<Optimization>Disabled</Optimization>
54-
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
54+
<PreprocessorDefinitions>BOOST_CHRONO_HEADER_ONLY;BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5555
<AdditionalIncludeDirectories>../../../../..</AdditionalIncludeDirectories>
5656
</ClCompile>
5757
<Link>
@@ -73,7 +73,7 @@
7373
<Optimization>MaxSpeed</Optimization>
7474
<FunctionLevelLinking>true</FunctionLevelLinking>
7575
<IntrinsicFunctions>true</IntrinsicFunctions>
76-
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
76+
<PreprocessorDefinitions>BOOST_CHRONO_HEADER_ONLY;BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
7777
<AdditionalIncludeDirectories>../../../../..</AdditionalIncludeDirectories>
7878
</ClCompile>
7979
<Link>

test/operations_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# define BOOST_SYSTEM_NO_DEPRECATED
1818
#endif
1919

20-
#define BOOST_CHRONO_HEADER_ONLY
2120
#include <boost/filesystem/operations.hpp>
2221

2322
#include <boost/config.hpp>

test/operations_unit_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
# define BOOST_SYSTEM_NO_DEPRECATED
2525
#endif
2626

27-
#define BOOST_CHRONO_HEADER_ONLY
2827
#include <boost/filesystem.hpp> // make sure filesystem.hpp works
2928

3029
#include <boost/config.hpp>

0 commit comments

Comments
 (0)