Attribute represents resolved attribute path.
| 176 | |
| 177 | // Attribute represents resolved attribute path. |
| 178 | class Attribute final { |
| 179 | public: |
| 180 | explicit Attribute(std::string variable_name) |
| 181 | : Attribute(std::move(variable_name), {}) {} |
| 182 | |
| 183 | Attribute(std::string variable_name, |
| 184 | std::vector<AttributeQualifier> qualifier_path) |
| 185 | : impl_(std::make_shared<Impl>(std::move(variable_name), |
| 186 | std::move(qualifier_path))) {} |
| 187 | |
| 188 | absl::string_view variable_name() const { return impl_->variable_name; } |
| 189 | |
| 190 | bool has_variable_name() const { return !impl_->variable_name.empty(); } |
| 191 | |
| 192 | absl::Span<const AttributeQualifier> qualifier_path() const { |
| 193 | return impl_->qualifier_path; |
| 194 | } |
| 195 | |
| 196 | bool operator==(const Attribute& other) const; |
| 197 | |
| 198 | bool operator<(const Attribute& other) const; |
| 199 | |
| 200 | const absl::StatusOr<std::string> AsString() const; |
| 201 | |
| 202 | private: |
| 203 | struct Impl final { |
| 204 | Impl(std::string variable_name, |
| 205 | std::vector<AttributeQualifier> qualifier_path) |
| 206 | : variable_name(std::move(variable_name)), |
| 207 | qualifier_path(std::move(qualifier_path)) {} |
| 208 | |
| 209 | std::string variable_name; |
| 210 | std::vector<AttributeQualifier> qualifier_path; |
| 211 | }; |
| 212 | |
| 213 | std::shared_ptr<const Impl> impl_; |
| 214 | }; |
| 215 | |
| 216 | // AttributePattern is a fully-qualified absolute attribute path pattern. |
| 217 | // Supported segments steps in the path are: |
no outgoing calls