Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct pb #248

Merged
merged 65 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ac19b58
add get_members
qicosmos Apr 3, 2024
950b77e
test
qicosmos Apr 3, 2024
ab09356
for cpp17
qicosmos Apr 3, 2024
50cc22f
for cpp17
qicosmos Apr 7, 2024
81f1eac
update
qicosmos Apr 7, 2024
88ab331
update
qicosmos Apr 8, 2024
d6f7f7b
rename
qicosmos Apr 8, 2024
788c161
check size
qicosmos Apr 8, 2024
352fd67
support string
qicosmos Apr 8, 2024
f79e2db
support optional
qicosmos Apr 8, 2024
90781c3
one_of
qicosmos Apr 9, 2024
3353498
support nested message
qicosmos Apr 10, 2024
ef1d774
update
qicosmos Apr 10, 2024
7b5aa6c
support vector
qicosmos Apr 10, 2024
803ba4b
check size
qicosmos Apr 10, 2024
14c8e83
support map
qicosmos Apr 11, 2024
a622aeb
support enum
qicosmos Apr 11, 2024
0eadbeb
support name alias
qicosmos Apr 11, 2024
ba50e29
map
qicosmos Apr 12, 2024
07d6118
fix
qicosmos Apr 12, 2024
9ea0a3e
fix
qicosmos Apr 12, 2024
6fc7370
Merge branch 'master' into struct_pb
qicosmos Apr 12, 2024
66f847d
fix case
qicosmos Apr 14, 2024
f8715d9
for msvc compile
qicosmos Apr 14, 2024
9fda77e
msvc compile
qicosmos Apr 14, 2024
33e71ec
bigobj
qicosmos Apr 14, 2024
28cf2f1
test
qicosmos Apr 14, 2024
37614ef
fix
qicosmos Apr 15, 2024
1d8c07a
fix
qicosmos Apr 15, 2024
8f541f2
fix; support [double, float, bool]
bbbgan Apr 26, 2024
ddbd4a4
support precaculate the pb size
bbbgan Apr 29, 2024
1850ff1
support compile time caculate key size
bbbgan Apr 30, 2024
a009b17
struct_pb split to pb_reader and pb_writer
bbbgan May 1, 2024
d8256bf
improve pb_writer
bbbgan May 2, 2024
eadde96
Simplify code
bbbgan May 3, 2024
ee62aaa
support custom reflection struct
bbbgan May 3, 2024
11c3e29
add test with proto[struct_pb]
bbbgan May 4, 2024
9af6367
add test; fix packed value miss default value
bbbgan May 4, 2024
d316358
fix to_pb break condition; add test
bbbgan May 5, 2024
680c277
update workflow
bbbgan May 5, 2024
fbf1ca6
add map test[struct_pb]
bbbgan May 5, 2024
9bcac28
add some unusual tests; fix some[struct_pb]
bbbgan May 6, 2024
4e046a6
simplify pb_reader
bbbgan May 6, 2024
81aafed
support oneof by std::variant[struct_pb]
bbbgan May 7, 2024
46bbc22
fix warning[struct_pb]
bbbgan May 8, 2024
bda33a4
fix get_map_tuple_impl; add oneof test[struct_pb]
bbbgan May 8, 2024
0482628
remove one_of_t[struct_pb]
bbbgan May 8, 2024
eb3e2d1
add benchmark
bbbgan May 9, 2024
a0221e9
improve pb_writer[struct_pb]
bbbgan May 10, 2024
14eacc5
add pb_base to improve pb_writer; improve pb_reder [struct_pb]
bbbgan May 10, 2024
1e369a7
simplify some
qicosmos May 13, 2024
cc9f2a7
add assertions to benchmark[struct_pb]
bbbgan May 10, 2024
9dd7b1a
fix[struct_pb]
bbbgan May 13, 2024
a71d9c0
improve[struct_pb]
bbbgan May 14, 2024
83252f5
Merge pull request #273 from bbbgan/struct_pb_new
qicosmos May 14, 2024
6316384
add string resize
qicosmos May 14, 2024
019049c
format
qicosmos May 14, 2024
17513c8
use iterator in pb_writer
bbbgan May 14, 2024
cf1427f
Merge pull request #274 from bbbgan/struct_pb
qicosmos May 15, 2024
adabfaf
inline
qicosmos May 15, 2024
8acac6c
resize
qicosmos May 15, 2024
e207bb2
update benchmark
qicosmos May 15, 2024
eb87363
add more test and bench
qicosmos May 15, 2024
8400f78
fix
qicosmos May 15, 2024
2bc1b89
update
qicosmos May 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Clang Format Diff

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Ubuntu (clang)

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/linux-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Ubuntu (gcc)

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
ubuntu_gcc:
Expand All @@ -21,8 +21,11 @@ jobs:
- name: checkout gcc version
run: gcc --version

- name: Install Protobuf and Dev Package
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libprotobuf-dev

- name: configure cmake
run: CXX=g++ CC=gcc cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }}
run: CXX=g++ CC=gcc cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DHAS_PROTOBUF=ON -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }}

- name: build project
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.mode }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: macOS Monterey 12

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Windows Server 2022

on:
on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
35 changes: 34 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 2.15)
project(iguana)

message(STATUS "C++ Compiler Version: ${CMAKE_CXX_COMPILER_VERSION}")

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
add_compile_options(/utf-8)
Expand Down Expand Up @@ -33,6 +35,8 @@ message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}")

add_definitions(-DTHROW_UNKNOWN_KEY)

add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/bigobj>")

option(ENABLE_SEQUENTIAL_PARSE "parse json sequential more efficient if the json fields sequences are the same with struct fields" OFF)
if (${ENABLE_SEQUENTIAL_PARSE})
ADD_DEFINITIONS(-DSEQUENTIAL_PARSE)
Expand Down Expand Up @@ -80,6 +84,9 @@ set(YAMLBENCH benchmark/yaml_benchmark.cpp)
set(TEST_NOTHROW test/test_yaml_nothrow.cpp)
set(TEST_UTIL test/test_util.cpp)
set(TEST_XMLNOTHROW test/test_xml_nothrow.cpp)
set(TEST_PB test/test_pb.cpp)
set(TEST_PROTO test/test_proto3.cpp)
set(PB_BENCHMARK benchmark/pb_benchmark.cpp)

add_executable(json_example ${JSON_EXAMPLE})
add_executable(json_benchmark ${JSONBENCHMARK})
Expand All @@ -95,6 +102,31 @@ add_executable(test_yaml ${TEST_YAML})
add_executable(yaml_benchmark ${YAMLBENCH})
add_executable(test_nothrow ${TEST_NOTHROW})
add_executable(test_util ${TEST_UTIL})
add_executable(test_pb ${TEST_PB})

option(HAS_PROTOBUF "import protobuf" OFF)
if(HAS_PROTOBUF)
find_package(Protobuf REQUIRED)
if(Protobuf_FOUND)
message(STATUS "Found Protobuf: ${Protobuf_VERSION}")
else()
message(STATUS "Protobuf not found")
endif()

include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(PROTO_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test/proto)
file(GLOB PROTO_FILES ${PROTO_SRC_DIR}/*.proto)

protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
message(STATUS "Proto source files: ${PROTO_SRCS}")
message(STATUS "Proto header files: ${PROTO_HDRS}")

add_executable(pb_benchmark ${PB_BENCHMARK} ${PROTO_SRCS})
target_link_libraries(pb_benchmark ${Protobuf_LIBRARIES})
add_executable(test_proto ${PROTO_SRCS} ${TEST_PROTO})
target_link_libraries(test_proto ${Protobuf_LIBRARIES})
endif()

# unit test
option(BUILD_UNIT_TESTS "Build unit tests" ON)
Expand All @@ -119,4 +151,5 @@ add_test(NAME test_xml COMMAND test_xml)
add_test(NAME test_yaml COMMAND test_yaml)
add_test(NAME test_nothrow COMMAND test_nothrow)
add_test(NAME test_util COMMAND test_util)
add_test(NAME test_xml_nothrow COMMAND test_xml_nothrow)
add_test(NAME test_xml_nothrow COMMAND test_xml_nothrow)
add_test(NAME test_pb COMMAND test_pb)
Loading
Loading