20#ifndef LIBREPCB_CORE_COMPONENTSYMBOLVARIANTITEMSUFFIX_H
21#define LIBREPCB_CORE_COMPONENTSYMBOLVARIANTITEMSUFFIX_H
26#include "../../exceptions.h"
27#include "../../qtcompat.h"
28#include "../../serialization/sexpression.h"
29#include "../../utils/toolbox.h"
31#include <type_safe/constrained_type.hpp>
45 const QString& userInput)
noexcept {
47 QRegularExpression(
"[^0-9a-zA-Z_]"),
48 true,
false,
false,
"_", 16);
52 template <
typename Value,
typename Predicate>
53 static constexpr auto verify(Value&& val,
const Predicate& p) ->
54 typename std::decay<Value>::type {
55 return p(val) ? std::forward<Value>(val)
58 QString(QCoreApplication::translate(
59 "ComponentSymbolVariantItemSuffix",
60 "Invalid component symbol suffix: '%1'"))
62 std::forward<Value>(val));
68 return QRegularExpression(
"\\A[0-9a-zA-Z_]{0,16}\\z")
69 .match(value, 0, QRegularExpression::PartialPreferCompleteMatch)
87 type_safe::constrained_type<QString,
92 const QString& rhs)
noexcept {
100 const QString& rhs)
noexcept {
101 return (*lhs) != rhs;
105 return lhs != (*rhs);
108 const QString& rhs)
noexcept {
135 stream << QString(
"ComponentSymbolVariantItemSuffix('%1')").arg(*obj);
uint Hash
Return type of Qt's qHash() function.
Definition: qtcompat.h:58
The RuntimeError class.
Definition: exceptions.h:218
The SExpression class.
Definition: sexpression.h:69
static std::unique_ptr< SExpression > createString(const QString &string)
Definition: sexpression.cpp:407
const QString & getValue() const
Definition: sexpression.cpp:71
Definition: occmodel.cpp:77
bool operator==(const AttributeKey &lhs, const QString &rhs) noexcept
Definition: attributekey.h:86
QtCompat::Hash qHash(const ComponentSymbolVariantItemSuffix &key, QtCompat::Hash seed=0) noexcept
Definition: componentsymbolvariantitemsuffix.h:139
QtCompat::Hash qHash(const AttributeKey &key, QtCompat::Hash seed=0) noexcept
Definition: attributekey.h:119
std::unique_ptr< SExpression > serialize(const AttributeKey &obj)
Definition: attributekey.h:100
bool operator!=(const AttributeKey &lhs, const QString &rhs) noexcept
Definition: attributekey.h:92
static QString cleanComponentSymbolVariantItemSuffix(const QString &userInput) noexcept
Definition: componentsymbolvariantitemsuffix.h:44
AttributeKey deserialize(const SExpression &node)
Definition: attributekey.h:105
QDataStream & operator<<(QDataStream &stream, const AttributeKey &obj)
Definition: attributekey.h:109
QString operator%(const ComponentPrefix &lhs, const QString &rhs) noexcept
Definition: componentprefix.h:103
type_safe::constrained_type< QString, ComponentSymbolVariantItemSuffixConstraint, ComponentSymbolVariantItemSuffixVerifier > ComponentSymbolVariantItemSuffix
Definition: componentsymbolvariantitemsuffix.h:89
Definition: componentsymbolvariantitemsuffix.h:66
bool operator()(const QString &value) const noexcept
Definition: componentsymbolvariantitemsuffix.h:67
Definition: componentsymbolvariantitemsuffix.h:51
static constexpr auto verify(Value &&val, const Predicate &p) -> typename std::decay< Value >::type
Definition: componentsymbolvariantitemsuffix.h:53