Giter Site home page Giter Site logo

zhourubin / qjson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flavio/qjson

0.0 1.0 0.0 672 KB

QJson is a qt-based library that maps JSON data to QVariant objects.

Home Page: http://qjson.sourceforge.net

License: GNU Lesser General Public License v2.1

CMake 4.33% C++ 91.90% C 0.59% Yacc 3.18%

qjson's Introduction

QJson Build Status

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It can represents integer, real number, string, an ordered sequence of value, and a collection of name/value pairs.

QJson is a qt-based library that maps JSON data to QVariant objects. JSON arrays will be mapped to QVariantList instances, while JSON's objects will be mapped to QVariantMap.

Install

QJson requires:

  • Qt 4.5 or greater
  • cmake 2.6 or greater

Some possible cmake options:

  • -DCMAKE_BUILD_TYPE=DEBUG: enables some debug output (other than making easier to debug the code)
  • -DQJSON_BUILD_TESTS=yes or -DKDE4_BUILD_TESTS=yes: builds the unit tests
  • -DCMAKE_INSTALL_PREFIX=${HOME}/testinstall: install qjson in a custom directory
  • -DCMAKE_INCLUDE_PATH=${HOME}/testinstall/include: include a custom include directory
  • -DCMAKE_LIBRARY_PATH=${HOME}/testinstall/lib: include a custom library directory
  • -DLIB_DESTINATION=lib64: if you have a 64 bit system with separate libraries for 64 bit libraries
  • -DQJSON_VERBOSE_DEBUG_OUTPUT:BOOL=ON: more debugging statements are generated by the parser. It's useful only if you are trying to fix the bison grammar.

For Unix/Linux/Mac:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=_preferred_path_ ..
make
make install
/sbin/ldconfig #if necessary

Contribute

The recommended way to submit your changes is via a pull request.

Before submitting a patch please ensure:

  • Patched code compiles.
  • The patch is fixing a specific issue or implementing a new feature (it’s not doing multiple things at the same time).
  • QJson unit tests have been updated.
  • QJson unit tests are passing.

Unit testing

QJson unit tests are located under the tests directory. You can enable them passing the -DQJSON_BUILD_TESTS=yes option to cmake.

Note well: make sure you followed the build instructions.

To run all the unit tests move into the build directory and type:

make tests

If you want to run the QJson::Parser unit tests just type:

./test/parser/testparser

If you want to run the QJson::Serializer unit tests just type:

./test/serializer/testserializer

If you want to run the QJson::QObjectHelper tests just type:

./tests/qobjecthelper/testqobjecthelper

If you want to test the QJson parser against a specific JSON object you can use the cmdline_tester program.

This binary is located under the tests directory and has a straightforward syntax:

./tests/cmdline_tester/cmdline_tester text_file_containing_json_object

The command will convert the JSON object to a QVariant and dump it to stdout. More options are available via cli options, just checkout the --help output.

Note well: cmdline_tester relies on qDebug() to dump the object. qDebug has some limitations, like being unable to print utf8 chars.

License

This library is licensed under the Lesser GNU General Public License version 2.1. See the COPYING.lib file for more information.

Resources

qjson's People

Contributors

flavio avatar drizt avatar moio avatar microe avatar anluoma avatar krop avatar h57624paen avatar svuorela avatar dant3 avatar agateau avatar jkjuopperi avatar milianw avatar rakuco avatar alediaferia avatar shybovycha avatar dfaure avatar gregschlom avatar gooseensky avatar reavertm avatar mathieu avatar maxdesiatov avatar niclasr avatar patdowney avatar petrows avatar hotgloupi avatar rudilee avatar vestnik avatar zgyarmati avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.