Skip to content

Commit b9413fa

Browse files
committed
Обновлена используемая версия simstr
1 parent 79e738a commit b9413fa

7 files changed

Lines changed: 45 additions & 29 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
cmake_minimum_required(VERSION 3.20)
2+
cmake_minimum_required(VERSION 3.20)
23
include(cmake/prelude.cmake)
34
include(CMakeDependentOption)
45
include(FetchContent)
56

67
project(
78
simjson
8-
VERSION 1.2.3
9+
VERSION 1.2.4
910
DESCRIPTION "Very simple json library"
1011
HOMEPAGE_URL "https://github.com/orefkov/simjson"
1112
LANGUAGES CXX
@@ -67,8 +68,8 @@ function(add_simstr)
6768
simstr
6869
GIT_REPOSITORY https://github.com/orefkov/simstr.git
6970
GIT_SHALLOW TRUE
70-
GIT_TAG tags/rel1.2.6
71-
FIND_PACKAGE_ARGS NAMES simstr
71+
GIT_TAG e62493a #tags/rel1.6.6
72+
FIND_PACKAGE_ARGS NAMES "simstr 1.6.7"
7273
)
7374
FetchContent_MakeAvailable(simstr)
7475
endfunction()
@@ -91,13 +92,17 @@ if(SIMJSON_BUILD_TESTS)
9192
FetchContent_Declare(
9293
googletest
9394
# Specify the commit you depend on and update it regularly.
94-
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
95-
FIND_PACKAGE_ARGS NAMES GTest
95+
URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.zip
96+
FIND_PACKAGE_ARGS NAMES "GTest 1.17.0"
9697
)
9798
# For Windows: Prevent overriding the parent project's compiler/linker settings
9899
set(gtest_force_shared_crt FALSE CACHE BOOL "" FORCE)
99100
FetchContent_MakeAvailable(googletest)
100101
add_subdirectory(tests)
102+
if(TARGET gtest)
103+
target_compile_features(gtest PUBLIC cxx_std_23)
104+
target_compile_features(gtest_main PUBLIC cxx_std_23)
105+
endif()
101106
endif()
102107

103108
# ---- Install rules ----

docs/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "simjson"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 1.2.1
51+
PROJECT_NUMBER = 1.2.4
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewers a

docs/Doxyfile_ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "simjson"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 1.2.1
51+
PROJECT_NUMBER = 1.2.4
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewers a

include/simjson/json.h

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* (c) Проект "SimJson", Александр Орефков orefkov@gmail.com
33
* ver. 1.0
44
* Классы для работы с JSON
@@ -96,7 +96,7 @@ concept JsonType = std::is_integral_v<std::remove_cvref_t<T>> ||
9696
std::is_constructible_v<sstring<K>, T>;
9797

9898
template<typename T, typename K>
99-
concept JsonKeyType = std::convertible_to<T, simple_str<K>> ||
99+
concept JsonKeyType = std::convertible_to<T, str_src<K>> ||
100100
std::same_as<std::remove_cvref_t<T>, KeyType<K>>;
101101

102102
template<typename T, typename K>
@@ -753,7 +753,13 @@ class JsonValueTempl : public Json {
753753
* JsonParseResult - parsing error code, Success if successful;
754754
* unsigned line, unsigned col - in case of an error, these are the line/column numbers where the error occurred.
755755
*/
756-
static std::tuple<json_value, JsonParseResult, unsigned, unsigned> parse(ssType jsonString);
756+
struct parse_result {
757+
json_value value;
758+
JsonParseResult err;
759+
unsigned line;
760+
unsigned col;
761+
};
762+
static parse_result parse(ssType jsonString);
757763
/*!
758764
* @ru @brief Сериализовать json-значение в строку.
759765
* @param stream - строка, в которую сохранять.
@@ -891,23 +897,26 @@ struct StreamedJsonParser : StreamedJsonParserBase {
891897
};
892898

893899
template<typename K>
894-
std::tuple<JsonValueTempl<K>, JsonParseResult, unsigned, unsigned> JsonValueTempl<K>::parse(ssType jsonString) {
900+
JsonValueTempl<K>::parse_result JsonValueTempl<K>::parse(ssType jsonString) {
895901
StreamedJsonParser<K> parser;
896902
auto res = parser.parseAll(jsonString);
897903
return {std::move(parser.result_), res, parser.line_, parser.col_};
898904
}
899905

900-
/// @ru Алиас для JsonValue с символами u8s.
901-
/// @en Alias ​​for JsonValue with u8s characters.
906+
/// @ru Алиас для JsonValue с символами char.
907+
/// @en Alias ​​for JsonValue with char characters.
902908
using JsonValue = JsonValueTempl<u8s>;
903-
/// @ru Алиас для JsonValue с символами uws.
904-
/// @en Alias ​​for JsonValue with uws symbols.
909+
/// @ru Алиас для JsonValue с символами char8_t.
910+
/// @en Alias ​​for JsonValue with char8_t characters.
911+
using JsonValueB = JsonValueTempl<ubs>;
912+
/// @ru Алиас для JsonValue с символами wchar_t.
913+
/// @en Alias ​​for JsonValue with wchar_tsymbols.
905914
using JsonValueW = JsonValueTempl<uws>;
906-
/// @ru Алиас для JsonValue с символами u16s.
907-
/// @en Alias ​​for JsonValue with u16s characters.
915+
/// @ru Алиас для JsonValue с символами char16_t.
916+
/// @en Alias ​​for JsonValue with char16_t characters.
908917
using JsonValueU = JsonValueTempl<u16s>;
909-
/// @ru Алиас для JsonValue с символами u32s.
910-
/// @en Alias ​​for JsonValue with u32s characters.
918+
/// @ru Алиас для JsonValue с символами char32_t.
919+
/// @en Alias ​​for JsonValue with char32_t characters.
911920
using JsonValueUU = JsonValueTempl<u32s>;
912921

913922
/// @ru Один объект "пустышка".

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Designed to work with JSON when using the [simstr](https://github.com/orefkov/simstr) library.
55

6-
Version 1.2.3.
6+
Version 1.2.4.
77

88
<span class="obfuscator"><a href="readme_ru.md">On Russian | По-русски</a></span>
99

@@ -15,6 +15,9 @@ for working with small config files - read, modify, write. However, it also cope
1515
For json objects, `std::unordered_map` is used, in the form of `hashStrMap<K, JsonValueTemp<K>>`,
1616
for arrays - `std::vector<JsonValueTemp<K>>`, strings are stored in `sstring<K>`.
1717

18+
## Generated documentation
19+
[Located here](https://orefkov.github.io/simjson/docs_en/)
20+
1821
## Key features of the library
1922
- Works with all simstr strings.
2023
- Supports working with strings `char`, `char16_t`, `char32_t`, `wchar_t`.
@@ -180,6 +183,3 @@ void read_config_from_file(ssa folder, ssa file_name) {
180183
EXPECT_EQ(json2.store(false, true), "{\"four\":4,\"one\":1,\"three\":3,\"two\":2}");
181184

182185
```
183-
184-
## Generated documentation
185-
[Located here](https://snegopat.ru/simjson/docs/en/)

readme_ru.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Предназначена для работы с JSON при использовании библиотеки [simstr](https://github.com/orefkov/simstr).
55

6-
Версия 1.2.3.
6+
Версия 1.2.4.
77

88
<span class="obfuscator"><a href="readme.md">On English | По-английски</a></span>
99

@@ -15,6 +15,9 @@
1515
Для json-объектов используется `std::unordered_map`, в лице `hashStrMap<K, JsonValueTemp<K>>`,
1616
для массивов - `std::vector<JsonValueTemp<K>>`, строки хранятся в `sstring<K>`.
1717

18+
## Сгенерированная документация
19+
[Находится здесь](https://orefkov.github.io/simjson/docs_ru/)
20+
1821
## Основные возможности библиотеки
1922
- Работает со всеми строками simstr.
2023
- Поддерживает работу со строками `char`, `char16_t`, `char32_t`, `wchar_t`.
@@ -180,6 +183,3 @@ void read_config_from_file(ssa folder, ssa file_name) {
180183
EXPECT_EQ(json2.store(false, true), "{\"four\":4,\"one\":1,\"three\":3,\"two\":2}");
181184

182185
```
183-
184-
## Сгенерированная документация
185-
[Находится здесь](https://snegopat.ru/simjson/docs/ru/)

src/json.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ SIMJSON_API typename JsonValueTempl<K>::strType JsonValueTempl<K>::to_text() con
363363
return e_num<K>(val_.integer);
364364
case Real:
365365
if constexpr (is_one_of_std_char_v<K>) {
366-
return e_real<K>(val_.real);
366+
return e_num<K>(val_.real);
367367
} else {
368-
return lstringa<64>{e_real<u8s>(val_.real)};
368+
return lstringa<64>{e_num<u8s>(val_.real)};
369369
}
370370
default:
371371
return {};
@@ -1146,11 +1146,13 @@ stringa get_file_content(stra filePath) {
11461146

11471147
// Явно инстанцируем шаблоны для этих типов
11481148
template class JsonValueTempl<u8s>;
1149+
//template class JsonValueTempl<ubs>;
11491150
template class JsonValueTempl<u16s>;
11501151
template class JsonValueTempl<u32s>;
11511152
template class JsonValueTempl<wchar_t>;
11521153

11531154
template struct StreamedJsonParser<u8s>;
1155+
template struct StreamedJsonParser<ubs>;
11541156
template struct StreamedJsonParser<u16s>;
11551157
template struct StreamedJsonParser<u32s>;
11561158
template struct StreamedJsonParser<wchar_t>;

0 commit comments

Comments
 (0)