Lagrange
Loading...
Searching...
No Matches
filesystem.h
1/*
2 * Copyright 2020 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/fs/detail/guess_backend.h>
15
16#if defined(LAGRANGE_USE_STD_FS)
17
18 #include <filesystem>
19 #include <fstream>
20namespace lagrange {
21namespace fs {
22using namespace std::filesystem;
23using ifstream = std::ifstream;
24using ofstream = std::ofstream;
25using fstream = std::fstream;
26} // namespace fs
27} // namespace lagrange
28
29#elif defined(LAGRANGE_USE_GHC_FS)
30
31// clang-format off
32#include <lagrange/utils/warnoff.h>
33#include <ghc/fs_fwd.hpp>
34#include <lagrange/utils/warnon.h>
35// clang-format on
36
37namespace lagrange {
38namespace fs {
39using namespace ghc::filesystem;
40using ifstream = ghc::filesystem::ifstream;
41using ofstream = ghc::filesystem::ofstream;
42using fstream = ghc::filesystem::fstream;
43} // namespace fs
44} // namespace lagrange
45
46#elif defined(LAGRANGE_USE_BOOST_FS)
47
48 #include <boost/filesystem.hpp>
49 #include <boost/filesystem/fstream.hpp>
50
51namespace lagrange {
52namespace fs {
53using namespace boost::filesystem;
54using boost::filesystem::fstream;
55using boost::filesystem::ifstream;
56using boost::filesystem::ofstream;
57} // namespace fs
58} // namespace lagrange
59
60#else
61
62 #error Impossible situation occurred. Either LAGRANGE_USE_STD_FS, LAGRANGE_USE_GHC_FS, or LAGRANGE_USE_BOOST_FS should be defined at this point
63
64#endif
Main namespace for Lagrange.