From 69a42fc901d06af2f90d7046e153dc1273f19beb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Feb 2014 19:48:37 +0100 Subject: db/simple/Directory: LookupDirectory() return remaining URI Code can now be reused in LookupSong(). --- src/db/plugins/simple/Directory.hxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/db/plugins/simple/Directory.hxx') diff --git a/src/db/plugins/simple/Directory.hxx b/src/db/plugins/simple/Directory.hxx index 716afecea..ab03092f7 100644 --- a/src/db/plugins/simple/Directory.hxx +++ b/src/db/plugins/simple/Directory.hxx @@ -149,6 +149,21 @@ public: return child; } + struct LookupResult { + /** + * The last directory that was found. If the given + * URI could not be resolved at all, then this is the + * root directory. + */ + Directory *directory; + + /** + * The remaining URI part (without leading slash) or + * nullptr if the given URI was consumed completely. + */ + const char *uri; + }; + /** * Looks up a directory by its relative URI. * @@ -156,7 +171,7 @@ public: * @return the Directory, or nullptr if none was found */ gcc_pure - Directory *LookupDirectory(const char *uri); + LookupResult LookupDirectory(const char *uri); gcc_pure bool IsEmpty() const { -- cgit v1.2.3