aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/Traits.hxx
diff options
context:
space:
mode:
authorDenis Krjuchkov <denis@crazydev.net>2013-12-05 04:47:07 +0600
committerDenis Krjuchkov <denis@crazydev.net>2013-12-05 12:35:21 +0600
commit289fdcc52b34e3ac4ff08355c47cb0e8bac6f737 (patch)
treef9bc2e834f675050ab02e53c94c30e5ea673c6f0 /src/fs/Traits.hxx
parent83e6e3e31f2ebf8d7777cdf7e4131996ab94c4a4 (diff)
downloadmpd-289fdcc52b34e3ac4ff08355c47cb0e8bac6f737.tar.gz
mpd-289fdcc52b34e3ac4ff08355c47cb0e8bac6f737.tar.xz
mpd-289fdcc52b34e3ac4ff08355c47cb0e8bac6f737.zip
fs/Traits: implement GetBase/GetParent/Build using templates
Diffstat (limited to 'src/fs/Traits.hxx')
-rw-r--r--src/fs/Traits.hxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index 5ba82549e..bd65f53bf 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -84,6 +84,21 @@ struct PathTraitsFS {
}
/**
+ * Determine the "base" file name of the given native path.
+ * The return value points inside the given string.
+ */
+ gcc_pure gcc_nonnull_all
+ static const_pointer GetBase(const_pointer p);
+
+ /**
+ * Determine the "parent" file name of the given native path.
+ * As a special case, returns the string "." if there is no
+ * separator in the given input string.
+ */
+ gcc_pure gcc_nonnull_all
+ static string GetParent(const_pointer p);
+
+ /**
* Constructs the path from the given components.
* If either of the components is empty string,
* remaining component is returned unchanged.
@@ -139,6 +154,16 @@ struct PathTraitsUTF8 {
*/
gcc_pure gcc_nonnull_all
static string GetParent(const_pointer p);
+
+ /**
+ * Constructs the path from the given components.
+ * If either of the components is empty string,
+ * remaining component is returned unchanged.
+ * If both components are empty strings, empty string is returned.
+ */
+ gcc_pure gcc_nonnull_all
+ static string Build(const_pointer a, size_t a_size,
+ const_pointer b, size_t b_size);
};
#endif