From 7d10e59d822f1e405f1f5ac252db11790a1e9b43 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 9 Jan 2015 17:09:17 +0100 Subject: added path function ResolutionResult --- src/core/model/Node.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/core/model/Node.hpp') diff --git a/src/core/model/Node.hpp b/src/core/model/Node.hpp index c9c2808..6001dc2 100644 --- a/src/core/model/Node.hpp +++ b/src/core/model/Node.hpp @@ -67,6 +67,14 @@ struct ResolutionResult { : node(node), resolutionRoot(resolutionRoot) { } + + /** + * Returns a canonical path leading to the node. The path is relative to the + * resolutionRoot (the root node of the subgraph the node was defined in). + * + * @return a canonical path leading to the node. + */ + std::vector path() const; }; // Forward declaration @@ -99,7 +107,7 @@ private: * * @param p is the list the path should be constructed in. */ - void path(std::vector &p) const; + void path(std::vector &p, Handle root) const; /** * Returns true if the resolution process is just at the beginning (no part @@ -325,10 +333,12 @@ public: * Returns the vector containing the complete path to this node (including * the name of the parent nodes). * + * @param root is the node up to which the path should be returned. Ignored + * if set to nullptr. * @return a vector containing the path (starting with the root node) to * this node as a list of names. */ - std::vector path() const; + std::vector path(Handle root = nullptr) const; /** * Function which resolves a name path to a list of possible nodes starting -- cgit v1.2.3