wxObjectWithData helper template introduced
This commit is contained in:
parent
d604e81604
commit
6c94ff59be
@ -39,6 +39,7 @@
|
|||||||
<ClInclude Include="..\include\wxex\comutils.h" />
|
<ClInclude Include="..\include\wxex\comutils.h" />
|
||||||
<ClInclude Include="..\include\wxex\crypto.h" />
|
<ClInclude Include="..\include\wxex\crypto.h" />
|
||||||
<ClInclude Include="..\include\wxex\hex.h" />
|
<ClInclude Include="..\include\wxex\hex.h" />
|
||||||
|
<ClInclude Include="..\include\wxex\object.h" />
|
||||||
<ClInclude Include="..\include\wxex\persist\auimanager.h" />
|
<ClInclude Include="..\include\wxex\persist\auimanager.h" />
|
||||||
<ClInclude Include="..\include\wxex\persist\dialog.h" />
|
<ClInclude Include="..\include\wxex\persist\dialog.h" />
|
||||||
<ClInclude Include="..\include\wxex\url.h" />
|
<ClInclude Include="..\include\wxex\url.h" />
|
||||||
|
@ -81,6 +81,9 @@
|
|||||||
<ClInclude Include="..\include\wxex\url.h">
|
<ClInclude Include="..\include\wxex\url.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\wxex\object.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\locale\wxExtend.pot">
|
<None Include="..\locale\wxExtend.pot">
|
||||||
|
55
include/wxex/object.h
Normal file
55
include/wxex/object.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
|
||||||
|
This file is part of wxExtend.
|
||||||
|
|
||||||
|
wxExtend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
wxExtend 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.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <wx/object.h>
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Helper template for event user data
|
||||||
|
///
|
||||||
|
template <class T>
|
||||||
|
class wxObjectWithData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Default constructor
|
||||||
|
///
|
||||||
|
inline wxObjectWithData() {}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Construct object with data
|
||||||
|
///
|
||||||
|
/// \param[in] data Data to initialize object with
|
||||||
|
///
|
||||||
|
inline wxObjectWithData(const T &data) : m_data(data) {}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Construct object with data
|
||||||
|
///
|
||||||
|
/// \param[in] data Data to move to object
|
||||||
|
///
|
||||||
|
inline wxObjectWithData(T &&data) : m_data(std::move(data)) {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
T m_data; ///< Data
|
||||||
|
};
|
@ -27,6 +27,7 @@
|
|||||||
#include "../include/wxex/comutils.h"
|
#include "../include/wxex/comutils.h"
|
||||||
#include "../include/wxex/crypto.h"
|
#include "../include/wxex/crypto.h"
|
||||||
#include "../include/wxex/hex.h"
|
#include "../include/wxex/hex.h"
|
||||||
|
#include "../include/wxex/object.h"
|
||||||
#include "../include/wxex/url.h"
|
#include "../include/wxex/url.h"
|
||||||
#include "../include/wxex/valhex.h"
|
#include "../include/wxex/valhex.h"
|
||||||
#include "../include/wxex/xml.h"
|
#include "../include/wxex/xml.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user