WPILibC++  unspecified
FileSystem.h
1 //===- llvm/Support/FileSystem.h - File System OS Concept -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the llvm::sys::fs namespace. It is designed after
11 // TR2/boost filesystem (v3), but modified to remove exception handling and the
12 // path class.
13 //
14 // All functions return an error_code and their actual work via the last out
15 // argument. The out argument is defined if and only if errc::success is
16 // returned. A function may return any error code in the generic or system
17 // category. However, they shall be equivalent to any error conditions listed
18 // in each functions respective documentation if the condition applies. [ note:
19 // this does not guarantee that error_code will be in the set of explicitly
20 // listed codes, but it does guarantee that if any of the explicitly listed
21 // errors occur, the correct error_code will be used ]. All functions may
22 // return errc::not_enough_memory if there is not enough memory to complete the
23 // operation.
24 //
25 //===----------------------------------------------------------------------===//
26 
27 #ifndef LLVM_SUPPORT_FILESYSTEM_H
28 #define LLVM_SUPPORT_FILESYSTEM_H
29 
30 #include "llvm/Twine.h"
31 #include <system_error>
32 
33 namespace llvm {
34 
35 template <typename T> class SmallVectorImpl;
36 
37 namespace sys {
38 namespace fs {
39 
42 
43 enum OpenFlags : unsigned {
44  F_None = 0,
45 
48  F_Excl = 1,
49 
53  F_Append = 2,
54 
57  F_Text = 4,
58 
60  F_RW = 8
61 };
62 
63 inline OpenFlags operator|(OpenFlags A, OpenFlags B) {
64  return OpenFlags(unsigned(A) | unsigned(B));
65 }
66 
67 inline OpenFlags &operator|=(OpenFlags &A, OpenFlags B) {
68  A = A | B;
69  return A;
70 }
71 
72 std::error_code openFileForWrite(const Twine &Name, int &ResultFD,
73  OpenFlags Flags, unsigned Mode = 0666);
74 
75 std::error_code openFileForRead(const Twine &Name, int &ResultFD,
76  SmallVectorImpl<char> *RealPath = nullptr);
77 
79 
80 } // end namespace fs
81 } // end namespace sys
82 } // end namespace llvm
83 
84 #endif // LLVM_SUPPORT_FILESYSTEM_H
Definition: Path.inc:27