Inflection
Morphology Inflection
Loading...
Searching...
No Matches
SemanticConceptList.hpp
1/*
2 * Copyright 2019-2024 Apple Inc. All rights reserved.
3 */
4#pragma once
5
6#include <inflection/dialog/fwd.hpp>
7#include <inflection/dialog/SemanticFeatureConceptBase.hpp>
8#include <inflection/dialog/DisplayValue.hpp>
9#include <inflection/dialog/SpeakableString.hpp>
10#include <string>
11#include <vector>
12
16class INFLECTION_CLASS_API inflection::dialog::SemanticConceptList
18{
19public:
21 typedef SemanticFeatureConceptBase super;
23
24private:
25 ::std::vector<SemanticFeatureConceptBase*> concepts { };
26 SpeakableString beforeFirst { {} };
27 SpeakableString afterFirst { {} };
28 SpeakableString itemDelimiter { {} };
29 SpeakableString beforeLast { {} };
30 SpeakableString afterLast { {} };
31 SpeakableString itemPrefix { {} };
32 SpeakableString itemSuffix { {} };
33 bool avoidAffixRedundancy { true };
34
35public:
41 void putConstraint(const SemanticFeature& feature, ::std::u16string_view featureValue) override;
46 void clearConstraint(const SemanticFeature& feature) override;
47 void reset() override;
48
49public: /* protected */
50 SpeakableString* getFeatureValue(const SemanticFeature& feature) const override;
51
52public:
56 int32_t getSize() const;
62 const SemanticFeatureConceptBase* get(int32_t index) const;
68 const SemanticFeatureConceptBase* operator[](int32_t index) const;
72 bool isExists() const override;
76 ::std::u16string toString() const override;
77
78public:
80private:
82public:
83 SemanticConceptList* clone() const override;
84
90
97 virtual SpeakableString getBeforeFirst(const SemanticFeatureConceptBase& first, const SpeakableString& formattedFirst) const;
98
104
114 virtual SpeakableString getAfterFirst(const SemanticFeatureConceptBase& first, const SpeakableString& formattedFirst, const SemanticFeatureConceptBase& second, const SpeakableString& formattedSecond) const;
115
122
132 virtual SpeakableString getItemDelimiter(const SemanticFeatureConceptBase& previous, const SpeakableString& formattedPrevious, const SemanticFeatureConceptBase& next, const SpeakableString& formattedNext) const;
133
139
149 virtual SpeakableString getBeforeLast(const SemanticFeatureConceptBase& secondToLast, const SpeakableString& formattedSecondToLast, const SemanticFeatureConceptBase& last, const SpeakableString& formattedLast) const;
150
156
163 virtual SpeakableString getAfterLast(const SemanticFeatureConceptBase& last, const SpeakableString& formattedLast) const;
164
170
177 virtual SpeakableString getItemPrefix(const SemanticFeatureConceptBase& item, const SpeakableString& formattedItem) const;
178
185
192 virtual SpeakableString getItemSuffix(const SemanticFeatureConceptBase& item, const SpeakableString& formattedItem) const;
193
198 virtual void setAvoidItemAffixRedundancy(bool value);
199
200public:
204 SemanticConceptList(const SemanticFeatureModel* model, const ::std::vector<const SemanticFeatureConceptBase*>& values);
208 SemanticConceptList(const SemanticFeatureModel* model, const ::std::vector<SemanticFeatureConceptBase*>& values);
217private:
218 SemanticConceptList& operator=(const SemanticConceptList&) = delete;
219};
Formats a list of SemanticFeatureConceptBase objects with context sensitive semantic features.
virtual SemanticConceptList * setItemDelimiter(const SpeakableString &value)
virtual SemanticConceptList * setBeforeLast(const SpeakableString &value)
virtual SemanticConceptList * setBeforeFirst(const SpeakableString &value)
void putConstraint(const SemanticFeature &feature, ::std::u16string_view featureValue) override
SemanticConceptList(const SemanticFeatureModel *model, const ::std::vector< const SemanticFeatureConceptBase * > &values)
SemanticConceptList(const SemanticFeatureModel *model, const ::std::vector< SemanticFeatureConceptBase * > &values)
::std::u16string toString() const override
SemanticConceptList(const SemanticConceptList &other)
virtual SpeakableString getItemPrefix(const SemanticFeatureConceptBase &item, const SpeakableString &formattedItem) const
virtual SemanticConceptList * setAfterFirst(const SpeakableString &value)
const SemanticFeatureConceptBase * operator[](int32_t index) const
virtual SpeakableString getAfterFirst(const SemanticFeatureConceptBase &first, const SpeakableString &formattedFirst, const SemanticFeatureConceptBase &second, const SpeakableString &formattedSecond) const
virtual SpeakableString getAfterLast(const SemanticFeatureConceptBase &last, const SpeakableString &formattedLast) const
virtual SemanticConceptList * setItemSuffix(const SpeakableString &value)
virtual void setAvoidItemAffixRedundancy(bool value)
virtual SpeakableString getBeforeLast(const SemanticFeatureConceptBase &secondToLast, const SpeakableString &formattedSecondToLast, const SemanticFeatureConceptBase &last, const SpeakableString &formattedLast) const
SemanticConceptList * clone() const override
SpeakableString * getFeatureValue(const SemanticFeature &feature) const override
const SemanticFeatureConceptBase * get(int32_t index) const
SpeakableString * toSpeakableString() const override
virtual SpeakableString getBeforeFirst(const SemanticFeatureConceptBase &first, const SpeakableString &formattedFirst) const
virtual SpeakableString getItemDelimiter(const SemanticFeatureConceptBase &previous, const SpeakableString &formattedPrevious, const SemanticFeatureConceptBase &next, const SpeakableString &formattedNext) const
virtual SpeakableString getItemSuffix(const SemanticFeatureConceptBase &item, const SpeakableString &formattedItem) const
virtual SemanticConceptList * setAfterLast(const SpeakableString &value)
void clearConstraint(const SemanticFeature &feature) override
virtual SemanticConceptList * setItemPrefix(const SpeakableString &value)
Abstract base class of SpeakableConcept with inflectable constraints.
A semantic model that contains display data for semantic values and provides feature functions for de...
Represents a single semantic feature.
Represents a string with both a spoken and written representation.
The C++ namespace for Inflection.
Definition fwd.hpp:11