2 * Copyright 2002-2012, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
9 #include <Flattenable.h>
11 #include <StorageDefs.h>
14 // Forward declarations
20 class BPath
: public BFlattenable
{
23 BPath(const BPath
& path
);
24 BPath(const entry_ref
* ref
);
25 BPath(const BEntry
* entry
);
26 BPath(const char* dir
, const char* leaf
= NULL
,
27 bool normalize
= false);
28 BPath(const BDirectory
* dir
,
29 const char* leaf
= NULL
,
30 bool normalize
= false);
34 status_t
InitCheck() const;
36 status_t
SetTo(const entry_ref
* ref
);
37 status_t
SetTo(const BEntry
* entry
);
38 status_t
SetTo(const char* path
, const char* leaf
= NULL
,
39 bool normalize
= false);
40 status_t
SetTo(const BDirectory
* dir
,
41 const char* leaf
= NULL
,
42 bool normalize
= false);
45 status_t
Append(const char* path
, bool normalize
= false);
47 const char* Path() const;
48 const char* Leaf() const;
49 status_t
GetParent(BPath
* path
) const;
50 bool IsAbsolute() const;
52 bool operator==(const BPath
& item
) const;
53 bool operator==(const char* path
) const;
54 bool operator!=(const BPath
& item
) const;
55 bool operator!=(const char* path
) const;
56 BPath
& operator=(const BPath
& item
);
57 BPath
& operator=(const char* path
);
59 // BFlattenable protocol
60 virtual bool IsFixedSize() const;
61 virtual type_code
TypeCode() const;
62 virtual ssize_t
FlattenedSize() const;
63 virtual status_t
Flatten(void* buffer
, ssize_t size
) const;
64 virtual bool AllowsTypeCode(type_code code
) const;
65 virtual status_t
Unflatten(type_code code
, const void* buffer
,
69 virtual void _WarPath1();
70 virtual void _WarPath2();
71 virtual void _WarPath3();
73 status_t
_SetPath(const char* path
);
74 static bool _MustNormalize(const char* path
, status_t
* _error
);
79 // Pointer to the path string of the object.
81 // The initialization status of the object.