File tree 2 files changed +49
-1
lines changed
include/mrdocs/Metadata/Info
2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,18 @@ std::string_view
46
46
getShortOperatorName (
47
47
OperatorKind kind) noexcept ;
48
48
49
+ /* * Return the short name of an operator as a string.
50
+ */
51
+ MRDOCS_DECL
52
+ OperatorKind
53
+ getOperatorKind (std::string_view name) noexcept ;
54
+
55
+ /* * Return the short name of an operator as a string.
56
+ */
57
+ MRDOCS_DECL
58
+ OperatorKind
59
+ getOperatorKindFromSuffix (std::string_view suffix) noexcept ;
60
+
49
61
/* * Return the safe name of an operator as a string.
50
62
51
63
@param kind The kind of operator.
Original file line number Diff line number Diff line change @@ -106,11 +106,47 @@ getOperatorName(
106
106
// remove "operator"
107
107
full.remove_prefix (8 );
108
108
// remove the space, if any
109
- if (full.front () == ' ' )
109
+ if (full.front () == ' ' )
110
+ {
110
111
full.remove_prefix (1 );
112
+ }
111
113
return full;
112
114
}
113
115
116
+ OperatorKind
117
+ getOperatorKind (std::string_view name) noexcept
118
+ {
119
+ for (auto const & item : Table)
120
+ {
121
+ if (name == item.name )
122
+ {
123
+ return item.kind ;
124
+ }
125
+ }
126
+ return OperatorKind::None;
127
+ }
128
+
129
+ OperatorKind
130
+ getOperatorKindFromSuffix (std::string_view suffix) noexcept
131
+ {
132
+ for (auto const & item : Table)
133
+ {
134
+ std::string_view itemSuffix = item.name ;
135
+ if (!itemSuffix.starts_with (" operator" ))
136
+ {
137
+ continue ;
138
+ }
139
+ itemSuffix.remove_prefix (8 );
140
+ itemSuffix = ltrim (itemSuffix);
141
+ if (suffix == itemSuffix)
142
+ {
143
+ return item.kind ;
144
+ }
145
+ }
146
+ return OperatorKind::None;
147
+ }
148
+
149
+
114
150
std::string_view
115
151
getShortOperatorName (
116
152
OperatorKind kind) noexcept
You can’t perform that action at this time.
0 commit comments