Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Praetorius, Simon
dune-common-extensions
Commits
9cd294a7
Commit
9cd294a7
authored
Jan 01, 2019
by
Praetorius, Simon
Browse files
CI test configuration added
parent
428bde89
Pipeline
#1597
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
9cd294a7
---
include
:
-
"
https://gitlab.dune-project.org/core/ci-config/raw/master/config/common/master.yml"
-
"
https://gitlab.dune-project.org/core/ci-config/raw/master/jobs/common/master.yml"
before_script
:
-
. /duneci/bin/duneci-init-job
-
duneci-install-module https://gitlab.dune-project.org/core/dune-common.git
dune/common/std/charconv.hh
View file @
9cd294a7
...
...
@@ -77,7 +77,9 @@ namespace Dune
{
std
::
istringstream
s
(
std
::
string
(
first
,
last
));
s
.
imbue
(
std
::
locale
::
classic
());
// make sure we are in locale "C"
manipulator
(
s
);
auto
manipulator_error
=
manipulator
(
s
);
if
(
manipulator_error
)
return
from_chars_result
{
first
,
std
::
errc
{
manipulator_error
.
value
()}};
try
{
s
>>
value
;
// extract value
...
...
@@ -103,7 +105,9 @@ namespace Dune
{
std
::
ostringstream
s
;
s
.
imbue
(
std
::
locale
::
classic
());
// make sure we are in locale "C"
manipulator
(
s
);
auto
manipulator_error
=
manipulator
(
s
);
if
(
manipulator_error
)
return
to_chars_result
{
last
,
std
::
errc
{
manipulator_error
.
value
()}};
// negative integer values in base != 10 are not correctly converted
bool
sign
=
value
<
T
(
0
);
...
...
@@ -132,7 +136,11 @@ namespace Dune
std
::
enable_if_t
<
std
::
is_integral
<
T
>
::
value
,
int
>
=
0
>
from_chars_result
from_chars
(
const
char
*
first
,
const
char
*
last
,
T
&
value
,
int
base
=
10
)
{
return
Impl
::
fromCharsImpl
(
first
,
last
,
value
,
[
base
](
auto
&
s
)
{
s
>>
std
::
setbase
(
base
);
});
return
Impl
::
fromCharsImpl
(
first
,
last
,
value
,
[
base
](
auto
&
s
)
->
std
::
error_code
{
s
>>
std
::
setbase
(
base
);
return
{};
});
}
/// \brief Converts a character sequence to a floating-point value
...
...
@@ -141,7 +149,7 @@ namespace Dune
from_chars_result
from_chars
(
const
char
*
first
,
const
char
*
last
,
T
&
value
,
chars_format
fmt
=
chars_format
::
general
)
{
return
Impl
::
fromCharsImpl
(
first
,
last
,
value
,
[
fmt
](
auto
&
s
)
return
Impl
::
fromCharsImpl
(
first
,
last
,
value
,
[
fmt
](
auto
&
s
)
->
std
::
error_code
{
if
((
int
(
fmt
)
&
int
(
chars_format
::
scientific
))
!=
0
)
s
>>
std
::
scientific
;
...
...
@@ -149,9 +157,10 @@ namespace Dune
s
>>
std
::
fixed
;
if
((
int
(
fmt
)
&
int
(
chars_format
::
hex
))
!=
0
)
{
s
>>
std
::
hexfloat
;
DUNE_THROW
(
NotImplemen
ted
,
"
Reading hexfloat values not supported by many standard libraries currently
."
);
return
std
::
make_error_code
(
std
::
errc
::
not_suppor
ted
);
//
Reading hexfloat values not supported by many standard libraries currently
}
return
{};
});
}
...
...
@@ -161,7 +170,11 @@ namespace Dune
std
::
enable_if_t
<
std
::
is_integral
<
T
>
::
value
,
int
>
=
0
>
to_chars_result
to_chars
(
char
*
first
,
char
*
last
,
T
value
,
int
base
=
10
)
{
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[
base
](
auto
&
s
)
{
s
<<
std
::
setbase
(
base
);
});
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[
base
](
auto
&
s
)
->
std
::
error_code
{
s
<<
std
::
setbase
(
base
);
return
{};
});
}
/// \brief Converts a floating-point value to a character sequence
...
...
@@ -169,7 +182,7 @@ namespace Dune
std
::
enable_if_t
<
std
::
is_floating_point
<
T
>
::
value
,
int
>
=
0
>
to_chars_result
to_chars
(
char
*
first
,
char
*
last
,
T
value
)
{
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[](
auto
&
/*s*/
)
{
});
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[](
auto
&
/*s*/
)
->
std
::
error_code
{
return
{};
});
}
/// \brief Converts a floating-point value to a character sequence with additional format specifier
...
...
@@ -177,7 +190,7 @@ namespace Dune
std
::
enable_if_t
<
std
::
is_floating_point
<
T
>
::
value
,
int
>
=
0
>
to_chars_result
to_chars
(
char
*
first
,
char
*
last
,
T
value
,
chars_format
fmt
)
{
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[
fmt
](
auto
&
s
)
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[
fmt
](
auto
&
s
)
->
std
::
error_code
{
if
((
int
(
fmt
)
&
int
(
chars_format
::
scientific
))
!=
0
)
s
<<
std
::
scientific
;
...
...
@@ -185,6 +198,7 @@ namespace Dune
s
<<
std
::
fixed
;
if
((
int
(
fmt
)
&
int
(
chars_format
::
hex
))
!=
0
)
s
<<
std
::
hexfloat
;
return
{};
});
}
...
...
@@ -193,7 +207,7 @@ namespace Dune
std
::
enable_if_t
<
std
::
is_floating_point
<
T
>
::
value
,
int
>
=
0
>
to_chars_result
to_chars
(
char
*
first
,
char
*
last
,
T
value
,
chars_format
fmt
,
int
precision
)
{
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[
fmt
,
precision
](
auto
&
s
)
return
Impl
::
toCharsImpl
(
first
,
last
,
value
,
[
fmt
,
precision
](
auto
&
s
)
->
std
::
error_code
{
s
<<
std
::
setprecision
(
precision
);
if
((
int
(
fmt
)
&
int
(
chars_format
::
scientific
))
!=
0
)
...
...
@@ -202,6 +216,7 @@ namespace Dune
s
<<
std
::
fixed
;
if
((
int
(
fmt
)
&
int
(
chars_format
::
hex
))
!=
0
)
s
<<
std
::
hexfloat
;
return
{};
});
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment