2004-10-28 01:41:16 +04:00
|
|
|
// 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);
|
2004-10-29 02:16:41 +04:00
|
|
|
KPath(const char* path, bool normalize = false,
|
|
|
|
int32 bufferSize = B_PATH_NAME_LENGTH);
|
2004-10-28 01:41:16 +04:00
|
|
|
KPath(const KPath& other);
|
|
|
|
~KPath();
|
|
|
|
|
2004-10-29 02:16:41 +04:00
|
|
|
status_t SetTo(const char *path, bool normalize = false,
|
|
|
|
int32 bufferSize = B_PATH_NAME_LENGTH);
|
2004-10-28 01:41:16 +04:00
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
2004-10-29 02:16:41 +04:00
|
|
|
status_t SetPath(const char *path, bool normalize = false);
|
2004-10-28 19:09:48 +04:00
|
|
|
const char *Path() const;
|
2004-10-28 01:41:16 +04:00
|
|
|
int32 Length() const;
|
|
|
|
|
|
|
|
int32 BufferSize() const;
|
|
|
|
char *LockBuffer();
|
|
|
|
void UnlockBuffer();
|
|
|
|
|
2004-10-28 19:09:48 +04:00
|
|
|
const char *Leaf() const;
|
|
|
|
status_t ReplaceLeaf(const char *newLeaf);
|
|
|
|
|
|
|
|
status_t Append(const char *toAppend, bool isComponent = true);
|
2004-10-28 01:41:16 +04:00
|
|
|
|
|
|
|
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:
|
2004-10-28 19:09:48 +04:00
|
|
|
void _ChopTrailingSlashes();
|
|
|
|
|
2004-10-28 01:41:16 +04:00
|
|
|
char* fBuffer;
|
|
|
|
int32 fBufferSize;
|
|
|
|
int32 fPathLength;
|
|
|
|
bool fLocked;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DiskDevice
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
using BPrivate::DiskDevice::KPath;
|
|
|
|
|
2004-11-04 18:51:27 +03:00
|
|
|
#endif /* _K_PATH_H */
|