-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use MinMaxString as we have to follow size constraints: 1 <> 64 This will be used in the SpecificAssetId and Entity Signed-off-by: Tobias Klausmann <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <basyx/labelType.h> | ||
|
||
namespace basyx { | ||
|
||
LabelType &LabelType::operator=(const LabelType &id) noexcept { | ||
base::MinMaxString::operator=(id); | ||
return *this; | ||
} | ||
|
||
LabelType &LabelType::operator=(const basyx::util::string_view& id) noexcept { | ||
base::MinMaxString::operator=(id.to_string()); | ||
return *this; | ||
} | ||
|
||
LabelType &LabelType::operator=(const std::string& id) noexcept { | ||
base::MinMaxString::operator=(id); | ||
return *this; | ||
} | ||
|
||
std::string LabelType::getLabel() const { | ||
return static_cast<std::string>(*this); | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef LABELTYPE_H | ||
#define LABELTYPE_H | ||
|
||
#include <basyx/base/minMaxString.h> | ||
#include <basyx/util/string_view/string_view.hpp> | ||
|
||
namespace basyx | ||
{ | ||
|
||
class LabelType: public base::MinMaxString { | ||
private: | ||
static const unsigned int minLenght = 1; | ||
static const unsigned int maxLenght = 64; | ||
public: | ||
LabelType(): base::MinMaxString(minLenght, maxLenght) {} | ||
LabelType(const LabelType&) = default; | ||
LabelType(const basyx::util::string_view &v): | ||
base::MinMaxString(minLenght, maxLenght) { | ||
base::MinMaxString::operator=(v.to_string()); | ||
} | ||
LabelType(LabelType&&) = default; | ||
|
||
LabelType& operator=(const LabelType& id) noexcept; | ||
LabelType& operator=(const basyx::util::string_view& id) noexcept; | ||
LabelType& operator=(const std::string& id) noexcept; | ||
//LabelType& operator=(LabelType &) noexcept = default; | ||
|
||
std::string getLabel() const; | ||
|
||
~LabelType() = default; | ||
}; | ||
}; | ||
#endif // LABELTYPE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters