wxMaxima
Loading...
Searching...
No Matches
CellImpl.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// Copyright (C) 2014-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
5// Copyright (C) 2020 Kuba Ober <kuba@bertec.com>
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// SPDX-License-Identifier: GPL-2.0+
23
24#include <memory>
25
30#ifndef WXMAXIMA_CELLIMPL_H
31#define WXMAXIMA_CELLIMPL_H
32
33#define DEFINE_CELL_TYPEINFO(type) \
34 const CellTypeInfo &type::GetInfo() \
35 { \
36 class type##TypeInfo final : public CellTypeInfo { \
37 public: \
38 /* cppcheck-suppress returnTempReference */ \
39 const wxString &GetName() const override { return S_(#type); } \
40 }; \
41 const type##TypeInfo static info; \
42 return info; \
43 } \
44
45#define DEFINE_CELL_COPY(type) \
46 std::unique_ptr<Cell> type::Copy(GroupCell *group) const \
47 { \
48 return std::make_unique<type>(group, *this); \
49 } \
50
51#define DEFINE_CELL(type) \
52 DEFINE_CELL_COPY(type) \
53 DEFINE_CELL_TYPEINFO(type) \
54
55#endif