]> git.saurik.com Git - wxWidgets.git/blame - include/wx/meta/movable.h
Implement GetSelectedHTML for the ie and gtk webkit backends and document.
[wxWidgets.git] / include / wx / meta / movable.h
CommitLineData
6712283c
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/meta/movable.h
3// Purpose: Test if a type is movable using memmove() etc.
4// Author: Vaclav Slavik
5// Created: 2008-01-21
6// RCS-ID: $Id$
7// Copyright: (c) 2008 Vaclav Slavik
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_META_MOVABLE_H_
12#define _WX_META_MOVABLE_H_
13
109e2ca4 14#include "wx/meta/pod.h"
6712283c
VS
15#include "wx/string.h" // for wxIsMovable<wxString> specialization
16
17// Helper to decide if an object of type T is "movable", i.e. if it can be
18// copied to another memory location using memmove() or realloc() C functions.
19// C++ only gurantees that POD types (including primitive types) are
20// movable.
21template<typename T>
22struct wxIsMovable
23{
109e2ca4 24 wxDEFINE_TEMPLATE_BOOL_VALUE(wxIsPod<T>::value);
6712283c
VS
25};
26
27// Macro to add wxIsMovable<T> specialization for given type that marks it
28// as movable:
29#define WX_DECLARE_TYPE_MOVABLE(type) \
30 template<> struct wxIsMovable<type> \
31 { \
40e01f4b 32 wxDEFINE_TEMPLATE_BOOL_VALUE(true); \
6712283c
VS
33 };
34
6712283c 35// Our implementation of wxString is written in such way that it's safe to move
68482dc5
VZ
36// it around (unless position cache is used which unfortunately breaks this).
37// OTOH, we don't know anything about std::string.
6712283c
VS
38// (NB: we don't put this into string.h and choose to include wx/string.h from
39// here instead so that rarely-used wxIsMovable<T> code isn't included by
40// everything)
01871bf6 41#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE
6712283c
VS
42WX_DECLARE_TYPE_MOVABLE(wxString)
43#endif
44
6712283c 45#endif // _WX_META_MOVABLE_H_