Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
7c385a48
Commit
7c385a48
authored
6 years ago
by
Antonio Borondo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error: 'wide_string_input_helper' was not declared in this scope
parent
9ba3f796
develop
bon8
coverity_scan
feature/optional
gcc_warning_flags
icpc
issue2228
issue2615
issue2932
issue3232_use_catch
master
release/3.10.2
release/3.10.3
release/3.10.4
release/3.10.5
string_view
string_view2
update_doctest
3.6.1
3.3.0
v3.10.5
v3.10.4
v3.10.3
v3.10.2
v3.10.1
v3.10.0
v3.9.1
v3.9.0
v3.8.0
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.1
v3.6.0
v3.5.0
v3.4.0
v3.3.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
90 deletions
+92
-90
include/nlohmann/detail/input/input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+45
-45
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+47
-45
No files found.
include/nlohmann/detail/input/input_adapters.hpp
View file @
7c385a48
...
@@ -115,51 +115,6 @@ class input_buffer_adapter : public input_adapter_protocol
...
@@ -115,51 +115,6 @@ class input_buffer_adapter : public input_adapter_protocol
const
char
*
const
limit
;
const
char
*
const
limit
;
};
};
template
<
typename
WideStringType
>
class
wide_string_input_adapter
:
public
input_adapter_protocol
{
public:
explicit
wide_string_input_adapter
(
const
WideStringType
&
w
)
:
str
(
w
)
{}
std
::
char_traits
<
char
>::
int_type
get_character
()
noexcept
override
{
// check if buffer needs to be filled
if
(
utf8_bytes_index
==
utf8_bytes_filled
)
{
fill_buffer
<
sizeof
(
typename
WideStringType
::
value_type
)
>
();
assert
(
utf8_bytes_filled
>
0
);
assert
(
utf8_bytes_index
==
0
);
}
// use buffer
assert
(
utf8_bytes_filled
>
0
);
assert
(
utf8_bytes_index
<
utf8_bytes_filled
);
return
utf8_bytes
[
utf8_bytes_index
++
];
}
private:
template
<
size_t
T
>
void
fill_buffer
()
{
wide_string_input_helper
<
WideStringType
,
T
>::
fill_buffer
(
str
,
current_wchar
,
utf8_bytes
,
utf8_bytes_index
,
utf8_bytes_filled
);
}
/// the wstring to process
const
WideStringType
&
str
;
/// index of the current wchar in str
std
::
size_t
current_wchar
=
0
;
/// a buffer for UTF-8 bytes
std
::
array
<
std
::
char_traits
<
char
>::
int_type
,
4
>
utf8_bytes
=
{{
0
,
0
,
0
,
0
}};
/// index to the utf8_codes array for the next valid byte
std
::
size_t
utf8_bytes_index
=
0
;
/// number of valid bytes in the utf8_codes array
std
::
size_t
utf8_bytes_filled
=
0
;
};
namespace
namespace
{
{
template
<
typename
WideStringType
,
size_t
T
>
template
<
typename
WideStringType
,
size_t
T
>
...
@@ -279,6 +234,51 @@ namespace
...
@@ -279,6 +234,51 @@ namespace
};
};
}
}
template
<
typename
WideStringType
>
class
wide_string_input_adapter
:
public
input_adapter_protocol
{
public:
explicit
wide_string_input_adapter
(
const
WideStringType
&
w
)
:
str
(
w
)
{}
std
::
char_traits
<
char
>::
int_type
get_character
()
noexcept
override
{
// check if buffer needs to be filled
if
(
utf8_bytes_index
==
utf8_bytes_filled
)
{
fill_buffer
<
sizeof
(
typename
WideStringType
::
value_type
)
>
();
assert
(
utf8_bytes_filled
>
0
);
assert
(
utf8_bytes_index
==
0
);
}
// use buffer
assert
(
utf8_bytes_filled
>
0
);
assert
(
utf8_bytes_index
<
utf8_bytes_filled
);
return
utf8_bytes
[
utf8_bytes_index
++
];
}
private:
template
<
size_t
T
>
void
fill_buffer
()
{
wide_string_input_helper
<
WideStringType
,
T
>::
fill_buffer
(
str
,
current_wchar
,
utf8_bytes
,
utf8_bytes_index
,
utf8_bytes_filled
);
}
/// the wstring to process
const
WideStringType
&
str
;
/// index of the current wchar in str
std
::
size_t
current_wchar
=
0
;
/// a buffer for UTF-8 bytes
std
::
array
<
std
::
char_traits
<
char
>::
int_type
,
4
>
utf8_bytes
=
{{
0
,
0
,
0
,
0
}};
/// index to the utf8_codes array for the next valid byte
std
::
size_t
utf8_bytes_index
=
0
;
/// number of valid bytes in the utf8_codes array
std
::
size_t
utf8_bytes_filled
=
0
;
};
class
input_adapter
class
input_adapter
{
{
public:
public:
...
...
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
7c385a48
...
@@ -1993,51 +1993,6 @@ class input_buffer_adapter : public input_adapter_protocol
...
@@ -1993,51 +1993,6 @@ class input_buffer_adapter : public input_adapter_protocol
const char* const limit;
const char* const limit;
};
};
template
<
typename
WideStringType
>
class
wide_string_input_adapter
:
public
input_adapter_protocol
{
public:
explicit
wide_string_input_adapter
(
const
WideStringType
&
w
)
:
str
(
w
)
{}
std
::
char_traits
<
char
>::
int_type
get_character
()
noexcept
override
{
// check if buffer needs to be filled
if
(
utf8_bytes_index
==
utf8_bytes_filled
)
{
fill_buffer
<
sizeof
(
typename
WideStringType
::
value_type
)
>
();
assert
(
utf8_bytes_filled
>
0
);
assert
(
utf8_bytes_index
==
0
);
}
// use buffer
assert
(
utf8_bytes_filled
>
0
);
assert
(
utf8_bytes_index
<
utf8_bytes_filled
);
return
utf8_bytes
[
utf8_bytes_index
++
];
}
private:
template
<
size_t
T
>
void
fill_buffer
()
{
wide_string_input_helper
<
WideStringType
,
T
>::
fill_buffer
(
str
,
current_wchar
,
utf8_bytes
,
utf8_bytes_index
,
utf8_bytes_filled
);
}
/// the wstring to process
const
WideStringType
&
str
;
/// index of the current wchar in str
std
::
size_t
current_wchar
=
0
;
/// a buffer for UTF-8 bytes
std
::
array
<
std
::
char_traits
<
char
>::
int_type
,
4
>
utf8_bytes
=
{{
0
,
0
,
0
,
0
}};
/// index to the utf8_codes array for the next valid byte
std
::
size_t
utf8_bytes_index
=
0
;
/// number of valid bytes in the utf8_codes array
std
::
size_t
utf8_bytes_filled
=
0
;
};
namespace
namespace
{
{
template<typename WideStringType, size_t T>
template<typename WideStringType, size_t T>
...
@@ -2157,6 +2112,53 @@ namespace
...
@@ -2157,6 +2112,53 @@ namespace
};
};
}
}
template<typename WideStringType>
class wide_string_input_adapter : public input_adapter_protocol
{
public:
explicit wide_string_input_adapter(const WideStringType& w) : str(w) {}
std::char_traits<char>::int_type get_character() noexcept override
{
// check if buffer needs to be filled
if (utf8_bytes_index == utf8_bytes_filled)
{
fill_buffer<sizeof(typename WideStringType::value_type)>();
assert(utf8_bytes_filled > 0);
assert(utf8_bytes_index == 0);
}
// use buffer
assert(utf8_bytes_filled > 0);
assert(utf8_bytes_index < utf8_bytes_filled);
return utf8_bytes[utf8_bytes_index++];
}
private:
template<size_t T>
void fill_buffer()
{
wide_string_input_helper<WideStringType, T>::fill_buffer(str, current_wchar, utf8_bytes, utf8_bytes_index, utf8_bytes_filled);
}
/// the wstring to process
const WideStringType& str;
/// index of the current wchar in str
std::size_t current_wchar = 0;
/// a buffer for UTF-8 bytes
std::array<std::char_traits<char>::int_type, 4> utf8_bytes = {{0, 0, 0, 0}};
/// index to the utf8_codes array for the next valid byte
std::size_t utf8_bytes_index = 0;
/// number of valid bytes in the utf8_codes array
std::size_t utf8_bytes_filled = 0;
};
class input_adapter
class input_adapter
{
{
public:
public:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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