Skip to content

Commit 59cc22d

Browse files
committed
Merge pull request #18 from mauve/universal-windows
Universal windows
2 parents 09e789b + 6d2be64 commit 59cc22d

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

include/boost/regex/config.hpp

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
# include BOOST_REGEX_USER_CONFIG
4343

4444
# include <boost/config.hpp>
45+
# include <boost/predef.h>
4546

4647
#else
4748
/*
@@ -147,8 +148,14 @@
147148

148149
/* disable our own file-iterators and mapfiles if we can't
149150
* support them: */
150-
#if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32))
151-
# define BOOST_REGEX_NO_FILEITER
151+
#if defined(_WIN32)
152+
# if defined(BOOST_REGEX_NO_W32) || BOOST_PLAT_WINDOWS_STORE
153+
# define BOOST_REGEX_NO_FILEITER
154+
# endif
155+
#else // defined(_WIN32)
156+
# if !defined(BOOST_HAS_DIRENT_H)
157+
# define BOOST_REGEX_NO_FILEITER
158+
# endif
152159
#endif
153160

154161
/* backwards compatibitity: */
@@ -177,10 +184,20 @@
177184
* with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
178185
* of the non-inline functions in the library, so that users can still link to the lib,
179186
* irrespective of whether their own code is built with /Zc:wchar_t.
180-
* Note that this does NOT WORK with VC10 when the C++ locale is in effect as
187+
* Note that this does NOT WORK with VC10 and VC14 when the C++ locale is in effect as
181188
* the locale's <unsigned short> facets simply do not compile in that case.
189+
* As we default to the C++ locale when compiling for the windows runtime we
190+
* skip in this case aswell.
182191
*/
183-
#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(BOOST_RWSTD_VER) && ((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE))
192+
#if defined(__cplusplus) && \
193+
(defined(BOOST_MSVC) || defined(__ICL)) && \
194+
!defined(BOOST_NO_INTRINSIC_WCHAR_T) && \
195+
defined(BOOST_WINDOWS) && \
196+
!defined(__SGI_STL_PORT) && \
197+
!defined(_STLPORT_VERSION) && \
198+
!defined(BOOST_RWSTD_VER) && \
199+
((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE)) && \
200+
!BOOST_PLAT_WINDOWS_RUNTIME
184201
# define BOOST_REGEX_HAS_OTHER_WCHAR_T
185202
# ifdef BOOST_MSVC
186203
# pragma warning(push)
@@ -278,8 +295,19 @@
278295
# define BOOST_REGEX_USE_C_LOCALE
279296
#endif
280297

298+
/* use C++ locale when targeting windows store */
299+
#if BOOST_PLAT_WINDOWS_RUNTIME
300+
# define BOOST_REGEX_USE_CPP_LOCALE
301+
# define BOOST_REGEX_NO_WIN32_LOCALE
302+
#endif
303+
281304
/* Win32 defaults to native Win32 locale: */
282-
#if defined(_WIN32) && !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_REGEX_NO_W32)
305+
#if defined(_WIN32) && \
306+
!defined(BOOST_REGEX_USE_WIN32_LOCALE) && \
307+
!defined(BOOST_REGEX_USE_C_LOCALE) && \
308+
!defined(BOOST_REGEX_USE_CPP_LOCALE) && \
309+
!defined(BOOST_REGEX_NO_W32) && \
310+
!defined(BOOST_REGEX_NO_WIN32_LOCALE)
283311
# define BOOST_REGEX_USE_WIN32_LOCALE
284312
#endif
285313
/* otherwise use C++ locale if supported: */

include/boost/regex/v4/w32_regex_traits.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
2020
#define BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
2121

22+
#ifndef BOOST_REGEX_NO_WIN32_LOCALE
23+
2224
#ifndef BOOST_RE_PAT_EXCEPT_HPP
2325
#include <boost/regex/pattern_except.hpp>
2426
#endif
@@ -736,4 +738,6 @@ static_mutex& w32_regex_traits<charT>::get_mutex_inst()
736738
#pragma warning(pop)
737739
#endif
738740

741+
#endif // BOOST_REGEX_NO_WIN32_LOCALE
742+
739743
#endif

src/w32_regex_traits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define BOOST_REGEX_SOURCE
2020
#include <boost/regex/config.hpp>
2121

22-
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
22+
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_NO_WIN32_LOCALE)
2323
#include <boost/regex/regex_traits.hpp>
2424
#include <boost/regex/pattern_except.hpp>
2525

0 commit comments

Comments
 (0)