20 #ifndef LIBREPCB_CORE_COMPONENTSYMBOLVARIANTITEMSUFFIX_H 21 #define LIBREPCB_CORE_COMPONENTSYMBOLVARIANTITEMSUFFIX_H 26 #include "../../exceptions.h" 27 #include "../../serialization/sexpression.h" 28 #include "../../utils/toolbox.h" 30 #include <type_safe/constrained_type.hpp> 44 const QString& userInput) noexcept {
46 QRegularExpression(
"[^0-9a-zA-Z_]"),
47 true,
false,
false,
"_", 16);
51 template <
typename Value,
typename Predicate>
52 static constexpr
auto verify(Value&& val,
const Predicate& p) ->
53 typename std::decay<Value>::type {
54 return p(val) ? std::forward<Value>(val)
57 QString(QCoreApplication::translate(
58 "ComponentSymbolVariantItemSuffix",
59 "Invalid component symbol suffix: '%1'"))
61 std::forward<Value>(val));
67 return QRegularExpression(
"\\A[0-9a-zA-Z_]{0,16}\\z")
68 .match(value, 0, QRegularExpression::PartialPreferCompleteMatch)
86 type_safe::constrained_type<QString,
91 const QString& rhs) noexcept {
99 const QString& rhs) noexcept {
100 return (*lhs) != rhs;
104 return lhs != (*rhs);
107 const QString& rhs) noexcept {
133 stream << QString(
"ComponentSymbolVariantItemSuffix('%1')").arg(*obj);
138 uint seed = 0) noexcept {
Definition: componentsymbolvariantitemsuffix.h:65
QDataStream & operator<<(QDataStream &stream, const AttributeKey &obj)
Definition: attributekey.h:108
QString operator%(const ComponentPrefix &lhs, const QString &rhs) noexcept
Definition: componentprefix.h:96
Definition: occmodel.cpp:76
bool operator()(const QString &value) const noexcept
Definition: componentsymbolvariantitemsuffix.h:66
static QString cleanComponentSymbolVariantItemSuffix(const QString &userInput) noexcept
Definition: componentsymbolvariantitemsuffix.h:43
uint qHash(const ComponentSymbolVariantItemSuffix &key, uint seed=0) noexcept
Definition: componentsymbolvariantitemsuffix.h:137
static SExpression createString(const QString &string)
Definition: sexpression.cpp:380
static constexpr auto verify(Value &&val, const Predicate &p) -> typename std::decay< Value >::type
Definition: componentsymbolvariantitemsuffix.h:52
The RuntimeError class.
Definition: exceptions.h:216
AttributeKey deserialize(const SExpression &node)
Definition: attributekey.h:104
bool operator==(const AttributeKey &lhs, const QString &rhs) noexcept
Definition: attributekey.h:85
bool operator!=(const AttributeKey &lhs, const QString &rhs) noexcept
Definition: attributekey.h:91
Definition: componentsymbolvariantitemsuffix.h:50
SExpression serialize(const AttributeKey &obj)
Definition: attributekey.h:99
type_safe::constrained_type< QString, ComponentSymbolVariantItemSuffixConstraint, ComponentSymbolVariantItemSuffixVerifier > ComponentSymbolVariantItemSuffix
Definition: componentsymbolvariantitemsuffix.h:88
const QString & getValue() const
Definition: sexpression.cpp:71
The SExpression class.
Definition: sexpression.h:66
uint qHash(const AttributeKey &key, uint seed=0) noexcept
Definition: attributekey.h:118