Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include <string>
#include <type_traits>
 
// for std::tolower or std::towlower
#ifdef _WIN32
#include <cwctype>
#else
#include <cctype>
#endif
 
// for converting / printing ORT_TSTR path strings to std::string
#ifdef _WIN32
#define ORT_TSTR_CONVERT_TO_PRINTABLE_STRING(X) std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(X)
#define ORT_TSTR_CONVERT_FROM_STRING(X) std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(X);
#else
#define ORT_TSTR_CONVERT_TO_PRINTABLE_STRING(X) X
#define ORT_TSTR_CONVERT_FROM_STRING(X) X
#endif
 
#include "core/common/common.h"
#include "core/session/onnxruntime_c_api.h"
 
namespace onnxruntime {
 
// char type for filesystem paths
using PathChar = ORTCHAR_T;
// string type for filesystem paths
using PathString = std::basic_string<PathChar>;
 
inline PathString ToPathString(const PathString& s) {
  return s;
}
 
#ifdef _WIN32
 
static_assert(std::is_same<PathString, std::wstring>::value, "PathString is not std::wstring!");
 
inline PathString ToPathString(std::string_view s) {
  return ToWideString(s);
}
inline PathString ToPathString(const char* s) {
  return ToWideString(s);
}
inline PathString ToPathString(const std::string& s) {
  return ToWideString(s);
}
 
inline PathChar ToLowerPathChar(PathChar c) {
  return std::towlower(c);
}
 
inline std::string PathToUTF8String(const PathString& s) {
  return ToUTF8String(s);
}
 
#else
 
static_assert(std::is_same<PathString, std::string>::value, "PathString is not std::string!");
 
inline PathString ToPathString(const char* s) {
  return s;
}
 
inline PathString ToPathString(std::string_view s) {
  return PathString{s};
}
 
inline PathChar ToLowerPathChar(PathChar c) {
  return std::tolower(c);
}
 
inline std::string PathToUTF8String(const PathString& s) {
  return s;
}
 
#endif
 
}  // namespace onnxruntime