FreeNOS
FileSystemPath.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIB_LIBFS_FILESYSTEMPATH_H
19#define __LIB_LIBFS_FILESYSTEMPATH_H
20
21#include <List.h>
22#include <ListIterator.h>
23#include <Types.h>
24#include <String.h>
25
38{
39 private:
40
42 static const char DefaultSeparator = '/';
43
44 public:
45
47 static const Size MaximumLength = 64u;
48
49 public:
50
57 FileSystemPath(const char *path,
58 const char separator = DefaultSeparator);
59
65 const String & parent() const;
66
72 const String & base() const;
73
79 const String & full() const;
80
86 const List<String> & split() const;
87
93 Size length() const;
94
95 private:
96
98 const char m_separator;
99
102
105
108
111};
112
118#endif /* __LIB_LIBFS_FILESYSTEMPATH_H */
Simple filesystem path parser.
const List< String > m_path
The path split in pieces by the separator.
const String & full() const
Get the full path as a String.
static const Size MaximumLength
Maximum length of a filesystem path in bytes.
String m_parent
Full path to our parent.
static const char DefaultSeparator
The default path separator character.
const List< String > & split() const
Returns a List of separate path elements.
const String & parent() const
Retrieve the full path of our parent.
const String m_full
Full input path.
const char m_separator
Separator character.
const String m_base
Last element in the full path.
Size length() const
Get Length of our full path.
const String & base() const
The name of the last element in the path.
Simple linked list template class.
Definition List.h:37
Abstraction of strings.
Definition String.h:42
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128