File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed
include/mrdocs/Metadata/Info Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,18 @@ std::string_view
4646getShortOperatorName (
4747 OperatorKind kind) noexcept ;
4848
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+
4961/* * Return the safe name of an operator as a string.
5062
5163 @param kind The kind of operator.
Original file line number Diff line number Diff line change @@ -106,11 +106,47 @@ getOperatorName(
106106 // remove "operator"
107107 full.remove_prefix (8 );
108108 // remove the space, if any
109- if (full.front () == ' ' )
109+ if (full.front () == ' ' )
110+ {
110111 full.remove_prefix (1 );
112+ }
111113 return full;
112114}
113115
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+
114150std::string_view
115151getShortOperatorName (
116152 OperatorKind kind) noexcept
You can’t perform that action at this time.
0 commit comments