os/path.h: new convenience functions
Infix operators == and !=. Capacity accessor. Issue #403
This commit is contained in:
parent
b63941f456
commit
3087b72438
|
@ -294,6 +294,16 @@ class Genode::Path_base
|
||||||
}
|
}
|
||||||
|
|
||||||
void append(char const *str) { _append(str); _canonicalize(); }
|
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(char const *path, char const *pwd = 0)
|
||||||
: Path_base(_buf, sizeof(_buf), path, pwd) { }
|
: Path_base(_buf, sizeof(_buf), path, pwd) { }
|
||||||
|
|
||||||
|
constexpr size_t capacity() { return MAX_LEN; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__OS__PATH_H_ */
|
#endif /* _INCLUDE__OS__PATH_H_ */
|
||||||
|
|
Loading…
Reference in New Issue