File indexing completed on 2025-01-31 10:12:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef GOOGLE_PROTOBUF_IO_IO_WIN32_H__
0025 #define GOOGLE_PROTOBUF_IO_IO_WIN32_H__
0026
0027 #if defined(_WIN32)
0028
0029 #include <functional>
0030 #include <string>
0031
0032 #include "google/protobuf/port.h"
0033
0034
0035 #include "google/protobuf/port_def.inc"
0036
0037
0038
0039 namespace google {
0040 namespace protobuf {
0041 namespace io {
0042 namespace win32 {
0043
0044 PROTOBUF_EXPORT FILE* fopen(const char* path, const char* mode);
0045 PROTOBUF_EXPORT int access(const char* path, int mode);
0046 PROTOBUF_EXPORT int chdir(const char* path);
0047 PROTOBUF_EXPORT int close(int fd);
0048 PROTOBUF_EXPORT int dup(int fd);
0049 PROTOBUF_EXPORT int dup2(int fd1, int fd2);
0050 PROTOBUF_EXPORT int mkdir(const char* path, int _mode);
0051 PROTOBUF_EXPORT int open(const char* path, int flags, int mode = 0);
0052 PROTOBUF_EXPORT int read(int fd, void* buffer, size_t size);
0053 PROTOBUF_EXPORT int setmode(int fd, int mode);
0054 PROTOBUF_EXPORT int stat(const char* path, struct _stat* buffer);
0055 PROTOBUF_EXPORT int write(int fd, const void* buffer, size_t size);
0056 PROTOBUF_EXPORT std::wstring testonly_utf8_to_winpath(const char* path);
0057
0058 enum class ExpandWildcardsResult {
0059 kSuccess = 0,
0060 kErrorNoMatchingFile = 1,
0061 kErrorInputPathConversion = 2,
0062 kErrorOutputPathConversion = 3,
0063 };
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 PROTOBUF_EXPORT ExpandWildcardsResult ExpandWildcards(
0074 const std::string& path, std::function<void(const std::string&)> consume);
0075
0076 namespace strings {
0077
0078
0079 PROTOBUF_EXPORT bool wcs_to_mbs(const wchar_t* s, std::string* out,
0080 bool outUtf8);
0081
0082
0083 PROTOBUF_EXPORT bool mbs_to_wcs(const char* s, std::wstring* out, bool inUtf8);
0084
0085
0086 PROTOBUF_EXPORT bool utf8_to_wcs(const char* input, std::wstring* out);
0087
0088
0089 PROTOBUF_EXPORT bool wcs_to_utf8(const wchar_t* input, std::string* out);
0090
0091 }
0092
0093 }
0094 }
0095 }
0096 }
0097
0098 #ifndef W_OK
0099 #define W_OK 02
0100 #endif
0101
0102 #ifndef F_OK
0103 #define F_OK 00
0104 #endif
0105
0106 #ifndef STDIN_FILENO
0107 #define STDIN_FILENO 0
0108 #endif
0109
0110 #ifndef STDOUT_FILENO
0111 #define STDOUT_FILENO 1
0112 #endif
0113
0114 #include "google/protobuf/port_undef.inc"
0115
0116 #endif
0117
0118 #endif