vfs: check userland buffers before reading them.
[haiku.git] / src / kits / debugger / files / LocatableDirectory.cpp
blobe149da73c6fcef085fd35e9214f99cc1a3c2b356
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "LocatableDirectory.h"
9 LocatableDirectory::LocatableDirectory(LocatableEntryOwner* owner,
10 LocatableDirectory* parent, const BString& path)
12 LocatableEntry(owner, parent),
13 fPath(path),
14 fLocatedPath()
19 LocatableDirectory::~LocatableDirectory()
24 const char*
25 LocatableDirectory::Name() const
27 int32 lastSlash = fPath.FindLast('/');
28 // return -1, if not found
29 return fPath.String() + (lastSlash + 1);
33 const char*
34 LocatableDirectory::Path() const
36 return fPath.String();
40 void
41 LocatableDirectory::GetPath(BString& _path) const
43 _path = fPath;
47 bool
48 LocatableDirectory::GetLocatedPath(BString& _path) const
50 if (fLocatedPath.Length() == 0)
51 return false;
52 _path = fLocatedPath;
53 return true;
57 void
58 LocatableDirectory::SetLocatedPath(const BString& path, bool implicit)
60 fLocatedPath = path;
61 fState = implicit
62 ? LOCATABLE_ENTRY_LOCATED_IMPLICITLY
63 : LOCATABLE_ENTRY_LOCATED_EXPLICITLY;
67 void
68 LocatableDirectory::AddEntry(LocatableEntry* entry)
70 fEntries.Add(entry);
74 void
75 LocatableDirectory::RemoveEntry(LocatableEntry* entry)
77 fEntries.Remove(entry);