Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
畅游知识海洋
json
提交
4e443900
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,发现更多精彩内容 >>
提交
4e443900
编写于
12月 29, 2014
作者:
N
Niels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
+ fixed a bug in the stream input
上级
15a9d3cf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
7 deletion
+20
-7
.gitignore
.gitignore
+2
-0
Makefile.am
Makefile.am
+5
-1
benchmark/parse.cc
benchmark/parse.cc
+8
-0
src/JSON.cc
src/JSON.cc
+5
-6
未找到文件。
.gitignore
浏览文件 @
4e443900
...
...
@@ -34,3 +34,5 @@ test-driver
Makefile.in
*.plist
json_parser
Makefile.am
浏览文件 @
4e443900
noinst_PROGRAMS
=
json_unit
noinst_PROGRAMS
=
json_unit
json_parser
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
...
...
@@ -6,6 +6,10 @@ json_unit_SOURCES = src/JSON.cc src/JSON.h test/catch.hpp test/JSON_unit.cc
json_unit_CXXFLAGS
=
$(FLAGS)
-std
=
c++11
json_unit_CPPFLAGS
=
-I
$(top_srcdir)
/src
-I
$(top_srcdir)
/test
-Dprivate
=
public
json_parser_SOURCES
=
src/JSON.cc src/JSON.h benchmark/parse.cc
json_parser_CXXFLAGS
=
$(FLAGS)
-std
=
c++11
json_parser_CPPFLAGS
=
-I
$(top_srcdir)
/src
-I
$(top_srcdir)
/benchmark
cppcheck
:
cppcheck
--enable
=
all
--inconclusive
--std
=
c++11 src/JSON.
*
...
...
benchmark/parse.cc
0 → 100644
浏览文件 @
4e443900
#include "JSON.h"
int
main
()
{
JSON
j
;
j
<<
std
::
cin
;
return
0
;
}
src/JSON.cc
浏览文件 @
4e443900
...
...
@@ -1775,14 +1775,13 @@ Initialize the JSON parser given an input stream \p _is.
*/
JSON
::
Parser
::
Parser
(
std
::
istream
&
_is
)
{
// determine length of input stream
_is
.
seekg
(
0
,
std
::
ios
::
end
);
_length
=
static_cast
<
size_t
>
(
_is
.
tellg
());
_is
.
seekg
(
0
,
std
::
ios
::
beg
);
// copy stream to string
std
::
istreambuf_iterator
<
char
>
eos
;
std
::
string
string_input
(
std
::
istreambuf_iterator
<
char
>
(
_is
),
eos
);
// copy stream to buffer
_length
=
string_input
.
size
();
_buffer
=
new
char
[
_length
+
1
];
_is
.
read
(
_buffer
,
static_cast
<
std
::
streamsize
>
(
_length
));
std
::
strcpy
(
_buffer
,
string_input
.
c_str
(
));
// read first character
next
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录