A C++ console application that parses the given pokedex.json file and outputs to the console as requested There are two parsing libraries user can switch between at build time:
- Nlohmann
- Rapid
During the build process, the FetchContent module in CMake handles the retrieval of the external library based on a specified option. A configuration option determines which JSON parser (Nlohmann or Rapid) is needed for the build, and FetchContent then downloads and includes only the selected library
-
Open the CMD | Powershell in workspace folder.
-
Use the following commands:
cmake -S . -B build -DUSE_NLOHMANN=ON -DUSE_RAPID=OFF # specifies build directory
#to switch between modes -DUSE_NLOHMANN=OFF -DUSE_RAPID=ON
#NOTE: once set desired mode to ON, make sure the other is OFF
cmake --build build # builds the project
.\build\Debug\Pokedex.exe #runs the executable
#NOTE: Use .\ instead of ./ for Windows
-
Press Enter to exit application.
-
Clean the build folder:
CMD:
rmdir /S /Q build #removes the directory and all subdirectories/files in CMD
Powershell:
rmdir .\build -Recurse -Force #removes the directory and all subdirectories/files in Powershell
Application converts objects JSON to std::vector<std::unordered_map<std::string, std::any>> Check cppreference std::unordered_map and cppreference std::variant (since C++17) for more info.