Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: native_client_sdk/src/libraries/nacl_mounts/path.h

Issue 12194030: Rename mount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix whitespace Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5 #ifndef LIBRARIES_NACL_MOUNTS_PATH_H_
6 #define LIBRARIES_NACL_MOUNTS_PATH_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "utils/macros.h"
12
13 typedef std::vector<std::string> StringArray_t;
14
15 class Path {
16 public:
17 Path();
18 Path(const Path& path);
19
20 // This constructor splits path by '/' as a starting point for this Path.
21 // If the path begins with the character '/', the path is considered
22 // to be absolute.
23 explicit Path(const std::string& path);
24 ~Path();
25
26
27 // Return true of the first path item is '/'.
28 bool IsAbsolute() const;
29
30 // Return a part of the path
31 const std::string& Part(size_t index) const;
32
33 // Return the number of path parts
34 size_t Size() const;
35
36 // Return true of this is the top of the path
37 bool Top() const;
38
39 // Update the path.
40 Path& Append(const std::string& path);
41 Path& Prepend(const std::string& path);
42 Path& Set(const std::string& path);
43
44 // Return the parent path.
45 Path Parent() const;
46 std::string Basename() const;
47
48 std::string Join() const;
49 std::string Range(size_t start, size_t end) const;
50 StringArray_t Split() const;
51
52 // Collapse the string list removing extraneous '.', '..' path components
53 static StringArray_t Normalize(const StringArray_t& paths);
54 static std::string Join(const StringArray_t& paths);
55 static std::string Range(const StringArray_t& paths, size_t start,
56 size_t end);
57 static StringArray_t Split(const std::string& paths);
58 // Operator versions
59 Path& operator=(const Path& p);
60 Path& operator=(const std::string& str);
61
62 private:
63 // Internal representation of the path stored an array of string representing
64 // the directory traversal. The first string is a "/" if this is an abolute
65 // path.
66 StringArray_t paths_;
67 };
68
69 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_PATH_H_
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_mounts/ostypes.h ('k') | native_client_sdk/src/libraries/nacl_mounts/path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698