haiku/headers/private/fs_shell/KPath.h
Ingo Weinhold a38a92c955 Beginnings of a new, better portable FS shell with Haiku FS interface.
Doesn't do anything ATM, but already provides the required system
interface (VFS, caches, POSIX functions).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20859 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-27 12:17:22 +00:00

63 lines
1.4 KiB
C++

/*
* Copyright 2004-2007, Ingo Weinhold, bonefish@users.sf.net.
* Distributed under the terms of the MIT License.
*/
#ifndef _K_PATH_H
#define _K_PATH_H
#include "fssh_defs.h"
#include "fssh_kernel_export.h"
namespace FSShell {
class KPath {
public:
KPath(fssh_size_t bufferSize = FSSH_B_PATH_NAME_LENGTH);
KPath(const char* path, bool normalize = false,
fssh_size_t bufferSize = FSSH_B_PATH_NAME_LENGTH);
KPath(const KPath& other);
~KPath();
fssh_status_t SetTo(const char *path, bool normalize = false,
fssh_size_t bufferSize = FSSH_B_PATH_NAME_LENGTH);
fssh_status_t InitCheck() const;
fssh_status_t SetPath(const char *path, bool normalize = false);
const char *Path() const;
fssh_size_t Length() const { return fPathLength; }
fssh_size_t BufferSize() const { return fBufferSize; }
char *LockBuffer();
void UnlockBuffer();
const char *Leaf() const;
fssh_status_t ReplaceLeaf(const char *newLeaf);
fssh_status_t Append(const char *toAppend, bool isComponent = true);
KPath& operator=(const KPath& other);
KPath& operator=(const char* path);
bool operator==(const KPath& other) const;
bool operator==(const char* path) const;
bool operator!=(const KPath& other) const;
bool operator!=(const char* path) const;
private:
void _ChopTrailingSlashes();
char* fBuffer;
fssh_size_t fBufferSize;
fssh_size_t fPathLength;
bool fLocked;
};
} // namespace FSShell
using FSShell::KPath;
#endif /* _K_PATH_H */