OpenShot Library | libopenshot
0.4.0
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
o
p
q
r
s
t
v
w
Functions
Variables
Typedefs
Enumerations
Enumerator
a
b
c
e
f
g
h
l
m
p
r
s
t
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Related Functions
Files
File List
File Members
All
_
a
c
e
f
h
i
k
m
n
o
p
q
r
s
t
u
Functions
Variables
Typedefs
Macros
_
a
e
f
h
i
k
m
n
o
p
q
r
s
t
u
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Json.cpp
Go to the documentation of this file.
1
9
// Copyright (c) 2008-2019 OpenShot Studios, LLC
10
//
11
// SPDX-License-Identifier: LGPL-3.0-or-later
12
13
#include "
Json.h
"
14
#include "
Exceptions.h
"
15
16
const
Json::Value
openshot::stringToJson
(
const
std::string value) {
17
18
// Parse JSON string into JSON objects
19
Json::Value root;
20
Json::CharReaderBuilder rbuilder;
21
Json::CharReader* reader(rbuilder.newCharReader());
22
23
std::string errors;
24
bool
success = reader->parse( value.c_str(), value.c_str() + value.size(),
25
&root, &errors );
26
delete
reader;
27
28
if
(!success)
29
// Raise exception
30
throw
openshot::InvalidJSON
(
"JSON could not be parsed (or is invalid)"
);
31
32
return
root;
33
}
openshot::stringToJson
const Json::Value stringToJson(const std::string value)
Definition:
Json.cpp:16
openshot::InvalidJSON
Exception for invalid JSON.
Definition:
Exceptions.h:217
Json.h
Header file for JSON class.
Exceptions.h
Header file for all Exception classes.
Generated by
1.8.17