FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rstudio/src/cpp/core/BoostErrors.cpp at master · pearsonca/rstudio · GitHub
pearsonca
/
rstudio
Public
forked from
rstudio/rstudio
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
rstudio
/
src
/
cpp
/
core
/
BoostErrors.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
213 lines (163 loc) · 4.54 KB
Breadcrumbs
rstudio
/
src
/
cpp
/
core
/
BoostErrors.cpp
Copy path
File metadata and controls
213 lines (163 loc) · 4.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
* BoostErrors.cpp
*
* Copyright (C) 2009-12 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/
#
include
<
core/BoostErrors.hpp
>
#
include
<
core/BoostThread.hpp
>
//
we define BOOST_USE_WINDOWS_H on mingw64 to work around some
//
incompatabilities. however, this prevents the interprocess headers
//
from compiling so we undef it in this localized context
#
if
defined(__GNUC__) && defined(_WIN64)
#
undef
BOOST_USE_WINDOWS_H
#
endif
#
include
<
boost/interprocess/errors.hpp
>
#
include
<
boost/interprocess/exceptions.hpp
>
using
namespace
boost
::system
;
namespace
RSTUDIO_BOOST_NAMESPACE
{
namespace
interprocess
{
class
interprocess_error_category
:
public
error_category
{
public:
const
char
*
name
()
const
BOOST_NOEXCEPT;
std::string
message
(
int
ev)
const
;
};
const
error_category&
interprocess_category
()
{
static
interprocess_error_category interprocessCategoryConst ;
return
interprocessCategoryConst ;
}
const
char
*
interprocess_error_category::name
()
const
BOOST_NOEXCEPT
{
return
"
interprocess
"
;
}
std::string
interprocess_error_category::message
(
int
ev)
const
{
std::string message ;
switch
(ev)
{
case
no_error:
message =
"
No error
"
;
break
;
case
system_error:
message =
"
System error
"
;
break
;
case
other_error:
message =
"
Library generated error
"
;
break
;
case
security_error:
message =
"
Security error
"
;
break
;
case
read_only_error:
message =
"
Read only error
"
;
break
;
case
io_error:
message =
"
IO error
"
;
break
;
case
path_error:
message =
"
Path error
"
;
break
;
case
not_found_error:
message =
"
Not found error
"
;
break
;
case
busy_error:
message =
"
Busy error
"
;
break
;
case
already_exists_error:
message =
"
Already exists error
"
;
break
;
case
not_empty_error:
message =
"
Not empty error
"
;
break
;
case
is_directory_error:
message =
"
Is directory error
"
;
break
;
case
out_of_space_error:
message =
"
Out of space error
"
;
break
;
case
out_of_memory_error:
message =
"
Out of memory error
"
;
break
;
case
out_of_resource_error:
message =
"
Out of resource error
"
;
break
;
case
lock_error:
message =
"
Lock error
"
;
break
;
case
sem_error:
message =
"
Sem error
"
;
break
;
case
mode_error:
message =
"
Mode error
"
;
break
;
case
size_error:
message =
"
Size error
"
;
break
;
case
corrupted_error:
message =
"
Corrupted error
"
;
break
;
default
:
message =
"
Unknown error
"
;
break
;
}
return
message ;
}
boost::system::error_code
ec_from_exception
(
const
interprocess_exception& e)
{
if
(e.
get_error_code
() == system_error)
return
error_code
(e.
get_native_error
(),
system_category
()) ;
else
return
error_code
(e.
get_error_code
(),
interprocess_category
()) ;
}
}
//
namespace interprocess
//
thread_error
namespace
thread_error
{
namespace
errc
{
enum
errc_t
{
thread_resource_error =
1
};
}
//
namespace thread_errc
class
thread_error_category
:
public
error_category
{
public:
const
char
*
name
()
const
BOOST_NOEXCEPT;
std::string
message
(
int
ev)
const
;
};
const
error_category&
thread_category
()
{
static
thread_error_category threadCategoryConst ;
return
threadCategoryConst ;
}
const
char
*
thread_error_category::name
()
const
BOOST_NOEXCEPT
{
return
"
thread
"
;
}
std::string
thread_error_category::message
(
int
ev)
const
{
std::string message ;
switch
(ev)
{
//
only one error code for now
case
errc::thread_resource_error:
default
:
message =
"
Thread resource error
"
;
break
;
}
return
message ;
}
boost::system::error_code
ec_from_exception
(
const
boost::thread_resource_error& e)
{
return
error_code
(errc::thread_resource_error,
thread_category
()) ;
}
}
//
namespace thread_error
}
//
namespace boost
Back
|
FazBrowse Home
|
New Git URL