haiku/headers/private/kernel/fs/KPath.h
Ingo Weinhold d68a188e6d Added class KPath. Convenient wrapper for a fixed-sized path buffer.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9541 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:41:16 +00:00

55 lines
1.1 KiB
C++

// KPath.h
//
// A simple class wrapping a path. Has a fixed-sized buffer.
#ifndef _K_PATH_H
#define _K_PATH_H
#include <KernelExport.h>
namespace BPrivate {
namespace DiskDevice {
class KPath {
public:
KPath(int32 bufferSize = B_PATH_NAME_LENGTH);
KPath(const char* path, int32 bufferSize = B_PATH_NAME_LENGTH);
KPath(const KPath& other);
~KPath();
status_t SetTo(const char *path, int32 bufferSize = B_PATH_NAME_LENGTH);
status_t InitCheck() const;
status_t SetPath(const char *path);
const char* Path() const;
int32 Length() const;
int32 BufferSize() const;
char *LockBuffer();
void UnlockBuffer();
status_t Append(const char *component);
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:
char* fBuffer;
int32 fBufferSize;
int32 fPathLength;
bool fLocked;
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KPath;
#endif _K_PATH_H