dom/filesystem/FileSystemUtils.h

changeset 2
7e26c7da4463
equal deleted inserted replaced
-1:000000000000 0:514ba4ee494a
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef mozilla_dom_FileSystemUtils_h
8 #define mozilla_dom_FileSystemUtils_h
9
10 #include "nsString.h"
11
12 namespace mozilla {
13 namespace dom {
14
15 #define FILESYSTEM_DOM_PATH_SEPARATOR "/"
16
17 /*
18 * This class is for error handling.
19 * All methods in this class are static.
20 */
21 class FileSystemUtils
22 {
23 public:
24 /*
25 * Convert the path separator to "/".
26 */
27 static void
28 LocalPathToNormalizedPath(const nsAString& aLocal, nsAString& aNorm);
29
30 /*
31 * Convert the normalized path separator "/" to the system dependent path
32 * separator, which is "/" on Mac and Linux, and "\" on Windows.
33 */
34 static void
35 NormalizedPathToLocalPath(const nsAString& aNorm, nsAString& aLocal);
36
37 /*
38 * Return true if aDescendantPath is a descendant of aPath. Both aPath and
39 * aDescendantPath are absolute DOM path.
40 */
41 static bool
42 IsDescendantPath(const nsAString& aPath, const nsAString& aDescendantPath);
43
44 static bool
45 IsParentProcess();
46
47 static const char16_t kSeparatorChar = char16_t('/');
48 };
49
50 } // namespace dom
51 } // namespace mozilla
52
53 #endif // mozilla_dom_FileSystemUtils_h

mercurial