Blender
V4.3
source
blender
blenlib
intern
fileops.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
9
#include "
BLI_fileops.hh
"
10
11
#ifdef WIN32
12
# include "
utfconv.hh
"
13
#endif
14
15
namespace
blender
{
16
fstream::fstream
(
const
char
*filepath, std::ios_base::openmode mode)
17
{
18
this->
open
(filepath, mode);
19
}
20
21
fstream::fstream
(
const
std::string &filepath, std::ios_base::openmode mode)
22
{
23
this->
open
(filepath, mode);
24
}
25
26
void
fstream::open
(
StringRefNull
filepath, ios_base::openmode mode)
27
{
28
#ifdef WIN32
29
const
char
*filepath_cstr = filepath.
c_str
();
30
UTF16_ENCODE
(filepath_cstr);
31
std::wstring filepath_wstr(filepath_cstr_16);
32
std::fstream::open(filepath_wstr.c_str(), mode);
33
UTF16_UN_ENCODE
(filepath_cstr);
34
#else
35
std::fstream::open(filepath, mode);
36
#endif
37
}
38
39
}
// namespace blender
BLI_fileops.hh
File and directory operations.
blender::StringRefNull
Definition
BLI_string_ref.hh:111
blender::StringRefNull::c_str
constexpr const char * c_str() const
Definition
BLI_string_ref.hh:477
blender::fstream::open
void open(StringRefNull filepath, ios_base::openmode mode=ios_base::in|ios_base::out)
Definition
fileops.cc:26
blender::fstream::fstream
fstream()=default
blender
Definition
ANIM_action.hh:36
utfconv.hh
UTF16_ENCODE
#define UTF16_ENCODE(in8str)
Definition
utfconv.hh:80
UTF16_UN_ENCODE
#define UTF16_UN_ENCODE(in8str)
Definition
utfconv.hh:84
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0