Skip to content

Commit e674204

Browse files
committed
Change the boolean ints to bool #212
1 parent 37d2b61 commit e674204

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

library/json/c/include/tetengo/json/jsonParser.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#if !defined(TETENGO_JSON_JSONPARSER_H)
88
#define TETENGO_JSON_JSONPARSER_H
99

10+
#include <stdbool.h>
1011
#include <stddef.h>
1112

1213
#include <tetengo/json/element.h>
@@ -51,14 +52,14 @@ tetengo_json_jsonParser_t* tetengo_json_jsonParser_create(tetengo_json_reader_t*
5152
void tetengo_json_jsonParser_destroy(const tetengo_json_jsonParser_t* p_parser);
5253

5354
/*!
54-
\brief Returns non-zero when the next element exists.
55+
\brief Returns true when the next element exists.
5556
5657
\param p_parser A pointer to a perser.
5758
58-
\retval non-zero When the next element exists.
59-
\retval 0 Otherwise.
59+
\retval true When the next element exists.
60+
\retval false Otherwise.
6061
*/
61-
int tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* p_parser);
62+
bool tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* p_parser);
6263

6364
/*!
6465
\brief Returns the current element.

library/json/c/include/tetengo/json/reader.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#if !defined(TETENGO_JSON_READER_H)
88
#define TETENGO_JSON_READER_H
99

10+
#include <stdbool.h>
1011
#include <stddef.h>
1112

1213

@@ -93,24 +94,24 @@ void tetengo_json_reader_destroy(const tetengo_json_reader_t* p_reader);
9394
\param p_line_counting_reader A pointer to a line counting reader.
9495
\param p_location The storage for a location.
9596
96-
\retval non-zero When a location has been stored.
97-
\retval 0 When p_line_counting_reader is NULL or not a line counting reader.
98-
And/or when p_location is NULL.
99-
And/or when current position is beyond the termination point.
97+
\retval true When a location has been stored.
98+
\retval false When p_line_counting_reader is NULL or not a line counting reader.
99+
And/or when p_location is NULL.
100+
And/or when current position is beyond the termination point.
100101
*/
101-
int tetengo_json_reader_getLocation(
102+
bool tetengo_json_reader_getLocation(
102103
const tetengo_json_reader_t* p_line_counting_reader,
103104
tetengo_json_location_t* p_location);
104105

105106
/*!
106-
\brief Returns non-zero when the next character exists.
107+
\brief Returns true when the next character exists.
107108
108109
\param p_reader A pointer to a reader.
109110
110-
\retval non-zero When the next character exists.
111-
\retval 0 Otherwise.
111+
\retval true When the next character exists.
112+
\retval false Otherwise.
112113
*/
113-
int tetengo_json_reader_hasNext(const tetengo_json_reader_t* p_reader);
114+
bool tetengo_json_reader_hasNext(const tetengo_json_reader_t* p_reader);
114115

115116
/*!
116117
\brief Returns the current character.

library/json/c/src/tetengo_json_jsonParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void tetengo_json_jsonParser_destroy(const tetengo_json_jsonParser_t* const p_pa
8585
{}
8686
}
8787

88-
int tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* const p_parser)
88+
bool tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* const p_parser)
8989
{
9090
try
9191
{
@@ -94,11 +94,11 @@ int tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* const p_par
9494
throw std::invalid_argument{ "p_parser is NULL." };
9595
}
9696

97-
return p_parser->p_cpp_parser->has_next() ? 1 : 0;
97+
return p_parser->p_cpp_parser->has_next();
9898
}
9999
catch (...)
100100
{
101-
return 0;
101+
return false;
102102
}
103103
}
104104

library/json/c/src/tetengo_json_reader.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void tetengo_json_reader_destroy(const tetengo_json_reader_t* const p_reader)
131131
{}
132132
}
133133

134-
int tetengo_json_reader_getLocation(
134+
bool tetengo_json_reader_getLocation(
135135
const tetengo_json_reader_t* const p_line_counting_reader,
136136
tetengo_json_location_t* const p_location)
137137
{
@@ -159,15 +159,15 @@ int tetengo_json_reader_getLocation(
159159
p_location->line_index = cpp_location.line_index();
160160
p_location->column_index = cpp_location.column_index();
161161

162-
return 1;
162+
return true;
163163
}
164164
catch (...)
165165
{
166-
return 0;
166+
return false;
167167
}
168168
}
169169

170-
int tetengo_json_reader_hasNext(const tetengo_json_reader_t* const p_reader)
170+
bool tetengo_json_reader_hasNext(const tetengo_json_reader_t* const p_reader)
171171
{
172172
try
173173
{
@@ -176,11 +176,11 @@ int tetengo_json_reader_hasNext(const tetengo_json_reader_t* const p_reader)
176176
throw std::invalid_argument{ "p_reader is NULL." };
177177
}
178178

179-
return p_reader->cpp_reader().has_next() ? 1 : 0;
179+
return p_reader->cpp_reader().has_next();
180180
}
181181
catch (...)
182182
{
183-
return 0;
183+
return false;
184184
}
185185
}
186186

0 commit comments

Comments
 (0)