Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Apr 22, 2020
2 parents ae5e46b + 360e55f commit ac0da0f
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 17 deletions.
6 changes: 3 additions & 3 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.

INPUT = ../include/boost/nowide ../include/boost/nowide/integration ../src .
INPUT = ../include/boost/nowide ../src .

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
Expand All @@ -576,7 +576,7 @@ INPUT_ENCODING = UTF-8
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90

FILE_PATTERNS = *.cpp *.hpp *.md
FILE_PATTERNS = *.cpp *.hpp *.md *.dox

# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
Expand Down Expand Up @@ -610,7 +610,7 @@ EXCLUDE_PATTERNS =
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test

EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = boost::nowide::detail

# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
Expand Down
2 changes: 1 addition & 1 deletion doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ path-constant here : . ;
.doxygen = [ doxygen.name ] ;
.doxygen ?= doxygen ;

local sources = [ path.glob-tree ../include/boost/nowide : *.hpp : detail ] main.md ;
local sources = [ path.glob-tree ../include/boost/nowide : *.hpp : detail ] main.dox changelog.dox ;

make html : ./Doxyfile : @make-html : <dependency>$(sources) ;

Expand Down
22 changes: 22 additions & 0 deletions doc/changelog.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Copyright (c) 2019-2020 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

/*! \page changelog_page Changelog

\section changelog Changelog

\subsection changelog_10_0_1 Nowide 10.0.1 (Boost 1.73)

- IMPORTANT: C++03 support is deprecated and will be removed in the next Boost release
- Fix -Wctor-dtor-privacy warning in trait

\subsection changelog_10_0_0 Nowide 10.0.0

- Initial Release

*/
6 changes: 5 additions & 1 deletion doc/main.md → doc/main.dox
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

\mainpage Boost.Nowide

\ref changelog_page

Table of Contents:

- \ref main
Expand Down Expand Up @@ -308,7 +310,7 @@ There is also a \c std::filebuf compatible implementation provided for Windows w
for \c open and behaves otherwise identical (API-wise).

On all systems the \c std::fstream class and friends are provided as custom implementations supporting
\c std::string and \c \*::filesystem::path as well as \c wchar_t\* (Windows only) overloads for the
\c std::string and \c \*\::filesystem::path as well as \c wchar_t\* (Windows only) overloads for the
constructor and \c open.
This is done so users can use e.g. \c boost::filesystem::path with \c boost::nowide::fstream without
depending on C++17 support.
Expand Down Expand Up @@ -422,3 +424,5 @@ The upstream sources can be found at GitHub: <a href="https://github.com/boostor
You can download the latest sources there:

- Standard Version: <a href="https://github.com/boostorg/nowide/archive/master.zip">nowide-master.zip</a>

*/
8 changes: 8 additions & 0 deletions include/boost/nowide/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <boost/nowide/replacement.hpp>
#include <boost/version.hpp>

//! @cond Doxygen_Suppress

#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
#ifdef BOOST_NOWIDE_SOURCE
#define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT
Expand Down Expand Up @@ -46,6 +48,8 @@
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled

//! @endcond

/// @def BOOST_NOWIDE_USE_WCHAR_OVERLOADS
/// @brief Whether to use the wchar_t* overloads in fstream/filebuf
/// Enabled on Windows and Cygwin as the latter may use wchar_t in filesystem::path
Expand Down Expand Up @@ -73,6 +77,8 @@
#define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 0
#endif

//! @cond Doxygen_Suppress

#if BOOST_VERSION < 106500 && defined(BOOST_GCC) && __GNUC__ >= 7
#define BOOST_NOWIDE_FALLTHROUGH __attribute__((fallthrough))
#else
Expand All @@ -88,6 +94,8 @@
#define BOOST_NOWIDE_CXX11 0
#endif

//! @endcond

namespace boost {
///
/// \brief This namespace includes implementations of the standard library functions and
Expand Down
6 changes: 3 additions & 3 deletions include/boost/nowide/convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ namespace nowide {
///
/// Convert wide string (UTF-16/32) to narrow string (UTF-8).
///
/// \param s Input string
/// \param count Number of characters to convert
/// \param s NULL terminated input string
/// Any illegal sequences are replaced with the replacement character, see #BOOST_NOWIDE_REPLACEMENT_CHARACTER
///
Expand All @@ -97,7 +95,8 @@ namespace nowide {
///
/// Convert narrow string (UTF-8) to wide string (UTF-16/32).
///
/// \param s NULL terminated input string
/// \param s Input string
/// \param count Number of characters to convert
/// Any illegal sequences are replaced with the replacement character, see #BOOST_NOWIDE_REPLACEMENT_CHARACTER
///
inline std::wstring widen(const char* s, size_t count)
Expand All @@ -107,6 +106,7 @@ namespace nowide {
///
/// Convert narrow string (UTF-8) to wide string (UTF-16/32).
///
/// \param s NULL terminated input string
/// Any illegal sequences are replaced with the replacement character, see #BOOST_NOWIDE_REPLACEMENT_CHARACTER
///
inline std::wstring widen(const char* s)
Expand Down
10 changes: 5 additions & 5 deletions include/boost/nowide/fstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,17 @@ namespace nowide {
typedef basic_filebuf<char> filebuf;
///
/// Same as std::ifstream but accepts UTF-8 strings under Windows
/// and *::filesystem::path on all systems
/// and *\::filesystem::path on all systems
///
typedef basic_ifstream<char> ifstream;
///
/// Same as std::ofstream but accepts UTF-8 strings under Windows
/// and *::filesystem::path on all systems
/// and *\::filesystem::path on all systems
///
typedef basic_ofstream<char> ofstream;
///
/// Same as std::fstream but accepts UTF-8 strings under Windows
/// and *::filesystem::path on all systems
/// and *\::filesystem::path on all systems
///
typedef basic_fstream<char> fstream;

Expand Down Expand Up @@ -364,7 +364,7 @@ namespace nowide {
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
/// Trait to heuristically check for a *::filesystem::path
/// Trait to heuristically check for a *\::filesystem::path
/// Done by checking for make_preferred and filename member functions with correct signature
template<typename T>
struct is_path
Expand Down Expand Up @@ -395,7 +395,7 @@ namespace nowide {
{
typedef T type;
};
/// SFINAE trait which has a member "type = Result" if the Path is a *::filesystem::path
/// SFINAE trait which has a member "type = Result" if the Path is a *\::filesystem::path
template<typename Path, typename Result>
struct enable_if_path : enable_if<is_path<Path>::value, Result>
{};
Expand Down
20 changes: 18 additions & 2 deletions include/boost/nowide/stackstring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,36 @@ namespace nowide {
class basic_stackstring
{
public:
/// Size of the stack buffer
static const size_t buffer_size = BufferSize;
/// Type of the output character (converted to)
typedef CharOut output_char;
/// Type of the input character (converted from)
typedef CharIn input_char;

/// Creates a NULL stackstring
basic_stackstring() : data_(NULL)
{
buffer_[0] = 0;
}
/// Convert the NULL terminated string input and store in internal buffer
/// If input is NULL, nothing will be stored
explicit basic_stackstring(const input_char* input) : data_(NULL)
{
convert(input);
}
/// Convert the sequence [begin, end) and store in internal buffer
/// If begin is NULL, nothing will be stored
basic_stackstring(const input_char* begin, const input_char* end) : data_(NULL)
{
convert(begin, end);
}

/// Copy construct from other
basic_stackstring(const basic_stackstring& other) : data_(NULL)
{
*this = other;
}
/// Copy assign from other
basic_stackstring& operator=(const basic_stackstring& other)
{
if(this != &other)
Expand All @@ -77,13 +86,17 @@ namespace nowide {
clear();
}

/// Convert the NULL terminated string input and store in internal buffer
/// If input is NULL, the current buffer will be reset to NULL
output_char* convert(const input_char* input)
{
if(input)
return convert(input, input + detail::strlen(input));
clear();
return get();
}
/// Convert the sequence [begin, end) and store in internal buffer
/// If begin is NULL, the current buffer will be reset to NULL
output_char* convert(const input_char* begin, const input_char* end)
{
clear();
Expand Down Expand Up @@ -119,13 +132,14 @@ namespace nowide {
{
return data_;
}
/// Reset the internal buffer to NULL
void clear()
{
if(!uses_stack_memory())
delete[] data_;
data_ = NULL;
}

/// Swap lhs with rhs
friend void swap(basic_stackstring& lhs, basic_stackstring& rhs)
{
if(lhs.uses_stack_memory())
Expand Down Expand Up @@ -157,6 +171,8 @@ namespace nowide {
{
return data_ == buffer_;
}
/// Return the current length of the string excluding the NULL terminator
/// If NULL is stored returns NULL
size_t length() const
{
if(!data_)
Expand Down
4 changes: 2 additions & 2 deletions include/boost/nowide/utf8_codecvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
namespace boost {
namespace nowide {

//
// Make sure that mbstate can keep 16 bit of UTF-16 sequence
//
BOOST_STATIC_ASSERT(sizeof(std::mbstate_t) >= 2);
namespace detail {
// Avoid including cstring for std::memcpy
Expand Down Expand Up @@ -56,6 +54,7 @@ namespace nowide {
template<typename CharType, int CharSize = sizeof(CharType)>
class utf8_codecvt;

/// Specialization for the UTF-8 <-> UTF-16 variant of the std::codecvt implementation
template<typename CharType>
class BOOST_SYMBOL_VISIBLE utf8_codecvt<CharType, 2> : public std::codecvt<CharType, char, std::mbstate_t>
{
Expand Down Expand Up @@ -289,6 +288,7 @@ namespace nowide {
}
};

/// Specialization for the UTF-8 <-> UTF-32 variant of the std::codecvt implementation
template<typename CharType>
class BOOST_SYMBOL_VISIBLE utf8_codecvt<CharType, 4> : public std::codecvt<CharType, char, std::mbstate_t>
{
Expand Down
2 changes: 2 additions & 0 deletions src/iostream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

namespace boost {
namespace nowide {
/// Avoid empty compilation unit warnings
/// \internal
BOOST_NOWIDE_DECL void dummy_exported_function()
{}
} // namespace nowide
Expand Down

0 comments on commit ac0da0f

Please sign in to comment.