|
| 1 | +//////////////////////////////////////////////////////////////////////////////// |
| 2 | +/// DISCLAIMER |
| 3 | +/// |
| 4 | +/// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany |
| 5 | +/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany |
| 6 | +/// |
| 7 | +/// Licensed under the Business Source License 1.1 (the "License"); |
| 8 | +/// you may not use this file except in compliance with the License. |
| 9 | +/// You may obtain a copy of the License at |
| 10 | +/// |
| 11 | +/// https://github.com/arangodb/arangodb/blob/devel/LICENSE |
| 12 | +/// |
| 13 | +/// Unless required by applicable law or agreed to in writing, software |
| 14 | +/// distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +/// See the License for the specific language governing permissions and |
| 17 | +/// limitations under the License. |
| 18 | +/// |
| 19 | +/// Copyright holder is ArangoDB GmbH, Cologne, Germany |
| 20 | +//////////////////////////////////////////////////////////////////////////////// |
| 21 | + |
| 22 | +#include "Graph/Types/VertexRef.h" |
| 23 | + |
| 24 | +namespace arangodb::graph { |
| 25 | + |
| 26 | +[[nodiscard]] auto VertexRef::collectionName() const |
| 27 | + -> ResultT<std::string_view> { |
| 28 | + size_t pos = _vertex.find('/'); |
| 29 | + if (pos == std::string::npos) { |
| 30 | + // Invalid input. If we get here somehow we managed to store invalid |
| 31 | + // _from/_to values or the traverser did a let an illegal start through |
| 32 | + TRI_ASSERT(false); |
| 33 | + return Result{TRI_ERROR_GRAPH_INVALID_EDGE, |
| 34 | + "invalid VertexRef " + _vertex.toString()}; |
| 35 | + } |
| 36 | + |
| 37 | + return _vertex.substr(0, pos).stringView(); |
| 38 | +} |
| 39 | + |
| 40 | +} // namespace arangodb::graph |
0 commit comments