mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Use deleted members to prevent copying in Beast (RIPD-268)
This commit is contained in:
committed by
Vinnie Falco
parent
7933e5d1f9
commit
45b5c4ba7a
@@ -1091,8 +1091,6 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\threads\WaitableEvent.h">
|
<ClInclude Include="..\..\src\beast\beast\threads\WaitableEvent.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\Uncopyable.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\unit_test.h">
|
<ClInclude Include="..\..\src\beast\beast\unit_test.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\unit_test\amount.h">
|
<ClInclude Include="..\..\src\beast\beast\unit_test\amount.h">
|
||||||
|
|||||||
@@ -1848,9 +1848,6 @@
|
|||||||
<ClInclude Include="..\..\src\beast\beast\threads\WaitableEvent.h">
|
<ClInclude Include="..\..\src\beast\beast\threads\WaitableEvent.h">
|
||||||
<Filter>beast\threads</Filter>
|
<Filter>beast\threads</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\Uncopyable.h">
|
|
||||||
<Filter>beast</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\unit_test.h">
|
<ClInclude Include="..\..\src\beast\beast\unit_test.h">
|
||||||
<Filter>beast</Filter>
|
<Filter>beast</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#define BEAST_BYTEORDER_H_INCLUDED
|
#define BEAST_BYTEORDER_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Config.h>
|
#include <beast/Config.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ namespace beast {
|
|||||||
/** Contains static methods for converting the byte order between different
|
/** Contains static methods for converting the byte order between different
|
||||||
endiannesses.
|
endiannesses.
|
||||||
*/
|
*/
|
||||||
class ByteOrder : public Uncopyable
|
class ByteOrder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -105,6 +104,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ByteOrder();
|
ByteOrder();
|
||||||
|
ByteOrder(ByteOrder const&) = delete;
|
||||||
|
ByteOrder& operator= (ByteOrder const&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <beast/Memory.h>
|
#include <beast/Memory.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
// If the MSVC debug heap headers were included, disable
|
// If the MSVC debug heap headers were included, disable
|
||||||
// the macros during the juce include since they conflict.
|
// the macros during the juce include since they conflict.
|
||||||
@@ -122,7 +121,7 @@ namespace HeapBlockHelper
|
|||||||
@see Array, MemoryBlock
|
@see Array, MemoryBlock
|
||||||
*/
|
*/
|
||||||
template <class ElementType, bool throwOnFailure = false>
|
template <class ElementType, bool throwOnFailure = false>
|
||||||
class HeapBlock : public Uncopyable
|
class HeapBlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -136,12 +135,6 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapBlock (HeapBlock& other)
|
|
||||||
{
|
|
||||||
data = other.data;
|
|
||||||
other.data = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Creates a HeapBlock containing a number of elements.
|
/** Creates a HeapBlock containing a number of elements.
|
||||||
|
|
||||||
The contents of the block are undefined, as it will have been created by a
|
The contents of the block are undefined, as it will have been created by a
|
||||||
@@ -169,6 +162,10 @@ public:
|
|||||||
throwOnAllocationFailure();
|
throwOnAllocationFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HeapBlock(HeapBlock const&) = delete;
|
||||||
|
HeapBlock& operator= (HeapBlock const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
This will free the data, if any has been allocated.
|
This will free the data, if any has been allocated.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <beast/Config.h>
|
#include <beast/Config.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -78,12 +77,16 @@ Type* createCopyIfNotNull (const Type* pointer)
|
|||||||
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII.
|
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII.
|
||||||
You should use the BEAST_AUTORELEASEPOOL macro to create a local auto-release pool on the stack.
|
You should use the BEAST_AUTORELEASEPOOL macro to create a local auto-release pool on the stack.
|
||||||
*/
|
*/
|
||||||
class ScopedAutoReleasePool : public Uncopyable
|
class ScopedAutoReleasePool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScopedAutoReleasePool();
|
ScopedAutoReleasePool();
|
||||||
~ScopedAutoReleasePool();
|
~ScopedAutoReleasePool();
|
||||||
|
|
||||||
|
|
||||||
|
ScopedAutoReleasePool(ScopedAutoReleasePool const&) = delete;
|
||||||
|
ScopedAutoReleasePool& operator= (ScopedAutoReleasePool const&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void* pool;
|
void* pool;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_UNCOPYABLE_H_INCLUDED
|
|
||||||
#define BEAST_UNCOPYABLE_H_INCLUDED
|
|
||||||
|
|
||||||
namespace beast
|
|
||||||
{
|
|
||||||
|
|
||||||
// Ideas from boost
|
|
||||||
|
|
||||||
/** Prevent copy construction and assignment.
|
|
||||||
|
|
||||||
This is used to suppress warnings and prevent unsafe operations on
|
|
||||||
objects which cannot be passed by value. Ideas based on Boost.
|
|
||||||
|
|
||||||
For example, instead of
|
|
||||||
|
|
||||||
@code
|
|
||||||
|
|
||||||
class MyClass
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//...
|
|
||||||
|
|
||||||
private:
|
|
||||||
MyClass (const MyClass&);
|
|
||||||
MyClass& operator= (const MyClass&);
|
|
||||||
};
|
|
||||||
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
..you can just write:
|
|
||||||
|
|
||||||
@code
|
|
||||||
|
|
||||||
class MyClass : public Uncopyable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//...
|
|
||||||
};
|
|
||||||
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
@note The derivation should be public or else child classes which
|
|
||||||
also derive from Uncopyable may not compile.
|
|
||||||
*/
|
|
||||||
class Uncopyable
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
Uncopyable () { }
|
|
||||||
~Uncopyable () { }
|
|
||||||
|
|
||||||
private:
|
|
||||||
Uncopyable (Uncopyable const&);
|
|
||||||
Uncopyable const& operator= (Uncopyable const&);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
#define BEAST_INTRUSIVE_LIST_H_INCLUDED
|
#define BEAST_INTRUSIVE_LIST_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Config.h>
|
#include <beast/Config.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -265,7 +264,7 @@ private:
|
|||||||
@ingroup beast_core intrusive
|
@ingroup beast_core intrusive
|
||||||
*/
|
*/
|
||||||
template <typename T, typename Tag = void>
|
template <typename T, typename Tag = void>
|
||||||
class List : public Uncopyable
|
class List
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename detail::ListNode <T, Tag> Node;
|
typedef typename detail::ListNode <T, Tag> Node;
|
||||||
@@ -289,6 +288,9 @@ public:
|
|||||||
clear ();
|
clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List(List const&) = delete;
|
||||||
|
List& operator= (List const&) = delete;
|
||||||
|
|
||||||
/** Determine if the list is empty.
|
/** Determine if the list is empty.
|
||||||
@return `true` if the list is empty.
|
@return `true` if the list is empty.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#define BEAST_INTRUSIVE_LOCKFREESTACK_H_INCLUDED
|
#define BEAST_INTRUSIVE_LOCKFREESTACK_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Atomic.h>
|
#include <beast/Atomic.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -142,15 +141,16 @@ bool operator!= (LockFreeStackIterator <Container, LhsIsConst> const& lhs,
|
|||||||
omitted, the default tag is used.
|
omitted, the default tag is used.
|
||||||
*/
|
*/
|
||||||
template <class Element, class Tag = void>
|
template <class Element, class Tag = void>
|
||||||
class LockFreeStack : public Uncopyable
|
class LockFreeStack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class Node : public Uncopyable
|
class Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Node ()
|
Node () = default;
|
||||||
{
|
|
||||||
}
|
Node(Node const&) = delete;
|
||||||
|
Node& operator= (Node const&) = delete;
|
||||||
|
|
||||||
explicit Node (Node* next) : m_next (next)
|
explicit Node (Node* next) : m_next (next)
|
||||||
{
|
{
|
||||||
@@ -184,6 +184,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LockFreeStack(LockFreeStack const&) = delete;
|
||||||
|
LockFreeStack& operator= (LockFreeStack const&) = delete;
|
||||||
|
|
||||||
/** Returns true if the stack is empty. */
|
/** Returns true if the stack is empty. */
|
||||||
bool empty() const
|
bool empty() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#ifndef BEAST_ASIO_BASICS_SSLCONTEXT_H_INCLUDED
|
#ifndef BEAST_ASIO_BASICS_SSLCONTEXT_H_INCLUDED
|
||||||
#define BEAST_ASIO_BASICS_SSLCONTEXT_H_INCLUDED
|
#define BEAST_ASIO_BASICS_SSLCONTEXT_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
#include <boost/asio/ssl/context.hpp>
|
#include <boost/asio/ssl/context.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -29,7 +28,7 @@ namespace asio {
|
|||||||
/** Simple base class for passing a context around.
|
/** Simple base class for passing a context around.
|
||||||
This lets derived classes hide their implementation from the headers.
|
This lets derived classes hide their implementation from the headers.
|
||||||
*/
|
*/
|
||||||
class SSLContext : public Uncopyable
|
class SSLContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~SSLContext ();
|
virtual ~SSLContext ();
|
||||||
@@ -61,6 +60,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
explicit SSLContext (ContextType& context);
|
explicit SSLContext (ContextType& context);
|
||||||
|
|
||||||
|
SSLContext(SSLContext const&) = delete;
|
||||||
|
SSLContext& operator= (SSLContext const&) = delete;
|
||||||
|
|
||||||
ContextType& m_context;
|
ContextType& m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
namespace beast {
|
namespace beast {
|
||||||
namespace asio {
|
namespace asio {
|
||||||
|
|
||||||
class HTTPClientType : public HTTPClientBase, public Uncopyable
|
class HTTPClientType : public HTTPClientBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class Session;
|
class Session;
|
||||||
@@ -61,6 +61,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HTTPClientType(HTTPClientType const&) = delete;
|
||||||
|
HTTPClientType& operator= (HTTPClientType const&) = delete;
|
||||||
|
|
||||||
~HTTPClientType ()
|
~HTTPClientType ()
|
||||||
{
|
{
|
||||||
cancel();
|
cancel();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace beast
|
|||||||
@endcode
|
@endcode
|
||||||
*/
|
*/
|
||||||
template <class ObjectType>
|
template <class ObjectType>
|
||||||
class LinkedListPointer : public Uncopyable
|
class LinkedListPointer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -65,6 +65,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinkedListPointer(LinkedListPointer const&) = delete;
|
||||||
|
LinkedListPointer& operator= (LinkedListPointer const&) = delete;
|
||||||
|
|
||||||
/** Creates a pointer to a list whose head is the item provided. */
|
/** Creates a pointer to a list whose head is the item provided. */
|
||||||
explicit LinkedListPointer (ObjectType* const headItem) noexcept
|
explicit LinkedListPointer (ObjectType* const headItem) noexcept
|
||||||
: item (headItem)
|
: item (headItem)
|
||||||
@@ -332,7 +335,7 @@ public:
|
|||||||
list, and then repeatedly call Appender::append() to add items to the end
|
list, and then repeatedly call Appender::append() to add items to the end
|
||||||
of the list in O(1) time.
|
of the list in O(1) time.
|
||||||
*/
|
*/
|
||||||
class Appender : public Uncopyable
|
class Appender
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an appender which will add items to the given list.
|
/** Creates an appender which will add items to the given list.
|
||||||
@@ -344,6 +347,9 @@ public:
|
|||||||
bassert (endOfListPointer.item == nullptr);
|
bassert (endOfListPointer.item == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Appender(LinkedListPointer const&) = delete;
|
||||||
|
Appender& operator= (Appender const&) = delete;
|
||||||
|
|
||||||
/** Appends an item to the list. */
|
/** Appends an item to the list. */
|
||||||
void append (ObjectType* const newItem) noexcept
|
void append (ObjectType* const newItem) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace beast
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
template <typename ValueType>
|
template <typename ValueType>
|
||||||
class ScopedValueSetter : public Uncopyable
|
class ScopedValueSetter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a ScopedValueSetter that will immediately change the specified value to the
|
/** Creates a ScopedValueSetter that will immediately change the specified value to the
|
||||||
@@ -80,6 +80,9 @@ public:
|
|||||||
valueToSet = newValue;
|
valueToSet = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScopedValueSetter(ScopedValueSetter const&) = delete;
|
||||||
|
ScopedValueSetter& operator= (ScopedValueSetter const&) = delete;
|
||||||
|
|
||||||
~ScopedValueSetter()
|
~ScopedValueSetter()
|
||||||
{
|
{
|
||||||
value = originalValue;
|
value = originalValue;
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
// New header-only library modeled more closely according to boost
|
// New header-only library modeled more closely according to boost
|
||||||
#include <beast/SmartPtr.h>
|
#include <beast/SmartPtr.h>
|
||||||
#include <beast/StaticAssert.h>
|
#include <beast/StaticAssert.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
#include <beast/Atomic.h>
|
#include <beast/Atomic.h>
|
||||||
#include <beast/Arithmetic.h>
|
#include <beast/Arithmetic.h>
|
||||||
#include <beast/ByteOrder.h>
|
#include <beast/ByteOrder.h>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace beast
|
|||||||
the process is terminated, a listener object gets notified so that the
|
the process is terminated, a listener object gets notified so that the
|
||||||
client application can perform logging or emit further diagnostics.
|
client application can perform logging or emit further diagnostics.
|
||||||
*/
|
*/
|
||||||
class FatalError : public Uncopyable
|
class FatalError
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Reporter
|
struct Reporter
|
||||||
@@ -145,6 +145,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
FatalError (char const* message, char const* filePath, int lineNumber);
|
FatalError (char const* message, char const* filePath, int lineNumber);
|
||||||
|
|
||||||
|
FatalError(FatalError const&) = delete;
|
||||||
|
FatalError& operator= (FatalError const&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Reporter* s_reporter;
|
static Reporter* s_reporter;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace beast {
|
|||||||
|
|
||||||
It can also guess how far it's got using a wildly inaccurate algorithm.
|
It can also guess how far it's got using a wildly inaccurate algorithm.
|
||||||
*/
|
*/
|
||||||
class DirectoryIterator : LeakChecked <DirectoryIterator>, public Uncopyable
|
class DirectoryIterator : LeakChecked <DirectoryIterator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -72,6 +72,9 @@ public:
|
|||||||
const String& wildCard = "*",
|
const String& wildCard = "*",
|
||||||
int whatToLookFor = File::findFiles);
|
int whatToLookFor = File::findFiles);
|
||||||
|
|
||||||
|
DirectoryIterator(DirectoryIterator const&) = delete;
|
||||||
|
DirectoryIterator& operator= (DirectoryIterator const&) = delete;
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~DirectoryIterator();
|
~DirectoryIterator();
|
||||||
|
|
||||||
@@ -116,10 +119,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class NativeIterator : LeakChecked <NativeIterator>, public Uncopyable
|
class NativeIterator : LeakChecked <NativeIterator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NativeIterator (const File& directory, const String& wildCard);
|
NativeIterator (const File& directory, const String& wildCard);
|
||||||
|
|
||||||
|
NativeIterator(NativeIterator const&) = delete;
|
||||||
|
NativeIterator& operator= (NativeIterator const&) = delete;
|
||||||
|
|
||||||
~NativeIterator();
|
~NativeIterator();
|
||||||
|
|
||||||
bool next (String& filenameFound,
|
bool next (String& filenameFound,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace beast
|
|||||||
|
|
||||||
@see FileInputStream, FileOutputStream
|
@see FileInputStream, FileOutputStream
|
||||||
*/
|
*/
|
||||||
class RandomAccessFile : public Uncopyable, LeakChecked <RandomAccessFile>
|
class RandomAccessFile : LeakChecked <RandomAccessFile>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** The type of an FileOffset.
|
/** The type of an FileOffset.
|
||||||
@@ -71,6 +71,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
RandomAccessFile () noexcept;
|
RandomAccessFile () noexcept;
|
||||||
|
|
||||||
|
RandomAccessFile(RandomAccessFile const&) = delete;
|
||||||
|
RandomAccessFile& operator= (RandomAccessFile const&) = delete;
|
||||||
|
|
||||||
/** Destroy the file object.
|
/** Destroy the file object.
|
||||||
|
|
||||||
If the operating system file is open it will be closed.
|
If the operating system file is open it will be closed.
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace beast
|
|||||||
|
|
||||||
@see File, FileOutputStream
|
@see File, FileOutputStream
|
||||||
*/
|
*/
|
||||||
class TemporaryFile : LeakChecked <TemporaryFile>, public Uncopyable
|
class TemporaryFile : LeakChecked <TemporaryFile>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -117,6 +117,9 @@ public:
|
|||||||
TemporaryFile (const File& targetFile,
|
TemporaryFile (const File& targetFile,
|
||||||
const File& temporaryFile);
|
const File& temporaryFile);
|
||||||
|
|
||||||
|
TemporaryFile(TemporaryFile const&) = delete;
|
||||||
|
TemporaryFile& operator= (TemporaryFile const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
|
|
||||||
When this object is deleted it will make sure that its temporary file is
|
When this object is deleted it will make sure that its temporary file is
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ private:
|
|||||||
// This structure gets zero-filled at static initialization time.
|
// This structure gets zero-filled at static initialization time.
|
||||||
// No constructors are called.
|
// No constructors are called.
|
||||||
//
|
//
|
||||||
class StaticData : public Uncopyable
|
class StaticData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LockType mutex;
|
LockType mutex;
|
||||||
@@ -177,9 +177,10 @@ private:
|
|||||||
SharedSingleton object;
|
SharedSingleton object;
|
||||||
bool destructorCalled;
|
bool destructorCalled;
|
||||||
|
|
||||||
private:
|
StaticData() = delete;
|
||||||
StaticData();
|
StaticData(StaticData const&) = delete;
|
||||||
~StaticData();
|
StaticData& operator= (StaticData const&) = delete;
|
||||||
|
~StaticData() = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
static StaticData& getStaticData ()
|
static StaticData& getStaticData ()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace beast
|
|||||||
Contains some static helper functions for manipulating the MS Windows registry
|
Contains some static helper functions for manipulating the MS Windows registry
|
||||||
(Only available on Windows, of course!)
|
(Only available on Windows, of course!)
|
||||||
*/
|
*/
|
||||||
class WindowsRegistry : public Uncopyable
|
class WindowsRegistry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -113,8 +113,9 @@ public:
|
|||||||
int iconResourceNumber,
|
int iconResourceNumber,
|
||||||
bool registerForCurrentUserOnly);
|
bool registerForCurrentUserOnly);
|
||||||
|
|
||||||
private:
|
WindowsRegistry() = delete;
|
||||||
WindowsRegistry();
|
WindowsRegistry(WindowsRegistry const&) = delete;
|
||||||
|
WindowsRegistry const& operator= (WindowsRegistry const&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ bool File::moveToTrash() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class DirectoryIterator::NativeIterator::Pimpl : public Uncopyable
|
class DirectoryIterator::NativeIterator::Pimpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pimpl (const File& directory, const String& wildCard_)
|
Pimpl (const File& directory, const String& wildCard_)
|
||||||
@@ -254,6 +254,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pimpl (Pimpl const&) = delete;
|
||||||
|
Pimpl& operator= (Pimpl const&) = delete;
|
||||||
|
|
||||||
~Pimpl()
|
~Pimpl()
|
||||||
{
|
{
|
||||||
if (dir != nullptr)
|
if (dir != nullptr)
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ bool File::moveToTrash() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class DirectoryIterator::NativeIterator::Pimpl : public Uncopyable
|
class DirectoryIterator::NativeIterator::Pimpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pimpl (const File& directory, const String& wildCard_)
|
Pimpl (const File& directory, const String& wildCard_)
|
||||||
@@ -254,6 +254,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pimpl (Pimpl const&) = delete;
|
||||||
|
Pimpl& operator= (Pimpl const&) = delete;
|
||||||
|
|
||||||
~Pimpl()
|
~Pimpl()
|
||||||
{
|
{
|
||||||
if (dir != nullptr)
|
if (dir != nullptr)
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ bool File::moveToTrash() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class DirectoryIterator::NativeIterator::Pimpl : public Uncopyable
|
class DirectoryIterator::NativeIterator::Pimpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pimpl (const File& directory, const String& wildCard_)
|
Pimpl (const File& directory, const String& wildCard_)
|
||||||
@@ -326,6 +326,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pimpl (Pimpl const&) = delete;
|
||||||
|
Pimpl& operator= (Pimpl const&) = delete;
|
||||||
|
|
||||||
~Pimpl()
|
~Pimpl()
|
||||||
{
|
{
|
||||||
[enumerator release];
|
[enumerator release];
|
||||||
|
|||||||
@@ -66,13 +66,16 @@ struct NSObjectRetainer
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
template <typename SuperclassType>
|
template <typename SuperclassType>
|
||||||
struct ObjCClass : public Uncopyable
|
struct ObjCClass
|
||||||
{
|
{
|
||||||
ObjCClass (const char* nameRoot)
|
ObjCClass (const char* nameRoot)
|
||||||
: cls (objc_allocateClassPair ([SuperclassType class], getRandomisedName (nameRoot).toUTF8(), 0))
|
: cls (objc_allocateClassPair ([SuperclassType class], getRandomisedName (nameRoot).toUTF8(), 0))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjCClass (ObjCClass const&);
|
||||||
|
ObjCClass& operator= (ObjCClass const&);
|
||||||
|
|
||||||
~ObjCClass()
|
~ObjCClass()
|
||||||
{
|
{
|
||||||
objc_disposeClassPair (cls);
|
objc_disposeClassPair (cls);
|
||||||
|
|||||||
@@ -735,7 +735,6 @@ bool File::createLink (const String& description, const File& linkFileToCreate)
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
class DirectoryIterator::NativeIterator::Pimpl
|
class DirectoryIterator::NativeIterator::Pimpl
|
||||||
: LeakChecked <DirectoryIterator::NativeIterator::Pimpl>
|
: LeakChecked <DirectoryIterator::NativeIterator::Pimpl>
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pimpl (const File& directory, const String& wildCard)
|
Pimpl (const File& directory, const String& wildCard)
|
||||||
@@ -744,6 +743,9 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pimpl (Pimpl const&) = delete;
|
||||||
|
Pimpl& operator= (Pimpl const&) = delete;
|
||||||
|
|
||||||
~Pimpl()
|
~Pimpl()
|
||||||
{
|
{
|
||||||
if (handle != INVALID_HANDLE_VALUE)
|
if (handle != INVALID_HANDLE_VALUE)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
namespace beast
|
namespace beast
|
||||||
{
|
{
|
||||||
|
|
||||||
struct RegistryKeyWrapper : public Uncopyable
|
struct RegistryKeyWrapper
|
||||||
{
|
{
|
||||||
RegistryKeyWrapper (String name, const bool createForWriting, const DWORD wow64Flags)
|
RegistryKeyWrapper (String name, const bool createForWriting, const DWORD wow64Flags)
|
||||||
: key (0), wideCharValueName (nullptr)
|
: key (0), wideCharValueName (nullptr)
|
||||||
@@ -55,6 +55,9 @@ struct RegistryKeyWrapper : public Uncopyable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegistryKeyWrapper (RegistryKeyWrapper const&) = delete;
|
||||||
|
RegistryKeyWrapper& operator= (RegistryKeyWrapper const&) = delete;
|
||||||
|
|
||||||
~RegistryKeyWrapper()
|
~RegistryKeyWrapper()
|
||||||
{
|
{
|
||||||
if (key != 0)
|
if (key != 0)
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ namespace beast
|
|||||||
class FileInputSource
|
class FileInputSource
|
||||||
: public InputSource
|
: public InputSource
|
||||||
, LeakChecked <FileInputSource>
|
, LeakChecked <FileInputSource>
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -47,6 +46,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
FileInputSource (const File& file, bool useFileTimeInHashGeneration = false);
|
FileInputSource (const File& file, bool useFileTimeInHashGeneration = false);
|
||||||
|
|
||||||
|
FileInputSource (FileInputSource const&) = delete;
|
||||||
|
FileInputSource& operator= (FileInputSource const&) = delete;
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~FileInputSource();
|
~FileInputSource();
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class MemoryBlock;
|
|||||||
@see OutputStream, FileInputStream
|
@see OutputStream, FileInputStream
|
||||||
*/
|
*/
|
||||||
class InputStream
|
class InputStream
|
||||||
: public Uncopyable
|
|
||||||
, LeakChecked <InputStream>
|
, LeakChecked <InputStream>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -352,7 +351,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
InputStream() noexcept {}
|
InputStream() = default;
|
||||||
|
InputStream (InputStream const&) = delete;
|
||||||
|
InputStream& operator= (InputStream const&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // beast
|
} // beast
|
||||||
|
|||||||
@@ -40,12 +40,15 @@ class File;
|
|||||||
|
|
||||||
@see InputStream, MemoryOutputStream, FileOutputStream
|
@see InputStream, MemoryOutputStream, FileOutputStream
|
||||||
*/
|
*/
|
||||||
class OutputStream : public Uncopyable
|
class OutputStream
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
OutputStream();
|
OutputStream();
|
||||||
|
|
||||||
|
OutputStream (OutputStream const&) = delete;
|
||||||
|
OutputStream& operator= (OutputStream const&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace beast
|
|||||||
/**
|
/**
|
||||||
Contains methods for finding out about the current hardware and OS configuration.
|
Contains methods for finding out about the current hardware and OS configuration.
|
||||||
*/
|
*/
|
||||||
class SystemStats : public Uncopyable
|
class SystemStats
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -177,7 +177,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
SystemStats();
|
SystemStats() = delete;
|
||||||
|
SystemStats (SystemStats const&) = delete;
|
||||||
|
SystemStats const& operator= (SystemStats const&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // beast
|
} // beast
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ namespace beast {
|
|||||||
*/
|
*/
|
||||||
class DeadlineTimer
|
class DeadlineTimer
|
||||||
: public List <DeadlineTimer>::Node
|
: public List <DeadlineTimer>::Node
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Listener for a deadline timer.
|
/** Listener for a deadline timer.
|
||||||
@@ -50,6 +49,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
explicit DeadlineTimer (Listener* listener);
|
explicit DeadlineTimer (Listener* listener);
|
||||||
|
|
||||||
|
DeadlineTimer (DeadlineTimer const&) = delete;
|
||||||
|
DeadlineTimer& operator= (DeadlineTimer const&) = delete;
|
||||||
|
|
||||||
~DeadlineTimer ();
|
~DeadlineTimer ();
|
||||||
|
|
||||||
/** Cancel all notifications.
|
/** Cancel all notifications.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class TrackedScopedLock : public Uncopyable
|
class TrackedScopedLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit TrackedScopedLock (Mutex const& mutex,
|
inline explicit TrackedScopedLock (Mutex const& mutex,
|
||||||
@@ -40,6 +40,9 @@ public:
|
|||||||
lock (fileName, lineNumber);
|
lock (fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TrackedScopedLock (TrackedScopedLock const&) = delete;
|
||||||
|
TrackedScopedLock& operator= (TrackedScopedLock const&) = delete;
|
||||||
|
|
||||||
inline ~TrackedScopedLock () noexcept
|
inline ~TrackedScopedLock () noexcept
|
||||||
{
|
{
|
||||||
if (m_lock_count > 0)
|
if (m_lock_count > 0)
|
||||||
@@ -66,7 +69,7 @@ private:
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class TrackedScopedTryLock : public Uncopyable
|
class TrackedScopedTryLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit TrackedScopedTryLock (Mutex const& mutex,
|
inline explicit TrackedScopedTryLock (Mutex const& mutex,
|
||||||
@@ -77,6 +80,9 @@ public:
|
|||||||
try_lock (fileName, lineNumber);
|
try_lock (fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TrackedScopedTryLock (TrackedScopedTryLock const&) = delete;
|
||||||
|
TrackedScopedTryLock& operator= (TrackedScopedTryLock const&) = delete;
|
||||||
|
|
||||||
inline ~TrackedScopedTryLock () noexcept
|
inline ~TrackedScopedTryLock () noexcept
|
||||||
{
|
{
|
||||||
if (m_lock_count > 0)
|
if (m_lock_count > 0)
|
||||||
@@ -110,7 +116,7 @@ private:
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class TrackedScopedUnlock : public Uncopyable
|
class TrackedScopedUnlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit TrackedScopedUnlock (Mutex const& mutex,
|
inline explicit TrackedScopedUnlock (Mutex const& mutex,
|
||||||
@@ -122,6 +128,9 @@ public:
|
|||||||
m_mutex.unlock ();
|
m_mutex.unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TrackedScopedUnlock (TrackedScopedUnlock const&) = delete;
|
||||||
|
TrackedScopedUnlock& operator= (TrackedScopedUnlock const&) = delete;
|
||||||
|
|
||||||
inline ~TrackedScopedUnlock () noexcept
|
inline ~TrackedScopedUnlock () noexcept
|
||||||
{
|
{
|
||||||
m_mutex.lock (m_fileName, m_lineNumber);
|
m_mutex.lock (m_fileName, m_lineNumber);
|
||||||
@@ -136,7 +145,7 @@ private:
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class UntrackedScopedLock : public Uncopyable
|
class UntrackedScopedLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit UntrackedScopedLock (Mutex const& mutex,
|
inline explicit UntrackedScopedLock (Mutex const& mutex,
|
||||||
@@ -147,6 +156,9 @@ public:
|
|||||||
lock ();
|
lock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UntrackedScopedLock (UntrackedScopedLock const&) = delete;
|
||||||
|
UntrackedScopedLock& operator= (UntrackedScopedLock const&) = delete;
|
||||||
|
|
||||||
inline ~UntrackedScopedLock () noexcept
|
inline ~UntrackedScopedLock () noexcept
|
||||||
{
|
{
|
||||||
if (m_lock_count > 0)
|
if (m_lock_count > 0)
|
||||||
@@ -178,7 +190,7 @@ private:
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class UntrackedScopedTryLock : public Uncopyable
|
class UntrackedScopedTryLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit UntrackedScopedTryLock (Mutex const& mutex,
|
inline explicit UntrackedScopedTryLock (Mutex const& mutex,
|
||||||
@@ -189,6 +201,9 @@ public:
|
|||||||
try_lock ();
|
try_lock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UntrackedScopedTryLock (UntrackedScopedTryLock const&) = delete;
|
||||||
|
UntrackedScopedTryLock& operator= (UntrackedScopedTryLock const&) = delete;
|
||||||
|
|
||||||
inline ~UntrackedScopedTryLock () noexcept
|
inline ~UntrackedScopedTryLock () noexcept
|
||||||
{
|
{
|
||||||
if (m_lock_count > 0)
|
if (m_lock_count > 0)
|
||||||
@@ -227,7 +242,7 @@ private:
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class UntrackedScopedUnlock : public Uncopyable
|
class UntrackedScopedUnlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UntrackedScopedUnlock (Mutex const& mutex,
|
UntrackedScopedUnlock (Mutex const& mutex,
|
||||||
@@ -239,6 +254,9 @@ public:
|
|||||||
m_owns_lock = false;
|
m_owns_lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UntrackedScopedUnlock (UntrackedScopedUnlock const&) = delete;
|
||||||
|
UntrackedScopedUnlock& operator= (UntrackedScopedUnlock const&) = delete;
|
||||||
|
|
||||||
~UntrackedScopedUnlock () noexcept
|
~UntrackedScopedUnlock () noexcept
|
||||||
{
|
{
|
||||||
MutexTraits <Mutex>::lock (m_mutex);
|
MutexTraits <Mutex>::lock (m_mutex);
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ namespace beast {
|
|||||||
|
|
||||||
@see ScopedLock, ScopedTryLock, ScopedUnlock, SpinLock, Thread
|
@see ScopedLock, ScopedTryLock, ScopedUnlock, SpinLock, Thread
|
||||||
*/
|
*/
|
||||||
class CriticalSection : public Uncopyable
|
class CriticalSection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** Creates a CriticalSection object. */
|
/** Creates a CriticalSection object. */
|
||||||
CriticalSection() noexcept;
|
CriticalSection() noexcept;
|
||||||
|
|
||||||
|
CriticalSection (CriticalSection const&) = delete;
|
||||||
|
CriticalSection& operator= (CriticalSection const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
If the critical section is deleted whilst locked, any subsequent behaviour
|
If the critical section is deleted whilst locked, any subsequent behaviour
|
||||||
is unpredictable.
|
is unpredictable.
|
||||||
@@ -138,11 +141,13 @@ private:
|
|||||||
|
|
||||||
@see CriticalSection, Array, SharedObjectArray
|
@see CriticalSection, Array, SharedObjectArray
|
||||||
*/
|
*/
|
||||||
class DummyCriticalSection : public Uncopyable
|
class DummyCriticalSection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline DummyCriticalSection() noexcept {}
|
DummyCriticalSection() = default;
|
||||||
inline ~DummyCriticalSection() noexcept {}
|
DummyCriticalSection (DummyCriticalSection const&) = delete;
|
||||||
|
DummyCriticalSection& operator= (DummyCriticalSection const&) = delete;
|
||||||
|
~DummyCriticalSection() = default;
|
||||||
|
|
||||||
inline void enter() const noexcept {}
|
inline void enter() const noexcept {}
|
||||||
inline bool tryEnter() const noexcept { return true; }
|
inline bool tryEnter() const noexcept { return true; }
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace beast
|
|||||||
Since the DLL is freed when this object is deleted, it's handy for managing
|
Since the DLL is freed when this object is deleted, it's handy for managing
|
||||||
library lifetimes using RAII.
|
library lifetimes using RAII.
|
||||||
*/
|
*/
|
||||||
class DynamicLibrary : LeakChecked <DynamicLibrary>, public Uncopyable
|
class DynamicLibrary : LeakChecked <DynamicLibrary>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an unopened DynamicLibrary object.
|
/** Creates an unopened DynamicLibrary object.
|
||||||
@@ -46,6 +46,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
DynamicLibrary (const String& name) : handle (nullptr) { open (name); }
|
DynamicLibrary (const String& name) : handle (nullptr) { open (name); }
|
||||||
|
|
||||||
|
DynamicLibrary (DynamicLibrary const&) = delete;
|
||||||
|
DynamicLibrary& operator= (DynamicLibrary const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
If a library is currently open, it will be closed when this object is destroyed.
|
If a library is currently open, it will be closed when this object is destroyed.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace beast {
|
|||||||
|
|
||||||
@see Thread, BEASTApplication
|
@see Thread, BEASTApplication
|
||||||
*/
|
*/
|
||||||
class Process : public Uncopyable
|
class Process
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -130,7 +130,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Process();
|
Process() = delete;
|
||||||
|
Process (Process const&) = delete;
|
||||||
|
Process const& operator= (Process const&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // beast
|
} // beast
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace beast
|
|||||||
@see GenericScopedUnlock, CriticalSection, SpinLock, ScopedLock, ScopedUnlock
|
@see GenericScopedUnlock, CriticalSection, SpinLock, ScopedLock, ScopedUnlock
|
||||||
*/
|
*/
|
||||||
template <class LockType>
|
template <class LockType>
|
||||||
class GenericScopedLock : public Uncopyable
|
class GenericScopedLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -72,6 +72,9 @@ public:
|
|||||||
lock.enter();
|
lock.enter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericScopedLock (GenericScopedLock const&) = delete;
|
||||||
|
GenericScopedLock& operator= (GenericScopedLock const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
The lock will be released when the destructor is called.
|
The lock will be released when the destructor is called.
|
||||||
Make sure this object is created and deleted by the same thread, otherwise there are
|
Make sure this object is created and deleted by the same thread, otherwise there are
|
||||||
@@ -126,7 +129,7 @@ private:
|
|||||||
@see GenericScopedLock, CriticalSection, ScopedLock, ScopedUnlock
|
@see GenericScopedLock, CriticalSection, ScopedLock, ScopedUnlock
|
||||||
*/
|
*/
|
||||||
template <class LockType>
|
template <class LockType>
|
||||||
class GenericScopedUnlock : public Uncopyable
|
class GenericScopedUnlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -146,6 +149,9 @@ public:
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericScopedUnlock (GenericScopedUnlock const&) = delete;
|
||||||
|
GenericScopedUnlock& operator= (GenericScopedUnlock const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
|
|
||||||
The CriticalSection will be unlocked when the destructor is called.
|
The CriticalSection will be unlocked when the destructor is called.
|
||||||
@@ -200,7 +206,7 @@ private:
|
|||||||
@see CriticalSection::tryEnter, GenericScopedLock, GenericScopedUnlock
|
@see CriticalSection::tryEnter, GenericScopedLock, GenericScopedUnlock
|
||||||
*/
|
*/
|
||||||
template <class LockType>
|
template <class LockType>
|
||||||
class GenericScopedTryLock : public Uncopyable
|
class GenericScopedTryLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -217,6 +223,9 @@ public:
|
|||||||
inline explicit GenericScopedTryLock (const LockType& lock) noexcept
|
inline explicit GenericScopedTryLock (const LockType& lock) noexcept
|
||||||
: lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
|
: lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
|
||||||
|
|
||||||
|
GenericScopedTryLock (GenericScopedTryLock const&) = delete;
|
||||||
|
GenericScopedTryLock& operator= (GenericScopedTryLock const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
|
|
||||||
The mutex will be unlocked (if it had been successfully locked) when the
|
The mutex will be unlocked (if it had been successfully locked) when the
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace sqdb {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
// used for "once" and "prepare"
|
// used for "once" and "prepare"
|
||||||
class ref_counted_statement_base : public Uncopyable
|
class ref_counted_statement_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ref_counted_statement_base(session& s);
|
ref_counted_statement_base(session& s);
|
||||||
@@ -82,6 +82,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ref_counted_statement_base (
|
||||||
|
ref_counted_statement_base const&) = delete;
|
||||||
|
ref_counted_statement_base& operator= (
|
||||||
|
ref_counted_statement_base const&) = delete;
|
||||||
|
|
||||||
// break circular header dependency
|
// break circular header dependency
|
||||||
std::ostringstream& get_query_stream();
|
std::ostringstream& get_query_stream();
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ template <typename T>
|
|||||||
class conversion_into_type
|
class conversion_into_type
|
||||||
: private base_value_holder<T>
|
: private base_value_holder<T>
|
||||||
, public into_type <typename type_conversion<T>::base_type>
|
, public into_type <typename type_conversion<T>::base_type>
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename type_conversion<T>::base_type BASE_TYPE;
|
typedef typename type_conversion<T>::base_type BASE_TYPE;
|
||||||
@@ -89,6 +88,9 @@ public:
|
|||||||
: into_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
|
: into_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
|
||||||
, m_value(value), m_ind(ind) {}
|
, m_value(value), m_ind(ind) {}
|
||||||
|
|
||||||
|
conversion_into_type (conversion_into_type const&) = delete;
|
||||||
|
conversion_into_type& operator= (conversion_into_type const&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void convert_from_base()
|
void convert_from_base()
|
||||||
{
|
{
|
||||||
@@ -107,7 +109,6 @@ template<typename T>
|
|||||||
class conversion_use_type
|
class conversion_use_type
|
||||||
: private base_value_holder<T>
|
: private base_value_holder<T>
|
||||||
, public use_type<typename type_conversion<T>::base_type>
|
, public use_type<typename type_conversion<T>::base_type>
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename type_conversion<T>::base_type BASE_TYPE;
|
typedef typename type_conversion<T>::base_type BASE_TYPE;
|
||||||
@@ -128,6 +129,9 @@ public:
|
|||||||
: use_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
|
: use_type<BASE_TYPE>(detail::base_value_holder<T>::m_value, ind)
|
||||||
, m_value(const_cast<T&>(value)), m_ind(ind), m_bReadOnly(true) {}
|
, m_value(const_cast<T&>(value)), m_ind(ind), m_bReadOnly(true) {}
|
||||||
|
|
||||||
|
conversion_use_type (conversion_use_type const&) = delete;
|
||||||
|
conversion_use_type& operator= (conversion_use_type const&) = delete;
|
||||||
|
|
||||||
void convert_from_base()
|
void convert_from_base()
|
||||||
{
|
{
|
||||||
if (!m_bReadOnly)
|
if (!m_bReadOnly)
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include <beast/Config.h>
|
#include <beast/Config.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ namespace beast {
|
|||||||
|
|
||||||
@see SharedPtr, SharedObjectArray, SingleThreadedSharedObject
|
@see SharedPtr, SharedObjectArray, SingleThreadedSharedObject
|
||||||
*/
|
*/
|
||||||
class SharedObject : public Uncopyable
|
class SharedObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -99,6 +98,9 @@ protected:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedObject (SharedObject const&) = delete;
|
||||||
|
SharedObject& operator= (SharedObject const&) = delete;
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
virtual ~SharedObject()
|
virtual ~SharedObject()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace beast {
|
|||||||
*/
|
*/
|
||||||
template <typename Value, class SharedMutexType =
|
template <typename Value, class SharedMutexType =
|
||||||
SharedMutexAdapter <RecursiveMutex> >
|
SharedMutexAdapter <RecursiveMutex> >
|
||||||
class SharedData : public Uncopyable
|
class SharedData
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef typename SharedMutexType::LockGuardType LockGuardType;
|
typedef typename SharedMutexType::LockGuardType LockGuardType;
|
||||||
@@ -131,7 +131,7 @@ public:
|
|||||||
generated.
|
generated.
|
||||||
*/
|
*/
|
||||||
/** @{ */
|
/** @{ */
|
||||||
SharedData () { }
|
SharedData () = default;
|
||||||
|
|
||||||
template <class T1>
|
template <class T1>
|
||||||
explicit SharedData (T1 t1)
|
explicit SharedData (T1 t1)
|
||||||
@@ -165,6 +165,9 @@ public:
|
|||||||
: m_value (t1, t2, t3, t4, t5, t6, t7, t8) { }
|
: m_value (t1, t2, t3, t4, t5, t6, t7, t8) { }
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
SharedData (SharedData const&) = delete;
|
||||||
|
SharedData& operator= (SharedData const&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Value m_value;
|
Value m_value;
|
||||||
SharedMutexType m_mutex;
|
SharedMutexType m_mutex;
|
||||||
@@ -176,7 +179,7 @@ private:
|
|||||||
This acquires a unique lock on the underlying mutex.
|
This acquires a unique lock on the underlying mutex.
|
||||||
*/
|
*/
|
||||||
template <class Data, class SharedMutexType>
|
template <class Data, class SharedMutexType>
|
||||||
class SharedData <Data, SharedMutexType>::Access : public Uncopyable
|
class SharedData <Data, SharedMutexType>::Access
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Access (SharedData& state)
|
explicit Access (SharedData& state)
|
||||||
@@ -184,6 +187,9 @@ public:
|
|||||||
, m_lock (m_state.m_mutex)
|
, m_lock (m_state.m_mutex)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
Access (Access const&) = delete;
|
||||||
|
Access& operator= (Access const&) = delete;
|
||||||
|
|
||||||
Data const& get () const { return m_state.m_value; }
|
Data const& get () const { return m_state.m_value; }
|
||||||
Data const& operator* () const { return get (); }
|
Data const& operator* () const { return get (); }
|
||||||
Data const* operator-> () const { return &get (); }
|
Data const* operator-> () const { return &get (); }
|
||||||
@@ -202,7 +208,7 @@ private:
|
|||||||
This acquires a shared lock on the underlying mutex.
|
This acquires a shared lock on the underlying mutex.
|
||||||
*/
|
*/
|
||||||
template <class Data, class SharedMutexType>
|
template <class Data, class SharedMutexType>
|
||||||
class SharedData <Data, SharedMutexType>::ConstAccess : public Uncopyable
|
class SharedData <Data, SharedMutexType>::ConstAccess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a ConstAccess from the specified SharedData */
|
/** Create a ConstAccess from the specified SharedData */
|
||||||
@@ -211,6 +217,9 @@ public:
|
|||||||
, m_lock (m_state.m_mutex)
|
, m_lock (m_state.m_mutex)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
ConstAccess (ConstAccess const&) = delete;
|
||||||
|
ConstAccess& operator= (ConstAccess const&) = delete;
|
||||||
|
|
||||||
Data const& get () const { return m_state.m_value; }
|
Data const& get () const { return m_state.m_value; }
|
||||||
Data const& operator* () const { return get (); }
|
Data const& operator* () const { return get (); }
|
||||||
Data const* operator-> () const { return &get (); }
|
Data const* operator-> () const { return &get (); }
|
||||||
@@ -226,7 +235,7 @@ private:
|
|||||||
This acquires a shared lock on the underlying mutex.
|
This acquires a shared lock on the underlying mutex.
|
||||||
*/
|
*/
|
||||||
template <class Data, class SharedMutexType>
|
template <class Data, class SharedMutexType>
|
||||||
class SharedData <Data, SharedMutexType>::ConstUnlockedAccess : public Uncopyable
|
class SharedData <Data, SharedMutexType>::ConstUnlockedAccess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create an UnlockedAccess from the specified SharedData */
|
/** Create an UnlockedAccess from the specified SharedData */
|
||||||
@@ -234,6 +243,9 @@ public:
|
|||||||
: m_state (const_cast <SharedData const&> (state))
|
: m_state (const_cast <SharedData const&> (state))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
ConstUnlockedAccess (ConstUnlockedAccess const&) = delete;
|
||||||
|
ConstUnlockedAccess& operator= (ConstUnlockedAccess const&) = delete;
|
||||||
|
|
||||||
Data const& get () const { return m_state.m_value; }
|
Data const& get () const { return m_state.m_value; }
|
||||||
Data const& operator* () const { return get (); }
|
Data const& operator* () const { return get (); }
|
||||||
Data const* operator-> () const { return &get (); }
|
Data const* operator-> () const { return &get (); }
|
||||||
@@ -248,7 +260,7 @@ private:
|
|||||||
This acquires a shared lock on the underlying mutex.
|
This acquires a shared lock on the underlying mutex.
|
||||||
*/
|
*/
|
||||||
template <class Data, class SharedMutexType>
|
template <class Data, class SharedMutexType>
|
||||||
class SharedData <Data, SharedMutexType>::UnlockedAccess : public Uncopyable
|
class SharedData <Data, SharedMutexType>::UnlockedAccess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create an UnlockedAccess from the specified SharedData */
|
/** Create an UnlockedAccess from the specified SharedData */
|
||||||
@@ -256,6 +268,9 @@ public:
|
|||||||
: m_state (state)
|
: m_state (state)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
UnlockedAccess (UnlockedAccess const&) = delete;
|
||||||
|
UnlockedAccess& operator= (UnlockedAccess const&) = delete;
|
||||||
|
|
||||||
Data const& get () const { return m_state.m_value; }
|
Data const& get () const { return m_state.m_value; }
|
||||||
Data const& operator* () const { return get (); }
|
Data const& operator* () const { return get (); }
|
||||||
Data const* operator-> () const { return &get (); }
|
Data const* operator-> () const { return &get (); }
|
||||||
|
|||||||
@@ -20,14 +20,12 @@
|
|||||||
#ifndef BEAST_THREADS_SHAREDLOCKGUARD_H_INCLUDED
|
#ifndef BEAST_THREADS_SHAREDLOCKGUARD_H_INCLUDED
|
||||||
#define BEAST_THREADS_SHAREDLOCKGUARD_H_INCLUDED
|
#define BEAST_THREADS_SHAREDLOCKGUARD_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
namespace beast
|
namespace beast
|
||||||
{
|
{
|
||||||
|
|
||||||
/** A scoped container that acquires a shared lock. */
|
/** A scoped container that acquires a shared lock. */
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class SharedLockGuard : public Uncopyable
|
class SharedLockGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Mutex MutexType;
|
typedef Mutex MutexType;
|
||||||
@@ -38,6 +36,9 @@ public:
|
|||||||
m_mutex.lock_shared();
|
m_mutex.lock_shared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedLockGuard (SharedLockGuard const&) = delete;
|
||||||
|
SharedLockGuard& operator= (SharedLockGuard const&) = delete;
|
||||||
|
|
||||||
~SharedLockGuard ()
|
~SharedLockGuard ()
|
||||||
{
|
{
|
||||||
m_mutex.unlock_shared();
|
m_mutex.unlock_shared();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace beast {
|
|||||||
|
|
||||||
@see CriticalSection
|
@see CriticalSection
|
||||||
*/
|
*/
|
||||||
class SpinLock : public Uncopyable
|
class SpinLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Provides the type of scoped lock to use for locking a SpinLock. */
|
/** Provides the type of scoped lock to use for locking a SpinLock. */
|
||||||
@@ -53,8 +53,10 @@ public:
|
|||||||
/** Provides the type of scoped unlocker to use with a SpinLock. */
|
/** Provides the type of scoped unlocker to use with a SpinLock. */
|
||||||
typedef UnlockGuard <SpinLock> ScopedUnlockType;
|
typedef UnlockGuard <SpinLock> ScopedUnlockType;
|
||||||
|
|
||||||
inline SpinLock() noexcept {}
|
SpinLock() = default;
|
||||||
inline ~SpinLock() noexcept {}
|
SpinLock (SpinLock const&) = delete;
|
||||||
|
SpinLock& operator= (SpinLock const&) = delete;
|
||||||
|
~SpinLock() = default;
|
||||||
|
|
||||||
/** Acquires the lock.
|
/** Acquires the lock.
|
||||||
This will block until the lock has been successfully acquired by this thread.
|
This will block until the lock has been successfully acquired by this thread.
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace beast {
|
|||||||
@see CriticalSection, WaitableEvent, Process, ThreadWithProgressWindow,
|
@see CriticalSection, WaitableEvent, Process, ThreadWithProgressWindow,
|
||||||
MessageManagerLock
|
MessageManagerLock
|
||||||
*/
|
*/
|
||||||
class Thread : LeakChecked <Thread>, public Uncopyable
|
class Thread : LeakChecked <Thread>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -57,6 +57,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
explicit Thread (const String& threadName);
|
explicit Thread (const String& threadName);
|
||||||
|
|
||||||
|
Thread (Thread const&) = delete;
|
||||||
|
Thread& operator= (Thread const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
|
|
||||||
If the thread has not been stopped first, this will generate a fatal error.
|
If the thread has not been stopped first, this will generate a fatal error.
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ namespace beast {
|
|||||||
is deleted.
|
is deleted.
|
||||||
*/
|
*/
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
class ThreadLocalValue : public Uncopyable
|
class ThreadLocalValue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** */
|
/** */
|
||||||
ThreadLocalValue() noexcept
|
ThreadLocalValue() = default;
|
||||||
{
|
ThreadLocalValue (ThreadLocalValue const&) = delete;
|
||||||
}
|
ThreadLocalValue& operator= (ThreadLocalValue const&) = delete;
|
||||||
|
|
||||||
/** Destructor.
|
/** Destructor.
|
||||||
When this object is deleted, all the value objects for all threads will be deleted.
|
When this object is deleted, all the value objects for all threads will be deleted.
|
||||||
@@ -176,11 +176,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
#if BEAST_NO_COMPILER_THREAD_LOCAL
|
#if BEAST_NO_COMPILER_THREAD_LOCAL
|
||||||
struct ObjectHolder : public Uncopyable
|
struct ObjectHolder
|
||||||
{
|
{
|
||||||
ObjectHolder (const Thread::ThreadID& tid)
|
ObjectHolder (const Thread::ThreadID& tid)
|
||||||
: threadId (tid), object()
|
: threadId (tid), object()
|
||||||
{}
|
{}
|
||||||
|
ObjectHolder (ObjectHolder const&) = delete;
|
||||||
|
ObjectHolder& operator= (ObjectHolder const&) = delete;
|
||||||
|
|
||||||
Thread::ThreadID threadId;
|
Thread::ThreadID threadId;
|
||||||
ObjectHolder* next;
|
ObjectHolder* next;
|
||||||
|
|||||||
@@ -20,12 +20,10 @@
|
|||||||
#ifndef BEAST_THREADS_TRYLOCKGUARD_H_INCLUDED
|
#ifndef BEAST_THREADS_TRYLOCKGUARD_H_INCLUDED
|
||||||
#define BEAST_THREADS_TRYLOCKGUARD_H_INCLUDED
|
#define BEAST_THREADS_TRYLOCKGUARD_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class TryLockGuard : public Uncopyable
|
class TryLockGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Mutex MutexType;
|
typedef Mutex MutexType;
|
||||||
@@ -42,6 +40,9 @@ public:
|
|||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TryLockGuard (TryLockGuard const&) = delete;
|
||||||
|
TryLockGuard& operator= (TryLockGuard const&) = delete;
|
||||||
|
|
||||||
bool owns_lock() const
|
bool owns_lock() const
|
||||||
{ return m_owns_lock; }
|
{ return m_owns_lock; }
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,10 @@
|
|||||||
#ifndef BEAST_THREADS_UNLOCKGUARD_H_INCLUDED
|
#ifndef BEAST_THREADS_UNLOCKGUARD_H_INCLUDED
|
||||||
#define BEAST_THREADS_UNLOCKGUARD_H_INCLUDED
|
#define BEAST_THREADS_UNLOCKGUARD_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
template <typename Mutex>
|
template <typename Mutex>
|
||||||
class UnlockGuard : public Uncopyable
|
class UnlockGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Mutex MutexType;
|
typedef Mutex MutexType;
|
||||||
@@ -41,6 +39,9 @@ public:
|
|||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UnlockGuard (UnlockGuard const&) = delete;
|
||||||
|
UnlockGuard& operator= (UnlockGuard const&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex const& m_mutex;
|
Mutex const& m_mutex;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#define BEAST_THREADS_WAITABLEEVENT_H_INCLUDED
|
#define BEAST_THREADS_WAITABLEEVENT_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Config.h>
|
#include <beast/Config.h>
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
|
|
||||||
#if ! BEAST_WINDOWS
|
#if ! BEAST_WINDOWS
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -39,7 +38,6 @@ namespace beast {
|
|||||||
method.
|
method.
|
||||||
*/
|
*/
|
||||||
class WaitableEvent
|
class WaitableEvent
|
||||||
: public Uncopyable
|
|
||||||
//, LeakChecked <WaitableEvent> // VFALCO TODO Move LeakChecked to beast/
|
//, LeakChecked <WaitableEvent> // VFALCO TODO Move LeakChecked to beast/
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -62,6 +60,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
~WaitableEvent();
|
~WaitableEvent();
|
||||||
|
|
||||||
|
WaitableEvent (WaitableEvent const&) = delete;
|
||||||
|
WaitableEvent& operator= (WaitableEvent const&) = delete;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** Suspends the calling thread until the event has been signalled.
|
/** Suspends the calling thread until the event has been signalled.
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#ifndef BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED
|
#ifndef BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED
|
||||||
#define BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED
|
#define BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/Uncopyable.h>
|
|
||||||
#include <beast/intrusive/List.h>
|
#include <beast/intrusive/List.h>
|
||||||
#include <beast/threads/SharedData.h>
|
#include <beast/threads/SharedData.h>
|
||||||
|
|
||||||
@@ -183,7 +182,7 @@ public:
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
class PropertyStream::Map : public Uncopyable
|
class PropertyStream::Map
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
PropertyStream& m_stream;
|
PropertyStream& m_stream;
|
||||||
@@ -195,6 +194,9 @@ public:
|
|||||||
Map (std::string const& key, PropertyStream& stream);
|
Map (std::string const& key, PropertyStream& stream);
|
||||||
~Map ();
|
~Map ();
|
||||||
|
|
||||||
|
Map(Map const&) = delete;
|
||||||
|
Map& operator= (Map const&) = delete;
|
||||||
|
|
||||||
PropertyStream& stream();
|
PropertyStream& stream();
|
||||||
PropertyStream const& stream() const;
|
PropertyStream const& stream() const;
|
||||||
|
|
||||||
@@ -241,17 +243,19 @@ PropertyStream::Proxy& PropertyStream::Proxy::operator= (Value value)
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
class PropertyStream::Set : public Uncopyable
|
class PropertyStream::Set
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
PropertyStream& m_stream;
|
PropertyStream& m_stream;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Set (Set& set);
|
|
||||||
Set (std::string const& key, Map& map);
|
Set (std::string const& key, Map& map);
|
||||||
Set (std::string const& key, PropertyStream& stream);
|
Set (std::string const& key, PropertyStream& stream);
|
||||||
~Set ();
|
~Set ();
|
||||||
|
|
||||||
|
Set (Set const&) = delete;
|
||||||
|
Set& operator= (Set const&) = delete;
|
||||||
|
|
||||||
PropertyStream& stream();
|
PropertyStream& stream();
|
||||||
PropertyStream const& stream() const;
|
PropertyStream const& stream() const;
|
||||||
|
|
||||||
@@ -267,7 +271,7 @@ public:
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Subclasses can be called to write to a stream and have children. */
|
/** Subclasses can be called to write to a stream and have children. */
|
||||||
class PropertyStream::Source : public Uncopyable
|
class PropertyStream::Source
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct State
|
struct State
|
||||||
@@ -300,6 +304,9 @@ public:
|
|||||||
explicit Source (std::string const& name);
|
explicit Source (std::string const& name);
|
||||||
~Source ();
|
~Source ();
|
||||||
|
|
||||||
|
Source (Source const&) = delete;
|
||||||
|
Source& operator= (Source const&) = delete;
|
||||||
|
|
||||||
/** Returns the name of this source. */
|
/** Returns the name of this source. */
|
||||||
std::string const& name() const;
|
std::string const& name() const;
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ private:
|
|||||||
// This structure gets zero-filled at static initialization time.
|
// This structure gets zero-filled at static initialization time.
|
||||||
// No constructors are called.
|
// No constructors are called.
|
||||||
//
|
//
|
||||||
class StaticData : public Uncopyable
|
class StaticData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Atomic <int> state;
|
Atomic <int> state;
|
||||||
@@ -102,9 +102,10 @@ private:
|
|||||||
return *(reinterpret_cast <StaticData*> (&storage [0]));
|
return *(reinterpret_cast <StaticData*> (&storage [0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
StaticData() = delete;
|
||||||
StaticData();
|
StaticData(StaticData const&) = delete;
|
||||||
~StaticData();
|
StaticData& operator= (StaticData const&) = delete;
|
||||||
|
~StaticData() = delete;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define BEAST_UTILITY_CI_CHAR_TRAITS_H_INCLUDED
|
#define BEAST_UTILITY_CI_CHAR_TRAITS_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/cxx14/algorithm.h> // <algorithm>
|
#include <beast/cxx14/algorithm.h> // <algorithm>
|
||||||
|
#include <cctype>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|||||||
@@ -138,12 +138,6 @@ PropertyStream::Proxy PropertyStream::Map::operator[] (std::string const& key)
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
PropertyStream::Set::Set (Set& set)
|
|
||||||
: m_stream (set.m_stream)
|
|
||||||
{
|
|
||||||
m_stream.array_begin ();
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyStream::Set::Set (std::string const& key, Map& map)
|
PropertyStream::Set::Set (std::string const& key, Map& map)
|
||||||
: m_stream (map.stream())
|
: m_stream (map.stream())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user