From 3087b7243857ba6c6a3090d5752c8cbb14514dfb Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 28 Nov 2015 01:31:36 +0100 Subject: [PATCH] os/path.h: new convenience functions Infix operators == and !=. Capacity accessor. Issue #403 --- repos/os/include/os/path.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repos/os/include/os/path.h b/repos/os/include/os/path.h index eb48b9e19..678804f2b 100644 --- a/repos/os/include/os/path.h +++ b/repos/os/include/os/path.h @@ -294,6 +294,16 @@ class Genode::Path_base } void append(char const *str) { _append(str); _canonicalize(); } + + bool operator == (char const *other) const + { + return strcmp(_path, other) == 0; + } + + bool operator != (char const *other) const + { + return strcmp(_path, other) != 0; + } }; @@ -318,6 +328,8 @@ class Genode::Path : public Path_base { */ Path(char const *path, char const *pwd = 0) : Path_base(_buf, sizeof(_buf), path, pwd) { } + + constexpr size_t capacity() { return MAX_LEN; } }; #endif /* _INCLUDE__OS__PATH_H_ */