Skip to content

Yuanzidan081/SJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SJson

a json parser refactored written by C++ base on the C-style Json Parserjson-tutorial

project organization

  • src: the source file
    • Json: Store and Get the JsonValue parsed by JsonParser.
    • JsonException: Exception handing class if there is any error when parse the json string.
    • JsonParser: Parse the json format string to the JsonValue.
    • JsonGenerator: Stringfy the string to the json format.
    • JsonValue: Manage the json parsed object(null, true, false, number, string, array, object)
  • dep: Test Framework: GoogleTest
  • test: unit test using GoogleTest

how to start

git clone --recursive https://github.com/Yuanzidan081/SJson.git
# update the GoogleTest module as the latest version
git submodule update --remote 

I use the VSCode as my code editor, if you also use this, you should define the json files in the folder called .vscode. I use the MSVC as my compiler, if you want to change it, you can add -G XXX(like MinGW Makefiles)in the task.json (args).

task.json

{
    "tasks": [
        {
            "type": "shell",
            "label": "generate",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "command": "cmake", 
            "args": [
                "-S",
                ".",
                "-B",
                "build"
            ],
        },
        {
            "label": "complie",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "command": "cmake",
            "args": [
                "--build",
                "build"
            ],
        },
        {
            "label": "preparation",
            "dependsOn": [
                "generate",
                "complie"
            ]
        }
    ],
    "version": "2.0.0"
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "launch SRendererLab",
            "type": "cppvsdbg",
            "request": "launch",
            //"program": "${workspaceFolder}/build/test/Debug/SJsonGTest.exe",
            "program": "${workspaceFolder}/build/test/Debug/SJsonTest.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "console": "externalTerminal",
            "preLaunchTask": "preparation"
        }
    ]
}

Press F5, then you can see the test results.

About

一个基于C++的可读写Json解析器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published