2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-04-14 01:26:57 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-07-03 00:49:40 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-04-14 01:26:57 +00:00
|
|
|
*/
|
2009-04-07 21:54:50 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2009-08-20 14:34:48 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// DeclareNoncopyableObject
|
|
|
|
// This macro provides an easy and clean method for ensuring objects are not copyable.
|
|
|
|
// Simply add the macro to the head or tail of your class declaration, and attempts to
|
|
|
|
// copy the class will give you a moderately obtuse compiler error that will have you
|
|
|
|
// scratching your head for 20 mintes.
|
|
|
|
//
|
|
|
|
// (... but that's probably better than having a weird invalid object copy having you
|
|
|
|
// scratch your head for a day).
|
|
|
|
//
|
|
|
|
// Programmer's notes:
|
|
|
|
// * We intentionally do NOT provide implementations for these methods, which should
|
|
|
|
// never be referenced anyway.
|
|
|
|
|
|
|
|
// * I've opted for macro form over multi-inherited class form (Boost style), because
|
|
|
|
// the errors generated by the macro are considerably less voodoo. The Boost-style
|
|
|
|
// The macro reports the exact class that causes the copy failure, while Boost's class
|
|
|
|
// approach just reports an error in whatever "NoncopyableObject" is inherited.
|
|
|
|
//
|
|
|
|
// * This macro is the same as wxWidgets' DECLARE_NO_COPY_CLASS macro. This one is free
|
|
|
|
// of wx dependencies though, and has a nicer typeset. :)
|
|
|
|
//
|
|
|
|
#ifndef DeclareNoncopyableObject
|
|
|
|
# define DeclareNoncopyableObject(classname) \
|
|
|
|
private: \
|
|
|
|
explicit classname(const classname&); \
|
|
|
|
classname& operator=(const classname&);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// __BaseSealed
|
|
|
|
// Base class used to implement type-safe sealed classes.
|
|
|
|
// This class should never be used directly. Use the Sealed macro instead, which ensures
|
|
|
|
// all sealed classes derive from a unique BaseSealed (preventing them from accidentally
|
|
|
|
// circumventing sealing by inheriting from multiple sealed classes.
|
|
|
|
//
|
|
|
|
template < int T >
|
|
|
|
class __BaseSealed
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
__BaseSealed()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Use this macro/class as a base to seal a class from being derived from.
|
|
|
|
// This macro works by providing a unique base class with a protected constructor
|
|
|
|
// for every class that derives from it.
|
|
|
|
#define Sealed private virtual __BaseSealed<__COUNTER__>
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
2009-07-14 06:18:52 +00:00
|
|
|
// macro provided for tagging translation strings, without actually running them through the
|
|
|
|
// translator (which the _() does automatically, and sometimes we don't want that). This is
|
|
|
|
// a shorthand replacement for wxTRANSLATE.
|
2009-08-20 14:34:48 +00:00
|
|
|
//
|
2009-07-14 06:18:52 +00:00
|
|
|
#define wxLt(a) (a)
|
|
|
|
|
|
|
|
#ifndef wxASSERT_MSG_A
|
|
|
|
# define wxASSERT_MSG_A( cond, msg ) wxASSERT_MSG( cond, wxString::FromAscii( msg ).c_str() )
|
|
|
|
#endif
|
|
|
|
|
2009-07-03 20:12:33 +00:00
|
|
|
// must include wx/setup.h first, otherwise we get warnings/errors regarding __LINUX__
|
|
|
|
#include <wx/setup.h>
|
|
|
|
|
2009-07-03 00:49:40 +00:00
|
|
|
#include "Pcsx2Defs.h"
|
|
|
|
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/tokenzr.h>
|
|
|
|
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
|
|
|
|
#include <wx/intl.h>
|
|
|
|
#include <wx/log.h>
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <string>
|
|
|
|
#include <cstring> // string.h under c++
|
|
|
|
#include <cstdio> // stdio.h under c++
|
|
|
|
#include <cstdlib>
|