diff --git a/include/boost/program_options/detail/convert.hpp b/include/boost/program_options/detail/convert.hpp index 206f701..49a0f1e 100644 --- a/include/boost/program_options/detail/convert.hpp +++ b/include/boost/program_options/detail/convert.hpp @@ -8,6 +8,8 @@ #include +#if !defined(BOOST_NO_STD_WSTRING) + #include #include @@ -84,4 +86,22 @@ namespace boost { } +#else +#include +#include +namespace boost{ + namespace program_options{ + BOOST_PROGRAM_OPTIONS_DECL std::string to_internal(const std::string&); + + template + std::vector to_internal(const std::vector& s) + { + std::vector result; + for (unsigned i = 0; i < s.size(); ++i) + result.push_back(to_internal(s[i])); + return result; + } + } +} +#endif #endif diff --git a/include/boost/program_options/detail/value_semantic.hpp b/include/boost/program_options/detail/value_semantic.hpp index a51bfd0..e4c5845 100644 --- a/include/boost/program_options/detail/value_semantic.hpp +++ b/include/boost/program_options/detail/value_semantic.hpp @@ -90,11 +90,12 @@ namespace boost { namespace program_options { bool*, int); +#if !defined(BOOST_NO_STD_WSTRING) BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v, const std::vector& xs, bool*, int); - +#endif // For some reason, this declaration, which is require by the standard, // cause gcc 3.2 to not generate code to specialization defined in // value_semantic.cpp @@ -107,10 +108,12 @@ namespace boost { namespace program_options { std::string*, int); +#if !defined(BOOST_NO_STD_WSTRING) BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v, const std::vector& xs, std::string*, int); +#endif #endif /** Validates sequences. Allows multiple values per option occurence diff --git a/include/boost/program_options/value_semantic.hpp b/include/boost/program_options/value_semantic.hpp index efb8561..f0e4871 100644 --- a/include/boost/program_options/value_semantic.hpp +++ b/include/boost/program_options/value_semantic.hpp @@ -100,11 +100,12 @@ namespace boost { namespace program_options { const std::vector& new_tokens, bool utf8) const; protected: // interface for derived classes. +#if !defined(BOOST_NO_STD_WSTRING) virtual void xparse(boost::any& value_store, const std::vector& new_tokens) const = 0; +#endif }; - /** Class which specify handling of value for which user did not specified anything. */ class BOOST_PROGRAM_OPTIONS_DECL diff --git a/src/value_semantic.cpp b/src/value_semantic.cpp index aaaff3a..ec9f1bf 100644 --- a/src/value_semantic.cpp +++ b/src/value_semantic.cpp @@ -123,6 +123,7 @@ namespace boost { namespace program_options { // since wstring can't be constructed/compared with char*. We'd need to // create auxilliary 'widen' routine to convert from char* into // needed string type, and that's more work. +#if !defined(BOOST_NO_STD_WSTRING) BOOST_PROGRAM_OPTIONS_DECL void validate(any& v, const vector& xs, bool*, int) { @@ -139,7 +140,7 @@ namespace boost { namespace program_options { else throw validation_error("invalid bool value"); } - +#endif BOOST_PROGRAM_OPTIONS_DECL void validate(any& v, const vector& xs, std::string*, int) { @@ -152,6 +153,7 @@ namespace boost { namespace program_options { v = any(s); } +#if !defined(BOOST_NO_STD_WSTRING) BOOST_PROGRAM_OPTIONS_DECL void validate(any& v, const vector& xs, std::string*, int) { @@ -163,7 +165,7 @@ namespace boost { namespace program_options { else v = any(s); } - +#endif namespace validators {