Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
畅游知识海洋
json
提交
83f1d2c8
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,发现更多精彩内容 >>
未验证
提交
83f1d2c8
编写于
2月 19, 2017
作者:
N
Niels Lohmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
added start index for from_cbor and from_msgpack (#462)
上级
4151f2d2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
57 addition
and
23 deletion
+57
-23
src/json.hpp
src/json.hpp
+24
-11
src/json.hpp.re2c
src/json.hpp.re2c
+24
-11
test/src/unit-cbor.cpp
test/src/unit-cbor.cpp
+4
-0
test/src/unit-msgpack.cpp
test/src/unit-msgpack.cpp
+4
-0
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+1
-1
未找到文件。
src/json.hpp
浏览文件 @
83f1d2c8
...
...
@@ -7917,9 +7917,11 @@ class basic_json
vector in MessagePack format.,to_msgpack}
@sa http://msgpack.org
@sa @ref from_msgpack(const std::vector<uint8_t>&
) for the analogous
deserialization
@sa @ref from_msgpack(const std::vector<uint8_t>&
, const size_t) for the
analogous
deserialization
@sa @ref to_cbor(const basic_json& for the related CBOR format
@since version 2.0.9
*/
static
std
::
vector
<
uint8_t
>
to_msgpack
(
const
basic_json
&
j
)
{
...
...
@@ -7935,6 +7937,7 @@ class basic_json
serialization format.
@param[in] v a byte vector in MessagePack format
@param[in] start_index the index to start reading from @a v (0 by default)
@return deserialized JSON value
@throw std::invalid_argument if unsupported features from MessagePack were
...
...
@@ -7948,11 +7951,15 @@ class basic_json
@sa http://msgpack.org
@sa @ref to_msgpack(const basic_json&) for the analogous serialization
@sa @ref from_cbor(const std::vector<uint8_t>&) for the related CBOR format
@sa @ref from_cbor(const std::vector<uint8_t>&, const size_t) for the
related CBOR format
@since version 2.0.9, parameter @a start_index since 2.0.11
*/
static
basic_json
from_msgpack
(
const
std
::
vector
<
uint8_t
>&
v
)
static
basic_json
from_msgpack
(
const
std
::
vector
<
uint8_t
>&
v
,
const
size_t
start_index
=
0
)
{
size_t
i
=
0
;
size_t
i
=
start_index
;
return
from_msgpack_internal
(
v
,
i
);
}
...
...
@@ -7973,9 +7980,11 @@ class basic_json
vector in CBOR format.,to_cbor}
@sa http://cbor.io
@sa @ref from_cbor(const std::vector<uint8_t>&
) for the analogous
deserialization
@sa @ref from_cbor(const std::vector<uint8_t>&
, const size_t) for the
analogous
deserialization
@sa @ref to_msgpack(const basic_json& for the related MessagePack format
@since version 2.0.9
*/
static
std
::
vector
<
uint8_t
>
to_cbor
(
const
basic_json
&
j
)
{
...
...
@@ -7991,6 +8000,7 @@ class basic_json
(Concise Binary Object Representation) serialization format.
@param[in] v a byte vector in CBOR format
@param[in] start_index the index to start reading from @a v (0 by default)
@return deserialized JSON value
@throw std::invalid_argument if unsupported features from CBOR were used in
...
...
@@ -8004,12 +8014,15 @@ class basic_json
@sa http://cbor.io
@sa @ref to_cbor(const basic_json&) for the analogous serialization
@sa @ref from_msgpack(const std::vector<uint8_t>&) for the related
MessagePack format
@sa @ref from_msgpack(const std::vector<uint8_t>&, const size_t) for the
related MessagePack format
@since version 2.0.9, parameter @a start_index since 2.0.11
*/
static
basic_json
from_cbor
(
const
std
::
vector
<
uint8_t
>&
v
)
static
basic_json
from_cbor
(
const
std
::
vector
<
uint8_t
>&
v
,
const
size_t
start_index
=
0
)
{
size_t
i
=
0
;
size_t
i
=
start_index
;
return
from_cbor_internal
(
v
,
i
);
}
...
...
src/json.hpp.re2c
浏览文件 @
83f1d2c8
...
...
@@ -7917,9 +7917,11 @@ class basic_json
vector in MessagePack format.,to_msgpack}
@sa http://msgpack.org
@sa @ref from_msgpack(const std::vector<uint8_t>&
) for the analogous
deserialization
@sa @ref from_msgpack(const std::vector<uint8_t>&
, const size_t) for the
analogous
deserialization
@sa @ref to_cbor(const basic_json& for the related CBOR format
@since version 2.0.9
*/
static std::vector<uint8_t> to_msgpack(const basic_json& j)
{
...
...
@@ -7935,6 +7937,7 @@ class basic_json
serialization format.
@param[in] v a byte vector in MessagePack format
@param[in] start_index the index to start reading from @a v (0 by default)
@return deserialized JSON value
@throw std::invalid_argument if unsupported features from MessagePack were
...
...
@@ -7948,11 +7951,15 @@ class basic_json
@sa http://msgpack.org
@sa @ref to_msgpack(const basic_json&) for the analogous serialization
@sa @ref from_cbor(const std::vector<uint8_t>&) for the related CBOR format
@sa @ref from_cbor(const std::vector<uint8_t>&, const size_t) for the
related CBOR format
@since version 2.0.9, parameter @a start_index since 2.0.11
*/
static basic_json from_msgpack(const std::vector<uint8_t>& v)
static basic_json from_msgpack(const std::vector<uint8_t>& v,
const size_t start_index = 0)
{
size_t i =
0
;
size_t i =
start_index
;
return from_msgpack_internal(v, i);
}
...
...
@@ -7973,9 +7980,11 @@ class basic_json
vector in CBOR format.,to_cbor}
@sa http://cbor.io
@sa @ref from_cbor(const std::vector<uint8_t>&
) for the analogous
deserialization
@sa @ref from_cbor(const std::vector<uint8_t>&
, const size_t) for the
analogous
deserialization
@sa @ref to_msgpack(const basic_json& for the related MessagePack format
@since version 2.0.9
*/
static std::vector<uint8_t> to_cbor(const basic_json& j)
{
...
...
@@ -7991,6 +8000,7 @@ class basic_json
(Concise Binary Object Representation) serialization format.
@param[in] v a byte vector in CBOR format
@param[in] start_index the index to start reading from @a v (0 by default)
@return deserialized JSON value
@throw std::invalid_argument if unsupported features from CBOR were used in
...
...
@@ -8004,12 +8014,15 @@ class basic_json
@sa http://cbor.io
@sa @ref to_cbor(const basic_json&) for the analogous serialization
@sa @ref from_msgpack(const std::vector<uint8_t>&) for the related
MessagePack format
@sa @ref from_msgpack(const std::vector<uint8_t>&, const size_t) for the
related MessagePack format
@since version 2.0.9, parameter @a start_index since 2.0.11
*/
static basic_json from_cbor(const std::vector<uint8_t>& v)
static basic_json from_cbor(const std::vector<uint8_t>& v,
const size_t start_index = 0)
{
size_t i =
0
;
size_t i =
start_index
;
return from_cbor_internal(v, i);
}
...
...
test/src/unit-cbor.cpp
浏览文件 @
83f1d2c8
...
...
@@ -1184,6 +1184,10 @@ TEST_CASE("single CBOR roundtrip")
// compare parsed JSON values
CHECK
(
j1
==
j2
);
// check with different start index
packed
.
insert
(
packed
.
begin
(),
5
,
0xff
);
CHECK
(
j1
==
json
::
from_cbor
(
packed
,
5
));
}
}
...
...
test/src/unit-msgpack.cpp
浏览文件 @
83f1d2c8
...
...
@@ -1039,6 +1039,10 @@ TEST_CASE("single MessagePack roundtrip")
// compare parsed JSON values
CHECK
(
j1
==
j2
);
// check with different start index
packed
.
insert
(
packed
.
begin
(),
5
,
0xff
);
CHECK
(
j1
==
json
::
from_msgpack
(
packed
,
5
));
}
}
...
...
test/src/unit-regression.cpp
浏览文件 @
83f1d2c8
...
...
@@ -385,7 +385,7 @@ TEST_CASE("regression tests")
{
return
'.'
;
}
std
::
string
do_grouping
()
const
{
return
"
\03
"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录