Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
畅游知识海洋
json
提交
5bc1b656
J
json
项目概览
畅游知识海洋
/
json
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
json
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5bc1b656
编写于
12月 14, 2015
作者:
N
Niels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean up (for #154)
上级
258f04c5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
1 addition
and
299 deletion
+1
-299
Makefile
Makefile
+1
-1
src/json.hpp
src/json.hpp
+0
-149
src/json.hpp.re2c
src/json.hpp.re2c
+0
-149
未找到文件。
Makefile
浏览文件 @
5bc1b656
...
...
@@ -17,7 +17,7 @@ clean:
##########################################################################
# additional flags
FLAGS
=
-Wall
-Wextra
-pedantic
-Weffc
++
-Wcast-align
-Wcast-qual
-Wctor-dtor-privacy
-Wdisabled-optimization
-Wformat
=
2
-Winit-self
-Wmissing-declarations
-Wmissing-include-dirs
-Wold-style-cast
-Woverloaded-virtual
-Wredundant-decls
-Wshadow
-Wsign-conversion
-Wsign-promo
-Wstrict-overflow
=
5
-Wswitch
-W
switch-enum
-Wswitch-default
-W
undef
-Wno-unused
-Wnon-virtual-dtor
-Wreorder
-Wdeprecated
-Wfloat-equal
FLAGS
=
-Wall
-Wextra
-pedantic
-Weffc
++
-Wcast-align
-Wcast-qual
-Wctor-dtor-privacy
-Wdisabled-optimization
-Wformat
=
2
-Winit-self
-Wmissing-declarations
-Wmissing-include-dirs
-Wold-style-cast
-Woverloaded-virtual
-Wredundant-decls
-Wshadow
-Wsign-conversion
-Wsign-promo
-Wstrict-overflow
=
5
-Wswitch
-Wundef
-Wno-unused
-Wnon-virtual-dtor
-Wreorder
-Wdeprecated
-Wfloat-equal
# build unit tests
json_unit
:
test/unit.cpp src/json.hpp test/catch.hpp
...
...
src/json.hpp
浏览文件 @
5bc1b656
...
...
@@ -686,8 +686,6 @@ class basic_json
break
;
}
case
value_t
::
null
:
case
value_t
::
discarded
:
default:
{
break
;
...
...
@@ -1494,10 +1492,6 @@ class basic_json
break
;
}
case
value_t
::
array
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
object
:
default:
{
break
;
...
...
@@ -1542,8 +1536,6 @@ class basic_json
break
;
}
case
value_t
::
discarded
:
case
value_t
::
null
:
default:
{
throw
std
::
domain_error
(
"cannot use construct with iterators from "
+
first
.
m_object
->
type_name
());
...
...
@@ -1614,8 +1606,6 @@ class basic_json
break
;
}
case
value_t
::
discarded
:
case
value_t
::
null
:
default:
{
break
;
...
...
@@ -1719,11 +1709,6 @@ class basic_json
break
;
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
default:
{
// all other types need no specific destructor
...
...
@@ -2169,12 +2154,6 @@ class basic_json
return
static_cast
<
T
>
(
m_value
.
number_float
);
}
case
value_t
::
array
:
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
object
:
case
value_t
::
string
:
default:
{
throw
std
::
domain_error
(
"type must be number, but is "
+
type_name
());
...
...
@@ -2874,8 +2853,6 @@ class basic_json
break
;
}
case
value_t
::
discarded
:
case
value_t
::
null
:
default:
{
throw
std
::
domain_error
(
"cannot use erase() with "
+
type_name
());
...
...
@@ -2971,8 +2948,6 @@ class basic_json
break
;
}
case
value_t
::
discarded
:
case
value_t
::
null
:
default:
{
throw
std
::
domain_error
(
"cannot use erase with "
+
type_name
());
...
...
@@ -3380,11 +3355,6 @@ class basic_json
return
m_value
.
object
->
empty
();
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
// all other types are nonempty
...
...
@@ -3439,11 +3409,6 @@ class basic_json
return
m_value
.
object
->
size
();
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
// all other types have size 1
...
...
@@ -3496,12 +3461,6 @@ class basic_json
return
m_value
.
object
->
max_size
();
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
// all other types have max_size() == size()
...
...
@@ -3583,8 +3542,6 @@ class basic_json
break
;
}
case
value_t
::
discarded
:
case
value_t
::
null
:
default:
{
break
;
...
...
@@ -4099,8 +4056,6 @@ class basic_json
return
lhs
.
m_value
.
number_integer
==
rhs
.
m_value
.
number_integer
;
case
value_t
::
number_float
:
return
approx
(
lhs
.
m_value
.
number_float
,
rhs
.
m_value
.
number_float
);
case
value_t
::
discarded
:
return
false
;
default:
return
false
;
}
...
...
@@ -4242,8 +4197,6 @@ class basic_json
return
lhs
.
m_value
.
number_integer
<
rhs
.
m_value
.
number_integer
;
case
value_t
::
number_float
:
return
lhs
.
m_value
.
number_float
<
rhs
.
m_value
.
number_float
;
case
value_t
::
discarded
:
return
false
;
default:
return
false
;
}
...
...
@@ -4527,8 +4480,6 @@ class basic_json
return
"discarded"
;
}
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
default:
{
return
"number"
;
...
...
@@ -4839,11 +4790,6 @@ class basic_json
o
<<
"null"
;
return
;
}
default:
{
return
;
}
}
}
...
...
@@ -4991,12 +4937,6 @@ class basic_json
break
;
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
m_it
.
primitive_iterator
=
primitive_iterator_t
();
...
...
@@ -5022,12 +4962,6 @@ class basic_json
break
;
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
m_it
.
primitive_iterator
=
other
.
m_it
.
primitive_iterator
;
...
...
@@ -5079,11 +5013,6 @@ class basic_json
break
;
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
m_it
.
primitive_iterator
.
set_begin
();
...
...
@@ -5109,12 +5038,6 @@ class basic_json
break
;
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
m_it
.
primitive_iterator
.
set_end
();
...
...
@@ -5144,11 +5067,6 @@ class basic_json
throw
std
::
out_of_range
(
"cannot get value"
);
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
if
(
m_it
.
primitive_iterator
.
is_begin
())
...
...
@@ -5178,12 +5096,6 @@ class basic_json
return
&*
m_it
.
array_iterator
;
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
if
(
m_it
.
primitive_iterator
.
is_begin
())
...
...
@@ -5224,12 +5136,6 @@ class basic_json
break
;
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
++
m_it
.
primitive_iterator
;
...
...
@@ -5266,12 +5172,6 @@ class basic_json
break
;
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
--
m_it
.
primitive_iterator
;
...
...
@@ -5303,12 +5203,6 @@ class basic_json
return
(
m_it
.
array_iterator
==
other
.
m_it
.
array_iterator
);
}
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
return
(
m_it
.
primitive_iterator
==
other
.
m_it
.
primitive_iterator
);
...
...
@@ -5343,12 +5237,6 @@ class basic_json
return
(
m_it
.
array_iterator
<
other
.
m_it
.
array_iterator
);
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
return
(
m_it
.
primitive_iterator
<
other
.
m_it
.
primitive_iterator
);
...
...
@@ -5390,12 +5278,6 @@ class basic_json
break
;
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
m_it
.
primitive_iterator
+=
i
;
...
...
@@ -5443,12 +5325,6 @@ class basic_json
return
m_it
.
array_iterator
-
other
.
m_it
.
array_iterator
;
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
null
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
return
m_it
.
primitive_iterator
-
other
.
m_it
.
primitive_iterator
;
...
...
@@ -5476,11 +5352,6 @@ class basic_json
throw
std
::
out_of_range
(
"cannot get value"
);
}
case
basic_json
::
value_t
::
boolean
:
case
basic_json
::
value_t
::
discarded
:
case
basic_json
::
value_t
::
number_float
:
case
basic_json
::
value_t
::
number_integer
:
case
basic_json
::
value_t
::
string
:
default:
{
if
(
m_it
.
primitive_iterator
==
-
n
)
...
...
@@ -5827,12 +5698,6 @@ class basic_json
}
/// use an empty key for all primitive types
case
value_t
::
boolean
:
case
value_t
::
discarded
:
case
value_t
::
null
:
case
value_t
::
number_float
:
case
value_t
::
number_integer
:
case
value_t
::
string
:
default:
{
return
""
;
...
...
@@ -6035,8 +5900,6 @@ class basic_json
return
"<end of input>"
;
case
token_type
::
parse_error
:
return
"<parse error>"
;
default:
return
""
;
}
}
...
...
@@ -6987,11 +6850,6 @@ basic_json_parser_64:
}
break
;
}
default:
{
break
;
}
}
}
else
...
...
@@ -7288,13 +7146,6 @@ basic_json_parser_64:
break
;
}
case
lexer
::
token_type
::
end_array
:
case
lexer
::
token_type
::
end_object
:
case
lexer
::
token_type
::
end_of_input
:
case
lexer
::
token_type
::
name_separator
:
case
lexer
::
token_type
::
parse_error
:
case
lexer
::
token_type
::
uninitialized
:
case
lexer
::
token_type
::
value_separator
:
default:
{
// the last token was unexpected
...
...
src/json.hpp.re2c
浏览文件 @
5bc1b656
...
...
@@ -686,8 +686,6 @@ class basic_json
break;
}
case value_t::null:
case value_t::discarded:
default:
{
break;
...
...
@@ -1494,10 +1492,6 @@ class basic_json
break;
}
case value_t::array:
case value_t::discarded:
case value_t::null:
case value_t::object:
default:
{
break;
...
...
@@ -1542,8 +1536,6 @@ class basic_json
break;
}
case value_t::discarded:
case value_t::null:
default:
{
throw std::domain_error("cannot use construct with iterators from " + first.m_object->type_name());
...
...
@@ -1614,8 +1606,6 @@ class basic_json
break;
}
case value_t::discarded:
case value_t::null:
default:
{
break;
...
...
@@ -1719,11 +1709,6 @@ class basic_json
break;
}
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::number_float:
case value_t::number_integer:
default:
{
// all other types need no specific destructor
...
...
@@ -2169,12 +2154,6 @@ class basic_json
return static_cast<T>(m_value.number_float);
}
case value_t::array:
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::object:
case value_t::string:
default:
{
throw std::domain_error("type must be number, but is " + type_name());
...
...
@@ -2874,8 +2853,6 @@ class basic_json
break;
}
case value_t::discarded:
case value_t::null:
default:
{
throw std::domain_error("cannot use erase() with " + type_name());
...
...
@@ -2971,8 +2948,6 @@ class basic_json
break;
}
case value_t::discarded:
case value_t::null:
default:
{
throw std::domain_error("cannot use erase with " + type_name());
...
...
@@ -3380,11 +3355,6 @@ class basic_json
return m_value.object->empty();
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
// all other types are nonempty
...
...
@@ -3439,11 +3409,6 @@ class basic_json
return m_value.object->size();
}
case value_t::boolean:
case value_t::discarded:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
// all other types have size 1
...
...
@@ -3496,12 +3461,6 @@ class basic_json
return m_value.object->max_size();
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
// all other types have max_size() == size()
...
...
@@ -3583,8 +3542,6 @@ class basic_json
break;
}
case value_t::discarded:
case value_t::null:
default:
{
break;
...
...
@@ -4099,8 +4056,6 @@ class basic_json
return lhs.m_value.number_integer == rhs.m_value.number_integer;
case value_t::number_float:
return approx(lhs.m_value.number_float, rhs.m_value.number_float);
case value_t::discarded:
return false;
default:
return false;
}
...
...
@@ -4242,8 +4197,6 @@ class basic_json
return lhs.m_value.number_integer < rhs.m_value.number_integer;
case value_t::number_float:
return lhs.m_value.number_float < rhs.m_value.number_float;
case value_t::discarded:
return false;
default:
return false;
}
...
...
@@ -4527,8 +4480,6 @@ class basic_json
return "discarded";
}
case value_t::number_float:
case value_t::number_integer:
default:
{
return "number";
...
...
@@ -4839,11 +4790,6 @@ class basic_json
o << "null";
return;
}
default:
{
return;
}
}
}
...
...
@@ -4991,12 +4937,6 @@ class basic_json
break;
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
m_it.primitive_iterator = primitive_iterator_t();
...
...
@@ -5022,12 +4962,6 @@ class basic_json
break;
}
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
m_it.primitive_iterator = other.m_it.primitive_iterator;
...
...
@@ -5079,11 +5013,6 @@ class basic_json
break;
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
m_it.primitive_iterator.set_begin();
...
...
@@ -5109,12 +5038,6 @@ class basic_json
break;
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
m_it.primitive_iterator.set_end();
...
...
@@ -5144,11 +5067,6 @@ class basic_json
throw std::out_of_range("cannot get value");
}
case value_t::boolean:
case value_t::discarded:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
if (m_it.primitive_iterator.is_begin())
...
...
@@ -5178,12 +5096,6 @@ class basic_json
return &*m_it.array_iterator;
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
if (m_it.primitive_iterator.is_begin())
...
...
@@ -5224,12 +5136,6 @@ class basic_json
break;
}
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
++m_it.primitive_iterator;
...
...
@@ -5266,12 +5172,6 @@ class basic_json
break;
}
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
--m_it.primitive_iterator;
...
...
@@ -5303,12 +5203,6 @@ class basic_json
return (m_it.array_iterator == other.m_it.array_iterator);
}
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
return (m_it.primitive_iterator == other.m_it.primitive_iterator);
...
...
@@ -5343,12 +5237,6 @@ class basic_json
return (m_it.array_iterator < other.m_it.array_iterator);
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
return (m_it.primitive_iterator < other.m_it.primitive_iterator);
...
...
@@ -5390,12 +5278,6 @@ class basic_json
break;
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
m_it.primitive_iterator += i;
...
...
@@ -5443,12 +5325,6 @@ class basic_json
return m_it.array_iterator - other.m_it.array_iterator;
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::null:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
return m_it.primitive_iterator - other.m_it.primitive_iterator;
...
...
@@ -5476,11 +5352,6 @@ class basic_json
throw std::out_of_range("cannot get value");
}
case basic_json::value_t::boolean:
case basic_json::value_t::discarded:
case basic_json::value_t::number_float:
case basic_json::value_t::number_integer:
case basic_json::value_t::string:
default:
{
if (m_it.primitive_iterator == -n)
...
...
@@ -5827,12 +5698,6 @@ class basic_json
}
/// use an empty key for all primitive types
case value_t::boolean:
case value_t::discarded:
case value_t::null:
case value_t::number_float:
case value_t::number_integer:
case value_t::string:
default:
{
return "";
...
...
@@ -6035,8 +5900,6 @@ class basic_json
return "<end of input>";
case token_type::parse_error:
return "<parse error>";
default:
return "";
}
}
...
...
@@ -6266,11 +6129,6 @@ class basic_json
}
break;
}
default:
{
break;
}
}
}
else
...
...
@@ -6567,13 +6425,6 @@ class basic_json
break;
}
case lexer::token_type::end_array:
case lexer::token_type::end_object:
case lexer::token_type::end_of_input:
case lexer::token_type::name_separator:
case lexer::token_type::parse_error:
case lexer::token_type::uninitialized:
case lexer::token_type::value_separator:
default:
{
// the last token was unexpected
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录