They must either support copying or be derived from NonCopyable.
#include <stdexcept>
#include <string>
+#include "noncopyable.h"
namespace Msp {
/**
Base class for applications. See also RegisteredApplication.
*/
-class Application
+class Application: private NonCopyable
{
protected:
class Starter
#include <string>
#include <vector>
#include <msp/strings/lexicalcast.h>
+#include "noncopyable.h"
namespace Msp {
arguments and their associated help texts. An application may override this by
providing its own option with the same name.
*/
-class GetOpt
+class GetOpt: private NonCopyable
{
public:
enum ArgType
#define MSP_CORE_MODULE_H_
#include <string>
+#include "noncopyable.h"
namespace Msp {
-class Module
+class Module: private NonCopyable
{
private:
struct Private;
#ifndef MSP_CORE_MUTEX_H_
#define MSP_CORE_MUTEX_H_
+#include "noncopyable.h"
#include "refptr.h"
namespace Msp {
A class for controlling mutually exclusive access to a resource. Only one
thread can hold a lock on the mutex at a time.
*/
-class Mutex
+class Mutex: private NonCopyable
{
friend class Semaphore;
Private *priv;
- Mutex(const Mutex &);
- Mutex &operator=(const Mutex &);
public:
Mutex();
~Mutex();
#include <vector>
#include <msp/fs/path.h>
#include <msp/io/base.h>
+#include "noncopyable.h"
namespace Msp {
the self object take effect immediately. It is recommended to perform such
redirections directly on the Console objects.
*/
-class Process
+class Process: private NonCopyable
{
public:
typedef std::vector<std::string> Arguments;
#define MSP_CORE_SEMAPHORE_H_
#include <msp/time/timedelta.h>
-#include "mutex.h"
+#include "noncopyable.h"
namespace Msp {
-class Semaphore
+class Semaphore: private NonCopyable
{
private:
struct Private;
#define MSP_CORE_THREAD_H_
#include <string>
+#include "noncopyable.h"
namespace Msp {
This is to allow initializing variables of the derived class before the thread
is started.
*/
-class Thread
+class Thread: private NonCopyable
{
private:
struct Private;
protected:
Thread(const std::string & = std::string());
-private:
- Thread(const Thread &);
- Thread &operator=(const Thread &);
public:
virtual ~Thread();
#define MSP_DEBUG_ERRORREPORTER_H_
#include <stdexcept>
+#include <msp/core/noncopyable.h>
namespace Msp {
namespace Debug {
-class ErrorReporter
+class ErrorReporter: private NonCopyable
{
private:
ErrorReporter *prev;
#include <map>
#include <string>
#include <vector>
+#include <msp/core/noncopyable.h>
#include <msp/time/timedelta.h>
#include <msp/time/timestamp.h>
Note: This is not thread-safe. To profile multiple threads, create a separate
Profiler for each thread.
*/
-class Profiler
+class Profiler: private NonCopyable
{
public:
struct CallInfo
#ifndef MSP_DEBUG_PROFILINGSCOPE_H_
#define MSP_DEBUG_PROFILINGSCOPE_H_
+#include <msp/core/noncopyable.h>
#include <msp/time/timestamp.h>
#include "profiler.h"
created and ends when it goes out of scope. If there was another object in an
outer scope, it is notified of the time used in inner scopes.
*/
-class ProfilingScope
+class ProfilingScope: private NonCopyable
{
private:
Profiler &profiler;
#include <sigc++/sigc++.h>
#include <msp/core/mutex.h>
+#include <msp/core/noncopyable.h>
#include "handle.h"
#include "mode.h"
#include "poll.h"
/**
Common interface for all I/O objects.
*/
-class Base
+class Base: private NonCopyable
{
public:
/** RAII synchronization primitive. Prevents concurrent access to the
Mutex *mutex;
Base();
-private:
- Base(const Base &);
- Base &operator=(const Base &);
public:
virtual ~Base();
#ifndef MSP_IO_EVENTREADER_H_
#define MSP_IO_EVENTREADER_H_
+#include <msp/core/noncopyable.h>
#include "handle.h"
namespace Msp {
Unix-based systems can poll the fd directly, so this class reduces to a simple
passthrough to sys_read.
*/
-class EventReader
+class EventReader: private NonCopyable
{
private:
struct Private;
#include <list>
#include <map>
#include <vector>
+#include <msp/core/noncopyable.h>
#include <msp/time/timedelta.h>
namespace Msp {
{ return PollEvent(~static_cast<int>(e)); }
-class Poller
+class Poller: private NonCopyable
{
public:
struct Slot
advance();
}
+Formatter::Formatter(const Formatter &other):
+ fmt(other.fmt),
+ pos(fmt.begin()+(other.pos-other.fmt.begin())),
+ result(other.result)
+{ }
+
+Formatter &Formatter::operator=(const Formatter &other)
+{
+ fmt = other.fmt;
+ pos = fmt.begin()+(other.pos-other.fmt.begin());
+ result = other.result;
+ return *this;
+}
+
const string &Formatter::str() const
{
if(pos!=fmt.end())
public:
Formatter(const std::string &);
+ Formatter(const Formatter &);
+ Formatter &operator=(const Formatter &);
/** Extracts the next conversion from the format string and formats the
given value with it. Will throw if no more conversions are found. */
#include <vector>
#include <sigc++/sigc++.h>
#include <msp/core/mutex.h>
+#include <msp/core/noncopyable.h>
#include <msp/core/semaphore.h>
#include "timedelta.h"
#include "timestamp.h"
This class is thread-safe, to allow running timers in a separate thread.
*/
-class Timer
+class Timer: private NonCopyable
{
public:
class Slot