db/simple/Directory: LookupDirectory() return remaining URI

Code can now be reused in LookupSong().
This commit is contained in:
Max Kellermann
2014-02-26 19:48:37 +01:00
parent 525789cd36
commit 69a42fc901
3 changed files with 62 additions and 41 deletions

View File

@@ -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 {