So I've recently wrote a C++ class that allows you to use some Python-like syntax in your C++ projects.
It's called PyData and it makes it really simple to create and manipulate JSON-like data-structures.
https://gitlab.com/brunowonder/pydata-class
Can you believe this is C++ code???
Full example: https://gitlab.com/brunowonder/pydata-class/blob/master/functest.cpp
It sure looks like Python, doesn't it? Well, that's because it (also) is!
It's MIT licensed, so feel free to use and abuse it!
Testing (Linux):
It's called PyData and it makes it really simple to create and manipulate JSON-like data-structures.
https://gitlab.com/brunowonder/pydata-class
Can you believe this is C++ code???
B4X:
data = dict();
data["bruno"] = dict();
data["bruno"]["home"] = "Setubal";
data["bruno"]["country"] = "Portugal";
data["bruno"]["name"] = "Bruno";
data["bruno"]["surname"] = "Silva";
data["bruno"]["age"] = 35;
data["bruno"]["stuff"] = dict();
data["bruno"]["stuff"]["phone"] = "iPhone";
data["bruno"]["stuff"]["numbers"] = list();
It sure looks like Python, doesn't it? Well, that's because it (also) is!
It's MIT licensed, so feel free to use and abuse it!
Testing (Linux):
B4X:
# Install Valgrind (Ubuntu: sudo apt install valgrind)
# Compile with either g++ or clang++
# USAGE: ./test.sh COMPILER C++STANDARD
# Examples:
./test.sh g++ 98 # Compile (and run) with GCC using the C++98 standard
./test.sh clang++ 14 # Compile (and run) with Clang using the C++14 standard
Last edited: