Make UEFI boot-platform build again
[haiku.git] / headers / private / fs_shell / KPath.h
blobb18d058641583d046de26ec1b08b2c86d5f1b66b
1 /*
2 * Copyright 2004-2007, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _K_PATH_H
6 #define _K_PATH_H
9 #include "fssh_defs.h"
10 #include "fssh_kernel_export.h"
13 namespace FSShell {
15 class KPath {
16 public:
17 KPath(fssh_size_t bufferSize = FSSH_B_PATH_NAME_LENGTH);
18 KPath(const char* path, bool normalize = false,
19 fssh_size_t bufferSize = FSSH_B_PATH_NAME_LENGTH);
20 KPath(const KPath& other);
21 ~KPath();
23 fssh_status_t SetTo(const char *path, bool normalize = false,
24 fssh_size_t bufferSize = FSSH_B_PATH_NAME_LENGTH);
26 fssh_status_t InitCheck() const;
28 fssh_status_t SetPath(const char *path, bool normalize = false);
29 const char *Path() const;
30 fssh_size_t Length() const { return fPathLength; }
32 fssh_size_t BufferSize() const { return fBufferSize; }
33 char *LockBuffer();
34 void UnlockBuffer();
36 const char *Leaf() const;
37 fssh_status_t ReplaceLeaf(const char *newLeaf);
39 fssh_status_t Append(const char *toAppend, bool isComponent = true);
41 KPath& operator=(const KPath& other);
42 KPath& operator=(const char* path);
44 bool operator==(const KPath& other) const;
45 bool operator==(const char* path) const;
46 bool operator!=(const KPath& other) const;
47 bool operator!=(const char* path) const;
49 private:
50 void _ChopTrailingSlashes();
52 char* fBuffer;
53 fssh_size_t fBufferSize;
54 fssh_size_t fPathLength;
55 bool fLocked;
58 } // namespace FSShell
60 using FSShell::KPath;
62 #endif /* _K_PATH_H */