wxMaxima
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 
28 #ifndef WXMAXIMA_CELLIMPL_H
29 #define WXMAXIMA_CELLIMPL_H
30 
31 #define DEFINE_CELL_TYPEINFO(type) \
32  const CellTypeInfo &type::GetInfo() \
33  { \
34  class type##TypeInfo final : public CellTypeInfo { \
35  public: \
36  /* cppcheck-suppress returnTempReference */ \
37  const wxString &GetName() const override { return S_(#type); } \
38  }; \
39  const type##TypeInfo static info; \
40  return info; \
41  } \
42 
43 #define DEFINE_CELL_COPY(type) \
44  std::unique_ptr<Cell> type::Copy(GroupCell *group) const \
45  { \
46  return std::make_unique<type>(group, *this); \
47  } \
48 
49 #define DEFINE_CELL(type) \
50  DEFINE_CELL_COPY(type) \
51  DEFINE_CELL_TYPEINFO(type) \
52 
53 #endif