Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
CommonInterface.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// File: CommonInterface.h
3//-----------------------------------------------------------------------------
4// Project: Kactus2
5// Author: Mikko Teuho
6// Date: 21.04.2020
7//
8// Description:
9// Common functions for interfaces.
10//-----------------------------------------------------------------------------
11
12#ifndef COMMONINTERFACE_H
13#define COMMONINTERFACE_H
14
15#include <KactusAPI/KactusAPIGlobal.h>
16
17#include <string>
18#include <vector>
19#include <QString>
20
21//-----------------------------------------------------------------------------
23//-----------------------------------------------------------------------------
24class KACTUS2_API CommonInterface
25{
26public:
27
31 CommonInterface() = default;
32
36 virtual ~CommonInterface() = default;
37
43 virtual std::vector<std::string> getItemNames() const = 0;
44
50 virtual int itemCount() const = 0;
51
57 virtual bool validateItems() const = 0;
58
60 CommonInterface(const CommonInterface& other) = delete;
61 CommonInterface& operator=(const CommonInterface& other) = delete;
62
63protected:
64
72 QString getUniqueName(std::string const& newName, std::string const& itemTypeName) const;
73
82 bool nameHasChanged(std::string const& newName, std::string const& oldName) const;
83
84private:
85
93 bool nameIsUnique(std::string_view name, std::vector<std::string> const& reservedNamed) const;
94};
95
96#endif // COMMONINTERFACE_H
virtual int itemCount() const =0
QString getUniqueName(std::string const &newName, std::string const &itemTypeName) const
virtual bool validateItems() const =0
CommonInterface()=default
CommonInterface(const CommonInterface &other)=delete
No copying. No assignment.
virtual ~CommonInterface()=default
virtual std::vector< std::string > getItemNames() const =0
bool nameHasChanged(std::string const &newName, std::string const &oldName) const
CommonInterface & operator=(const CommonInterface &other)=delete