From 81bf11eb10c209588cd8f8523437a57e2285fe33 Mon Sep 17 00:00:00 2001 From: Artyom Beilis Date: Tue, 29 May 2012 22:21:35 +0300 Subject: [PATCH] Some updates --- CMakeLists.txt | 33 ----- boost/nowide/args.hpp | 192 +++++++++++++------------- boost/nowide/cenv.hpp | 186 ++++++++++++------------- boost/nowide/convert.hpp | 254 +++++++++++++++++------------------ boost/nowide/cstdio.hpp | 2 +- boost/nowide/filebuf.hpp | 2 +- boost/nowide/fstream.hpp | 2 +- boost/nowide/iostream.hpp | 124 ++++++++--------- boost/nowide/stackstring.hpp | 44 +++--- boost/nowide/system.hpp | 2 +- libs/nowide/doc/main.txt | 8 +- libs/nowide/src/iostream.cpp | 2 +- 12 files changed, 411 insertions(+), 440 deletions(-) delete mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 3cb2f4d..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -include_directories(.) -if(NOT BOOST_PATH) - set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_PATH}) -endif() -include_directories(${BOOST_PATH}) - -enable_testing() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - -set(BOOST_NOWIDE_TESTS - test_convert - test_env - test_stdio - test_fstream - test_iostream - ) - -foreach(TEST ${BOOST_NOWIDE_TESTS}) - add_executable(${TEST} libs/nowide/test/${TEST}.cpp) - add_test(${TEST} ${TEST}) -endforeach() - -add_library(boost_nowide SHARED libs/nowide/src/iostream.cpp) -set_target_properties(boost_nowide PROPERTIES COMPILE_DEFINITIONS BOOST_NOWIDE_DYN_LINK) -set_target_properties(test_iostream PROPERTIES COMPILE_DEFINITIONS BOOST_NOWIDE_DYN_LINK) -target_link_libraries(test_iostream boost_nowide) - -add_executable(test_system libs/nowide/test/test_system.cpp) -add_test(test_system_n test_system "-n") -add_test(test_system_w test_system "-w") diff --git a/boost/nowide/args.hpp b/boost/nowide/args.hpp index 4e97d97..e063944 100644 --- a/boost/nowide/args.hpp +++ b/boost/nowide/args.hpp @@ -16,112 +16,112 @@ #endif namespace boost { - namespace nowide { - #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) - class args { - public: - args(int &,char **&) {} - args(int &,char **&,char **&){} - }; +namespace nowide { + #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) + class args { + public: + args(int &,char **&) {} + args(int &,char **&,char **&){} + }; - #else + #else + /// + /// \brief args is a class that fixes standard main() function arguments and changes them to UTF-8 under + /// Microsoft Windows. + /// + /// \note the class owns the memory of the newly allocated strings + /// + class args { + public: + /// - /// \brief args is a class that fixes standard main() function arguments and changes them to UTF-8 under - /// Microsoft Windows. + /// Fix command line agruments /// - /// \note the class owns the memory of the newly allocated strings + args(int &argc,char **&argv) + { + fix_args(argc,argv); + } /// - class args { - public: - - /// - /// Fix command line agruments - /// - args(int &argc,char **&argv) - { - fix_args(argc,argv); - } - /// - /// Fix command line agruments and environment - /// - args(int &argc,char **&argv,char **&en) - { - fix_args(argc,argv); - fix_env(en); - } - private: - void fix_args(int &argc,char **&argv) - { - int wargc; - wchar_t **wargv = CommandLineToArgvW(GetCommandLineW(),&wargc); - if(!wargv) { - argc = 0; - static char *dummy = 0; - argv = &dummy; - return; - } - try{ - args_.resize(wargc+1,0); - arg_values_.resize(wargc); - for(int i=0;i args_; - std::vector arg_values_; - stackstring env_; - std::vector envp_; - }; + } - #endif + std::vector args_; + std::vector arg_values_; + stackstring env_; + std::vector envp_; + }; - } // nowide -} // boost + #endif + +} // nowide +} // namespace boost #endif /// diff --git a/boost/nowide/cenv.hpp b/boost/nowide/cenv.hpp index 82fa9de..f4cb785 100644 --- a/boost/nowide/cenv.hpp +++ b/boost/nowide/cenv.hpp @@ -20,106 +20,106 @@ #endif namespace boost { - namespace nowide { - #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) - using ::getenv; - using ::setenv; - using ::unsetenv; - using ::putenv; - #else - /// - /// \brief UTF-8 aware getenv. Returns 0 if the variable is not set. - /// - /// This function is not thread safe or reenterable as defined by the standard library - /// - inline char *getenv(char const *key) - { - static stackstring value; - - wshort_stackstring name; - if(!name.convert(key)) - return 0; +namespace nowide { + #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) + using ::getenv; + using ::setenv; + using ::unsetenv; + using ::putenv; + #else + /// + /// \brief UTF-8 aware getenv. Returns 0 if the variable is not set. + /// + /// This function is not thread safe or reenterable as defined by the standard library + /// + inline char *getenv(char const *key) + { + static stackstring value; + + wshort_stackstring name; + if(!name.convert(key)) + return 0; - static const size_t buf_size = 64; - wchar_t buf[buf_size]; - std::vector tmp; - wchar_t *ptr = buf; - size_t n = GetEnvironmentVariableW(name.c_str(),buf,buf_size); - if(n == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) + static const size_t buf_size = 64; + wchar_t buf[buf_size]; + std::vector tmp; + wchar_t *ptr = buf; + size_t n = GetEnvironmentVariableW(name.c_str(),buf,buf_size); + if(n == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) + return 0; + if(n >= buf_size) { + tmp.resize(n+1,L'\0'); + n = GetEnvironmentVariableW(name.c_str(),&tmp[0],tmp.size() - 1); + // The size may have changed + if(n >= tmp.size() - 1) return 0; - if(n >= buf_size) { - tmp.resize(n+1,L'\0'); - n = GetEnvironmentVariableW(name.c_str(),&tmp[0],tmp.size() - 1); - // The size may have changed - if(n >= tmp.size() - 1) - return 0; - ptr = &tmp[0]; - } - if(!value.convert(ptr)) - return 0; - return value.c_str(); + ptr = &tmp[0]; } - /// - /// \brief UTF-8 aware setenv, \a key - the variable name, \a value is a new UTF-8 value, - /// - /// if override is not 0, that the old value is always overridded, otherwise, - /// if the variable exists it remains unchanged - /// - inline int setenv(char const *key,char const *value,int override) - { - wshort_stackstring name; - if(!name.convert(key)) - return -1; - if(!override) { - wchar_t unused[2]; - if(!(GetEnvironmentVariableW(name.c_str(),unused,2)==0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) - return 0; - } - wstackstring wval; - if(!wval.convert(value)) - return -1; - if(SetEnvironmentVariableW(name.c_str(),wval.c_str())) - return 0; + if(!value.convert(ptr)) + return 0; + return value.c_str(); + } + /// + /// \brief UTF-8 aware setenv, \a key - the variable name, \a value is a new UTF-8 value, + /// + /// if override is not 0, that the old value is always overridded, otherwise, + /// if the variable exists it remains unchanged + /// + inline int setenv(char const *key,char const *value,int override) + { + wshort_stackstring name; + if(!name.convert(key)) return -1; - } - /// - /// \brief Remove enviroment variable \a key - /// - inline int unsetenv(char const *key) - { - wshort_stackstring name; - if(!name.convert(key)) - return -1; - if(SetEnvironmentVariableW(name.c_str(),0)) + if(!override) { + wchar_t unused[2]; + if(!(GetEnvironmentVariableW(name.c_str(),unused,2)==0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) return 0; - return -1; } - /// - /// \brief UTF-8 aware putenv implementation, expects string in format KEY=VALUE - /// - inline int putenv(char *string) - { - char const *key = string; - char const *key_end = string; - while(*key_end!='=' && key_end!='\0') - key_end++; - if(*key_end == '\0') - return -1; - wshort_stackstring wkey; - if(!wkey.convert(key,key_end)) - return -1; - - wstackstring wvalue; - if(!wvalue.convert(key_end+1)) - return -1; + wstackstring wval; + if(!wval.convert(value)) + return -1; + if(SetEnvironmentVariableW(name.c_str(),wval.c_str())) + return 0; + return -1; + } + /// + /// \brief Remove enviroment variable \a key + /// + inline int unsetenv(char const *key) + { + wshort_stackstring name; + if(!name.convert(key)) + return -1; + if(SetEnvironmentVariableW(name.c_str(),0)) + return 0; + return -1; + } + /// + /// \brief UTF-8 aware putenv implementation, expects string in format KEY=VALUE + /// + inline int putenv(char *string) + { + char const *key = string; + char const *key_end = string; + while(*key_end!='=' && key_end!='\0') + key_end++; + if(*key_end == '\0') + return -1; + wshort_stackstring wkey; + if(!wkey.convert(key,key_end)) + return -1; + + wstackstring wvalue; + if(!wvalue.convert(key_end+1)) + return -1; - if(SetEnvironmentVariableW(wkey.c_str(),wvalue.c_str())) - return 0; - return -1; - } - #endif - } // nowide -} // boost + if(SetEnvironmentVariableW(wkey.c_str(),wvalue.c_str())) + return 0; + return -1; + } + #endif +} // nowide +} // namespace boost #endif /// diff --git a/boost/nowide/convert.hpp b/boost/nowide/convert.hpp index 8455d78..7ce98dc 100644 --- a/boost/nowide/convert.hpp +++ b/boost/nowide/convert.hpp @@ -12,142 +12,142 @@ #include namespace boost { - namespace nowide { - /// - /// \brief Template function that converts a buffer of UTF sequence in range [source_begin,source_end) - /// to the output \a buffer of size \a buffer_size. - /// - /// In case of success a NUL terminated string returned (buffer), otherwise 0 is returned. - /// - /// If there is not enough room in the buffer or the source sequence contains invalid UTF - /// 0 is returned, and the contend of the buffer is undefined. - /// - template - CharOut *basic_convert(CharOut *buffer,size_t buffer_size,CharIn const *source_begin,CharIn const *source_end) - { - CharOut *rv = buffer; - if(buffer_size == 0) - return 0; - buffer_size --; - while(source_begin!=source_end) { - using namespace boost::locale::utf; - code_point c = utf_traits::template decode(source_begin,source_end); - if(c==illegal || c==incomplete) { - rv = 0; - break; - } - size_t width = utf_traits::width(c); - if(buffer_size < width) { - rv=0; - break; - } - buffer = utf_traits::template encode(c,buffer); - buffer_size -= width; +namespace nowide { + /// + /// \brief Template function that converts a buffer of UTF sequence in range [source_begin,source_end) + /// to the output \a buffer of size \a buffer_size. + /// + /// In case of success a NUL terminated string returned (buffer), otherwise 0 is returned. + /// + /// If there is not enough room in the buffer or the source sequence contains invalid UTF + /// 0 is returned, and the contend of the buffer is undefined. + /// + template + CharOut *basic_convert(CharOut *buffer,size_t buffer_size,CharIn const *source_begin,CharIn const *source_end) + { + CharOut *rv = buffer; + if(buffer_size == 0) + return 0; + buffer_size --; + while(source_begin!=source_end) { + using namespace boost::locale::utf; + code_point c = utf_traits::template decode(source_begin,source_end); + if(c==illegal || c==incomplete) { + rv = 0; + break; } - *buffer++ = 0; - return rv; - } - - /// \cond INTERNAL - namespace details { - // - // wcslen defined only in C99... So we will not use it - // - template - Char const *basic_strend(Char const *s) - { - while(*s) - s++; - return s; + size_t width = utf_traits::width(c); + if(buffer_size < width) { + rv=0; + break; } + buffer = utf_traits::template encode(c,buffer); + buffer_size -= width; } - /// \endcond + *buffer++ = 0; + return rv; + } - /// - /// Convert NUL terminated UTF source string to NUL terminated \a output string of size at - /// most output_size (including NUL) - /// - /// In case of surcess output is returned, if the input sequence is illegal, - /// or there is not enough room NULL is returned - /// - inline char *convert(char *output,size_t output_size,wchar_t const *source) + /// \cond INTERNAL + namespace details { + // + // wcslen defined only in C99... So we will not use it + // + template + Char const *basic_strend(Char const *s) { - return basic_convert(output,output_size,source,details::basic_strend(source)); - } - /// - /// Convert UTF text in range [begin,end) to NUL terminated \a output string of size at - /// most output_size (including NUL) - /// - /// In case of surcess output is returned, if the input sequence is illegal, - /// or there is not enough room NULL is returned - /// - inline char *convert(char *output,size_t output_size,wchar_t const *begin,wchar_t const *end) - { - return basic_convert(output,output_size,begin,end); - } - /// - /// Convert NUL terminated UTF source string to NUL terminated \a output string of size at - /// most output_size (including NUL) - /// - /// In case of surcess output is returned, if the input sequence is illegal, - /// or there is not enough room NULL is returned - /// - inline wchar_t *convert(wchar_t *output,size_t output_size,char const *source) - { - return basic_convert(output,output_size,source,details::basic_strend(source)); - } - /// - /// Convert UTF text in range [begin,end) to NUL terminated \a output string of size at - /// most output_size (including NUL) - /// - /// In case of surcess output is returned, if the input sequence is illegal, - /// or there is not enough room NULL is returned - /// - inline wchar_t *convert(wchar_t *output,size_t output_size,char const *begin,char const *end) - { - return basic_convert(output,output_size,begin,end); + while(*s) + s++; + return s; } + } + /// \endcond + + /// + /// Convert NUL terminated UTF source string to NUL terminated \a output string of size at + /// most output_size (including NUL) + /// + /// In case of surcess output is returned, if the input sequence is illegal, + /// or there is not enough room NULL is returned + /// + inline char *convert(char *output,size_t output_size,wchar_t const *source) + { + return basic_convert(output,output_size,source,details::basic_strend(source)); + } + /// + /// Convert UTF text in range [begin,end) to NUL terminated \a output string of size at + /// most output_size (including NUL) + /// + /// In case of surcess output is returned, if the input sequence is illegal, + /// or there is not enough room NULL is returned + /// + inline char *convert(char *output,size_t output_size,wchar_t const *begin,wchar_t const *end) + { + return basic_convert(output,output_size,begin,end); + } + /// + /// Convert NUL terminated UTF source string to NUL terminated \a output string of size at + /// most output_size (including NUL) + /// + /// In case of surcess output is returned, if the input sequence is illegal, + /// or there is not enough room NULL is returned + /// + inline wchar_t *convert(wchar_t *output,size_t output_size,char const *source) + { + return basic_convert(output,output_size,source,details::basic_strend(source)); + } + /// + /// Convert UTF text in range [begin,end) to NUL terminated \a output string of size at + /// most output_size (including NUL) + /// + /// In case of surcess output is returned, if the input sequence is illegal, + /// or there is not enough room NULL is returned + /// + inline wchar_t *convert(wchar_t *output,size_t output_size,char const *begin,char const *end) + { + return basic_convert(output,output_size,begin,end); + } - /// - /// Convert between Wide - UTF-16/32 string and UTF-8 string. - /// - /// boost::locale::conv::conversion_error is thrown in a case of a error - /// - inline std::string convert(wchar_t const *s) - { - return boost::locale::conv::utf_to_utf(s); - } - /// - /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform - /// - /// boost::locale::conv::conversion_error is thrown in a case of a error - /// - inline std::wstring convert(char const *s) - { - return boost::locale::conv::utf_to_utf(s); - } - /// - /// Convert between Wide - UTF-16/32 string and UTF-8 string - /// - /// boost::locale::conv::conversion_error is thrown in a case of a error - /// - inline std::string convert(std::wstring const &s) - { - return boost::locale::conv::utf_to_utf(s); - } - /// - /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform - /// - /// boost::locale::conv::conversion_error is thrown in a case of a error - /// - inline std::wstring convert(std::string const &s) - { - return boost::locale::conv::utf_to_utf(s); - } + /// + /// Convert between Wide - UTF-16/32 string and UTF-8 string. + /// + /// boost::locale::conv::conversion_error is thrown in a case of a error + /// + inline std::string convert(wchar_t const *s) + { + return boost::locale::conv::utf_to_utf(s); + } + /// + /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform + /// + /// boost::locale::conv::conversion_error is thrown in a case of a error + /// + inline std::wstring convert(char const *s) + { + return boost::locale::conv::utf_to_utf(s); + } + /// + /// Convert between Wide - UTF-16/32 string and UTF-8 string + /// + /// boost::locale::conv::conversion_error is thrown in a case of a error + /// + inline std::string convert(std::wstring const &s) + { + return boost::locale::conv::utf_to_utf(s); + } + /// + /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform + /// + /// boost::locale::conv::conversion_error is thrown in a case of a error + /// + inline std::wstring convert(std::string const &s) + { + return boost::locale::conv::utf_to_utf(s); + } - } // nowide -} // boost +} // nowide +} // namespace boost #endif /// diff --git a/boost/nowide/cstdio.hpp b/boost/nowide/cstdio.hpp index 0938a7b..28755e6 100644 --- a/boost/nowide/cstdio.hpp +++ b/boost/nowide/cstdio.hpp @@ -90,7 +90,7 @@ inline int remove(char const *name) } #endif } // nowide -} // boost +} // namespace boost #ifdef BOOST_MSVC #pragma warning(pop) diff --git a/boost/nowide/filebuf.hpp b/boost/nowide/filebuf.hpp index fff2804..b7ddec8 100644 --- a/boost/nowide/filebuf.hpp +++ b/boost/nowide/filebuf.hpp @@ -396,7 +396,7 @@ namespace nowide { #endif // windows } // nowide -} // boost +} // namespace boost #ifdef BOOST_MSVC # pragma warning(pop) diff --git a/boost/nowide/fstream.hpp b/boost/nowide/fstream.hpp index d393f9e..07d8629 100644 --- a/boost/nowide/fstream.hpp +++ b/boost/nowide/fstream.hpp @@ -240,7 +240,7 @@ namespace nowide { #endif } // nowide -} // boost +} // namespace boost diff --git a/boost/nowide/iostream.hpp b/boost/nowide/iostream.hpp index e833184..6ab004a 100644 --- a/boost/nowide/iostream.hpp +++ b/boost/nowide/iostream.hpp @@ -21,73 +21,73 @@ namespace boost { - namespace nowide { - #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) - using std::cout; - using std::cerr; - using std::cin; - using std::clog; - #else +namespace nowide { + #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) + using std::cout; + using std::cerr; + using std::cin; + using std::clog; + #else + + /// \cond INTERNAL + namespace details { + class console_output_buffer; + class console_input_buffer; - /// \cond INTERNAL - namespace details { - class console_output_buffer; - class console_input_buffer; + class BOOST_NOWIDE_DECL winconsole_ostream : public std::ostream { + winconsole_ostream(winconsole_ostream const &); + void operator=(winconsole_ostream const &); + public: + winconsole_ostream(int fd); + ~winconsole_ostream(); + private: + boost::scoped_ptr d; + }; + + class BOOST_NOWIDE_DECL winconsole_istream : public std::istream { + winconsole_istream(winconsole_istream const &); + void operator=(winconsole_istream const &); + public: - class BOOST_NOWIDE_DECL winconsole_ostream : public std::ostream { - winconsole_ostream(winconsole_ostream const &); - void operator=(winconsole_ostream const &); - public: - winconsole_ostream(int fd); - ~winconsole_ostream(); - private: - boost::scoped_ptr d; - }; + winconsole_istream(); + ~winconsole_istream(); + private: + struct data; + boost::scoped_ptr d; + }; + } // details + + /// \endcond - class BOOST_NOWIDE_DECL winconsole_istream : public std::istream { - winconsole_istream(winconsole_istream const &); - void operator=(winconsole_istream const &); - public: - - winconsole_istream(); - ~winconsole_istream(); - private: - struct data; - boost::scoped_ptr d; - }; - } // details - - /// \endcond + /// + /// \brief Same as std::cin, but uses UTF-8 + /// + /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio + /// + extern BOOST_NOWIDE_DECL details::winconsole_istream cin; + /// + /// \brief Same as std::cout, but uses UTF-8 + /// + /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio + /// + extern BOOST_NOWIDE_DECL details::winconsole_ostream cout; + /// + /// \brief Same as std::cerr, but uses UTF-8 + /// + /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio + /// + extern BOOST_NOWIDE_DECL details::winconsole_ostream cerr; + /// + /// \brief Same as std::clog, but uses UTF-8 + /// + /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio + /// + extern BOOST_NOWIDE_DECL details::winconsole_ostream clog; - /// - /// \brief Same as std::cin, but uses UTF-8 - /// - /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio - /// - extern BOOST_NOWIDE_DECL details::winconsole_istream cin; - /// - /// \brief Same as std::cout, but uses UTF-8 - /// - /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio - /// - extern BOOST_NOWIDE_DECL details::winconsole_ostream cout; - /// - /// \brief Same as std::cerr, but uses UTF-8 - /// - /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio - /// - extern BOOST_NOWIDE_DECL details::winconsole_ostream cerr; - /// - /// \brief Same as std::clog, but uses UTF-8 - /// - /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio - /// - extern BOOST_NOWIDE_DECL details::winconsole_ostream clog; + #endif - #endif - - } // nowide -} // boost +} // nowide +} // namespace boost #ifdef BOOST_MSVC # pragma warning(pop) diff --git a/boost/nowide/stackstring.hpp b/boost/nowide/stackstring.hpp index 6125624..948a22f 100644 --- a/boost/nowide/stackstring.hpp +++ b/boost/nowide/stackstring.hpp @@ -11,7 +11,7 @@ #include #include -namespace boost{ +namespace boost { namespace nowide { /// @@ -30,34 +30,34 @@ public: typedef CharIn input_char; basic_stackstring(basic_stackstring const &other) : - mem_buffer_(0) + mem_buffer_(0) { - clear(); - if(other.mem_buffer_) { - size_t len = 0; - while(other.mem_buffer_[len]) - len ++; - mem_buffer_ = new output_char[len + 1]; - memcpy(mem_buffer_,other.mem_buffer_,sizeof(output_char) * (len+1)); - } - else { - memcpy(buffer_,other.buffer_,buffer_size * sizeof(output_char)); - } + clear(); + if(other.mem_buffer_) { + size_t len = 0; + while(other.mem_buffer_[len]) + len ++; + mem_buffer_ = new output_char[len + 1]; + memcpy(mem_buffer_,other.mem_buffer_,sizeof(output_char) * (len+1)); + } + else { + memcpy(buffer_,other.buffer_,buffer_size * sizeof(output_char)); + } } void swap(basic_stackstring &other) { - std::swap(mem_buffer_,other.mem_buffer_); - for(size_t i=0;i short_stackstring; } // nowide -} // boost +} // namespace boost #endif /// diff --git a/boost/nowide/system.hpp b/boost/nowide/system.hpp index eb0a268..a1fc975 100644 --- a/boost/nowide/system.hpp +++ b/boost/nowide/system.hpp @@ -38,8 +38,8 @@ inline int system(char const *cmd) } #endif -} // boost } // nowide +} // namespace boost #endif /// diff --git a/libs/nowide/doc/main.txt b/libs/nowide/doc/main.txt index c036a09..34638ad 100644 --- a/libs/nowide/doc/main.txt +++ b/libs/nowide/doc/main.txt @@ -33,6 +33,10 @@ Boost.Nowide is a library implemented by Artyom Beilis that make cross platform Unicode aware programming easier. +The library provides an implementation of standard C and C++ library +functions, such that their inputs are UTF-8 aware on Windows without +requiring to use Wide API. + \subsection main_rationale Rationale @@ -132,7 +136,7 @@ int main(int argc,char **argv) } int total_lines = 0 while(f) { - if(f.get() == '\n) + if(f.get() == '\n') total_lines++; } f.close(); @@ -165,7 +169,7 @@ int main(int argc,char **argv) } int total_lines = 0 while(f) { - if(f.get() == '\n) + if(f.get() == '\n') total_lines++; } f.close(); diff --git a/libs/nowide/src/iostream.cpp b/libs/nowide/src/iostream.cpp index 3882143..b68945a 100644 --- a/libs/nowide/src/iostream.cpp +++ b/libs/nowide/src/iostream.cpp @@ -254,7 +254,7 @@ namespace { } // nowide -} // boost +} // namespace boost #endif ///