Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
int main() {}"
GCC_IS_GCC4)

set(CXX_FLAGS "-Wall -Wextra")
set(CXX_FLAGS "-Wall -Wextra -std=c++14")
set(C_FLAGS "-Wall -Wextra")

if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
Expand Down
2 changes: 1 addition & 1 deletion booster/booster/aio/io_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace aio {
private:
struct data;
hold_ptr<data> d;
std::auto_ptr<event_loop_impl> impl_;
std::unique_ptr<event_loop_impl> impl_;
};

} // aio
Expand Down
2 changes: 1 addition & 1 deletion booster/booster/aio/reactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace aio {
///
std::string name() const;
private:
std::auto_ptr<reactor_impl> impl_;
std::unique_ptr<reactor_impl> impl_;
};
} // aio
} // booster
Expand Down
52 changes: 4 additions & 48 deletions booster/booster/bad_weak_ptr.h
Original file line number Diff line number Diff line change
@@ -1,56 +1,12 @@
#ifndef BOOSTER_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
#define BOOSTER_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED

//
// boost/smart_ptr/bad_weak_ptr.hpp
//
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
//
// 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)
//
#include <memory>

#include <booster/backtrace.h>
namespace booster {

#ifdef __BORLANDC__
# pragma warn -8026 // Functions with excep. spec. are not expanded inline
#endif
using bad_weak_ptr = std::bad_weak_ptr;

namespace booster
{

// The standard library that comes with Borland C++ 5.5.1, 5.6.4
// defines std::exception and its members as having C calling
// convention (-pc). When the definition of bad_weak_ptr
// is compiled with -ps, the compiler issues an error.
// Hence, the temporary #pragma option -pc below.

#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
# pragma option push -pc
#endif

///
/// An exeption that is throws in case of creating of shared_ptr from expired weak_ptr
///
class bad_weak_ptr: public booster::exception
{
public:

virtual char const * what() const throw()
{
return "booster::bad_weak_ptr";
}
};

#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
# pragma option pop
#endif

} // namespace boost

#ifdef __BORLANDC__
# pragma warn .8026 // Functions with excep. spec. are not expanded inline
#endif
} // namespace booster

#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
4 changes: 2 additions & 2 deletions booster/booster/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ namespace booster {
{} \
\
template<typename Call> \
callback(std::auto_ptr<Call> ptr) : call_ptr(ptr.release()) \
callback(std::unique_ptr<Call> ptr) : call_ptr(ptr.release()) \
{} \
\
template<typename Call> \
callback const &operator=(intrusive_ptr<Call> c) \
{ call_ptr = c; return *this; } \
\
template<typename Call> \
callback const &operator=(std::auto_ptr<Call> c) \
callback const &operator=(std::unique_ptr<Call> c) \
{ call_ptr = 0; call_ptr = c.release(); return *this; } \
\
template<typename F> \
Expand Down
77 changes: 2 additions & 75 deletions booster/booster/enable_shared_from_this.h
Original file line number Diff line number Diff line change
@@ -1,84 +1,11 @@
#ifndef BOOSTER_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
#define BOOSTER_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED

//
// enable_shared_from_this.hpp
//
// Copyright 2002, 2009 Peter Dimov
//
// 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
//
// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
//

#include <booster/weak_ptr.h>
#include <booster/shared_ptr.h>
#include <assert.h>
#include <booster/config.h>

namespace booster
{

///
/// \brief This class is borrowed from boost
///
/// For details see: http://www.boost.org/doc/libs/release/libs/smart_ptr
///

template<class T> class enable_shared_from_this
{
protected:

enable_shared_from_this()
{
}

enable_shared_from_this(enable_shared_from_this const &)
{
}

enable_shared_from_this & operator=(enable_shared_from_this const &)
{
return *this;
}

~enable_shared_from_this()
{
}

public:

shared_ptr<T> shared_from_this()
{
shared_ptr<T> p( weak_this_ );
assert( p.get() == this );
return p;
}

shared_ptr<T const> shared_from_this() const
{
shared_ptr<T const> p( weak_this_ );
assert( p.get() == this );
return p;
}

public: // actually private, but avoids compiler template friendship issues

// Note: invoked automatically by shared_ptr; do not call
template<class X, class Y> void _internal_accept_owner( shared_ptr<X> const * ppx, Y * py ) const
{
if( weak_this_.expired() )
{
weak_this_ = shared_ptr<T>( *ppx, py );
}
}

private:

mutable weak_ptr<T> weak_this_;
};
template<class T>
using enable_shared_from_this = std::enable_shared_from_this<T>;

} // namespace boost

Expand Down
2 changes: 1 addition & 1 deletion booster/booster/locale/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace booster {

std::ios_base &ios_;
struct data;
std::auto_ptr<data> d;
std::unique_ptr<data> d;
};

}
Expand Down
6 changes: 3 additions & 3 deletions booster/booster/locale/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

namespace booster {

template<typename Type>
class shared_ptr;
template <typename T>
using shared_ptr = std::shared_ptr<T>;

///
/// \brief This is the main namespace that encloses all localization classes
Expand Down Expand Up @@ -220,7 +220,7 @@ namespace booster {
void operator=(generator const &);

struct data;
std::auto_ptr<data> d;
std::unique_ptr<data> d;
};

}
Expand Down
2 changes: 1 addition & 1 deletion booster/booster/locale/generic_codecvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class generic_codecvt_base {
/// {
/// UErrorCode err = U_ZERO_ERROR;
/// state_type ptr(ucnv_safeClone(converter_,0,0,&err,ucnv_close);
/// return std::move(ptr);
/// return ptr;
/// }
///
/// boost::locale::utf::code_point to_unicode(state_type &ptr,char const *&begin,char const *end) const
Expand Down
6 changes: 3 additions & 3 deletions booster/booster/locale/localization_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ namespace booster {
///
/// Create new localization backend according to current settings.
///
std::auto_ptr<localization_backend> get() const;
std::unique_ptr<localization_backend> get() const;

///
/// Add new backend to the manager, each backend should be uniquely defined by its name.
///
/// This library provides: "icu", "posix", "winapi" and "std" backends.
///
void add_backend(std::string const &name,std::auto_ptr<localization_backend> backend);
void add_backend(std::string const &name,std::unique_ptr<localization_backend> backend);

///
/// Clear backend
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace booster {
static localization_backend_manager global();
private:
class impl;
std::auto_ptr<impl> pimpl_;
std::unique_ptr<impl> pimpl_;
};

} // locale
Expand Down
8 changes: 4 additions & 4 deletions booster/booster/locale/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ namespace util {
/// This function creates a \a base_converter that can be used for conversion between UTF-8 and
/// unicode code points
///
BOOSTER_API std::auto_ptr<base_converter> create_utf8_converter();
BOOSTER_API std::unique_ptr<base_converter> create_utf8_converter();
///
/// This function creates a \a base_converter that can be used for conversion between single byte
/// character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points,
///
/// If \a encoding is not supported, empty pointer is returned. You should check if
/// std::auto_ptr<base_converter>::get() != 0
/// std::unique_ptr<base_converter>::get() != 0
///
BOOSTER_API std::auto_ptr<base_converter> create_simple_converter(std::string const &encoding);
BOOSTER_API std::unique_ptr<base_converter> create_simple_converter(std::string const &encoding);


///
Expand All @@ -199,7 +199,7 @@ namespace util {
/// of wide encoding type
///
BOOSTER_API
std::locale create_codecvt(std::locale const &in,std::auto_ptr<base_converter> cvt,character_facet_type type);
std::locale create_codecvt(std::locale const &in,std::unique_ptr<base_converter> cvt,character_facet_type type);

///
/// Install utf8 codecvt to UTF-16 or UTF-32 into locale \a in and return
Expand Down
12 changes: 7 additions & 5 deletions booster/booster/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

namespace booster {

template<typename T>
class shared_ptr;
template<typename T>
class weak_ptr;
template <typename T>
using shared_ptr = std::shared_ptr<T>;

template <typename T>
using weak_ptr = std::weak_ptr<T>;


///
/// \brief This namespace includes Booster.Log related classes
Expand Down Expand Up @@ -104,7 +106,7 @@ namespace log {
char const *file_name_;
int file_line_;

std::auto_ptr<std::ostringstream> message_;
std::unique_ptr<std::ostringstream> message_;

struct data;
copy_ptr<data> d;
Expand Down
9 changes: 4 additions & 5 deletions booster/booster/nowide/fstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ namespace nowide {
return 0;
}
}
std::auto_ptr<io_device> dev(new details::stdio_iodev(f));
device(dev);
device(std::unique_ptr<io_device>(new details::stdio_iodev(f)));
opened_ = true;
return this;
}
Expand Down Expand Up @@ -272,7 +271,7 @@ namespace nowide {
}

private:
std::auto_ptr<internal_buffer_type> buf_;
std::unique_ptr<internal_buffer_type> buf_;
};

///
Expand Down Expand Up @@ -332,7 +331,7 @@ namespace nowide {
}

private:
std::auto_ptr<internal_buffer_type> buf_;
std::unique_ptr<internal_buffer_type> buf_;
};

///
Expand Down Expand Up @@ -392,7 +391,7 @@ namespace nowide {
}

private:
std::auto_ptr<internal_buffer_type> buf_;
std::unique_ptr<internal_buffer_type> buf_;
};


Expand Down
Loading