openSUSE Build Service > Projects > KDE:Qt:STABLE > libqjson > Changes
 [-] [+] Changed libqjson.changes @@ -1,4 +1,21 @@ ------------------------------------------------------------------- +Fri Nov 27 14:57:00 UTC 2012 - cgiboudeaux@gmx.com + +- Fix the SLES build (directory not owned by a package). +- Install the license files. + +------------------------------------------------------------------- +Tue Nov 27 10:12:58 UTC 2012 - fcastelli@suse.com + +- Update to version 0.8.1 +- Ensure API and ABI compatibility with 0.7.1 + +------------------------------------------------------------------- +Thu Nov 22 10:28:41 UTC 2012 - fcastelli@suse.com + +- Update to version 0.8.0 + +------------------------------------------------------------------- Thu Jan 12 11:30:44 UTC 2012 - coolo@suse.com - change license to be in spdx.org format [-] [+] Changed libqjson.spec @@ -15,15 +15,15 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: libqjson Summary: QJson is a qt-based library that maps JSON data to QVariant objects License: LGPL-2.1+ Group: Development/Libraries/C and C++ -Version: 0.7.1 +Version: 0.8.1 Release: 0 Url: http://qjson.sourceforge.net/ -%define svn_rev 1058132 -Source: qjson-svn-r%{svn_rev}.tar.bz2 +Source: qjson-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: cmake BuildRequires: libqt4-devel @@ -75,7 +75,7 @@ Flavio Castelli %prep -%setup -q -n qjson +%setup -q -n qjson-%{version} %build export CFLAGS="$RPM_OPT_FLAGS" @@ -94,22 +94,21 @@ %install %makeinstall -%clean -rm -rf %{buildroot} - %post -n %{soname} -p /sbin/ldconfig %postun -n %{soname} -p /sbin/ldconfig %files -n %{soname} %defattr(-,root,root) +%doc ChangeLog COPYING.lib README* %{_libdir}/libqjson.so.* %files devel %defattr(-,root,root) +%dir %{_libdir}/cmake %{_includedir}/qjson %{_libdir}/libqjson.so %{_libdir}/pkgconfig/QJson.pc -%{_datadir}/cmake/Modules/FindQJSON.cmake +%{_libdir}/cmake/qjson %changelog [-] [+] Added qjson-0.8.1.tar.bz2/.gitignore @@ -0,0 +1,3 @@ +lib +Makefile +doc/html [-] [+] Changed qjson-0.8.1.tar.bz2/CMakeLists.txt @@ -4,25 +4,18 @@ # Stop cmake 2.6 from whining CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -IF(COMMAND cmake_policy) - CMAKE_POLICY(SET CMP0003 NEW) -ENDIF(COMMAND cmake_policy) - -# where to look first for cmake modules, before${CMAKE_ROOT}/Modules/ is checked -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules") +CMAKE_POLICY(SET CMP0003 NEW) set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR}) # compile in debug mode IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." - FORCE) + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.") ENDIF(NOT CMAKE_BUILD_TYPE) IF("${CMAKE_BUILD_TYPE}" MATCHES "^Rel.*") ADD_DEFINITIONS("-DQT_NO_DEBUG_OUTPUT") - ADD_DEFINITIONS("-DQT_NO_DEBUG_OUTPUT") ENDIF("${CMAKE_BUILD_TYPE}" MATCHES "^Rel.*") # Ability to disable verbose debug output @@ -30,25 +23,37 @@ ADD_DEFINITIONS("-DQJSON_VERBOSE_DEBUG_OUTPUT") endif(QJSON_VERBOSE_DEBUG_OUTPUT) +OPTION(OSX_FRAMEWORK "Build a Mac OS X Framework") +SET(FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/Library/Frameworks" + CACHE PATH "Where to place qjson.framework if OSX_FRAMEWORK is selected") + +# Don't use absolute path in qjson-targets-*.cmake +# (This will have no effect with CMake < 2.8) +SET(QT_USE_IMPORTED_TARGETS TRUE) + # Find Qt4 FIND_PACKAGE( Qt4 REQUIRED ) -SET( QT_DONT_USE_QTGUI TRUE ) +IF (NOT WIN32) + SET( QT_DONT_USE_QTGUI TRUE ) +ENDIF() + +# Include the cmake file needed to use qt4 +INCLUDE( ${QT_USE_FILE} ) #add extra search paths for libraries and includes SET (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install") SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in") -SET (CMAKE_MODULES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/apps/cmake/modules" CACHE PATH "The directory to install FindQRpc.cmake to") - +SET (CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${CMAKE_PROJECT_NAME}" CACHE PATH "Directory where to install QJSONConfig.cmake") set(QJSON_LIB_MAJOR_VERSION "0") -set(QJSON_LIB_MINOR_VERSION "7") +set(QJSON_LIB_MINOR_VERSION "8") set(QJSON_LIB_PATCH_VERSION "1") set(QJSON_LIB_VERSION_STRING "${QJSON_LIB_MAJOR_VERSION}.${QJSON_LIB_MINOR_VERSION}.${QJSON_LIB_PATCH_VERSION}") -set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}" ) +set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib" ) # pkg-config IF (NOT WIN32) @@ -56,12 +61,9 @@${CMAKE_CURRENT_BINARY_DIR}/QJson.pc @ONLY) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/QJson.pc - DESTINATION lib${LIB_SUFFIX}/pkgconfig) + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) ENDIF (NOT WIN32) -# Include the cmake file needed to use qt4 -INCLUDE(${QT_USE_FILE} ) - # Subdirs ADD_SUBDIRECTORY(src) IF (KDE4_BUILD_TESTS OR QJSON_BUILD_TESTS) @@ -69,13 +71,28 @@ ADD_SUBDIRECTORY(tests) ENDIF (KDE4_BUILD_TESTS OR QJSON_BUILD_TESTS) -add_subdirectory(cmake/modules) - - -#CONFIGURE_FILE( -# "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" -# "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" -# IMMEDIATE @ONLY) +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + +INSTALL(EXPORT qjson-export DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE QJSONTargets.cmake) + +# figure out the relative path from the installed Config.cmake file to the install prefix (which may be at +# runtime different from the chosen CMAKE_INSTALL_PREFIX if under Windows the package was installed anywhere) +# This relative path will be configured into the QJSONConfig.cmake +file(RELATIVE_PATH relInstallDir${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR}${CMAKE_INSTALL_PREFIX} ) + +# cmake-modules +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/QJSONConfig.cmake.in +${CMAKE_CURRENT_BINARY_DIR}/QJSONConfig.cmake + @ONLY) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/QJSONConfigVersion.cmake.in +${CMAKE_CURRENT_BINARY_DIR}/QJSONConfigVersion.cmake + @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/QJSONConfig.cmake +${CMAKE_CURRENT_BINARY_DIR}/QJSONConfigVersion.cmake + DESTINATION "${CMAKECONFIG_INSTALL_DIR}") -#ADD_CUSTOM_TARGET(uninstall -# "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +ADD_CUSTOM_TARGET(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") [-] [+] Added qjson-0.8.1.tar.bz2/COPYING.lib @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1, as published by the Free Software Foundation. + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + [-] [+] Added qjson-0.8.1.tar.bz2/ChangeLog @@ -0,0 +1,99 @@ +Tue Nov 27 11:04:12 CET 2012 Flavio Castelli + + * Relase 0.8.1: + - ensure API and ABI compatibility with 0.7.1 + +Thu Nov 22 21:20:11 CET 2012 Flavio Castelli + + * Fix unsafe pointer usage in Serializer::serialize() + +---------------------------------------------------------------------- +Wed Nov 21 22:01:51 CET 2012 Flavio Castelli + + * Version 0.8.0 released + +Tue Nov 20 11:19:49 CET 2012 Flavio Castelli + + * Serializer: handle QVariantHash + +Tue Oct 30 15:50:10 CET 2012 Flavio Castelli + + * Improve error handling inside of Serializer + * Serializer: handle quint16. + +Tue Jan 31 10:15:06 CET 2012 Flavio Castelli + + * Make possible to build qjson as an OS X framework. + +Fri Nov 04 16:50:56 CET 2011 Flavio Castelli + + * Make possible to set double precision during serialization. + +Wed Aug 24 17:58:56 CEST 2011 Flavio Castelli + + * Buildsystem adjustments, fix issues mentioned here: + - http://lists.kde.org/?l=kde-buildsystem&m=130947194605100&w=3 + - http://lists.kde.org/?l=kde-buildsystem&m=128835747626464&w=3 + The biggest difference now is that FindQJSON.cmake is not provided + anymore. Instead, QJSONConfig.cmake and QJSONConfigVersion.cmake are + installed and can be used in find_package(QJSON) calls. Applications + using QJson can write their own FindQJSON.cmake files if they need to. + +Fri Apr 23:04:29 CEST 2011 Flavio Castelli + + * Fixed QVariant de-serialization. QVariant properties were ignored + during QVariant -> QObject conversion. + +Sun Dec 18:59:28 CET 2010 Flavio Castelli + + * It's now possible to indent the output produced by the Serializer. + +Mon Sep 06 18:53:02 CEST 2010 Flavio Castelli + + * 50% performance improvement when parsing numbers. + +Sun Jul 04 15:41:08 CEST 2010 Flavio Castelli + + * fix make install when not installing as root + * provide "make uninstall" + +Tue Jun 15 13:16:57 CEST 2010 Flavio Castelli + + * Allow top level values + +---------------------------------------------------------------------- +Sat Mar 13 23:57:00 CEST 2009 - flavio@castelli.name + + * Merged the symbian branch into master, + +---------------------------------------------------------------------- +Sun Oct 11 19:18:00 CEST 2009 - flavio@castelli.name + + * Updated to 0.6.3: fixed a bug affecting ulonglong numbers serialization. + +------------------------------------------------------------------- +Wed Sep 15 19:21:00 CEST 2009 - flavio@castelli.name + + * Updated to 0.6.2: fixed a bug affecting ulonglong numbers parsing. + +------------------------------------------------------------------- +Wed Sep 09 09:55:00 CEST 2009 - flavio@castelli.name + + * Updated to 0.6.1: relevant bugs fixed. + * Moved the SerializerRunnable class inside QJson namespace. + * Fixed a bug in cmdline_tester. + +------------------------------------------------------------------- +Mon Jul 20 15:24:32 CEST 2009 - prusnak@suse.cz + + * Updated to 0.6.0 (KDE SVN rev 999750). + +------------------------------------------------------------------- +Mon Apr 07 00:00:00 UTC 2009 - flavio@castelli.name + + * Released 0.5.1 - added unicode support. + +------------------------------------------------------------------- +Mon Apr 03 00:00:00 UTC 2009 - flavio@castelli.name + + * First release. [-] [+] Added qjson-0.8.1.tar.bz2/QJSONConfig.cmake.in @@ -0,0 +1,6 @@ +GET_FILENAME_COMPONENT(myDir${CMAKE_CURRENT_LIST_FILE} PATH) + +SET(QJSON_LIBRARIES qjson) +SET(QJSON_INCLUDE_DIR "@INCLUDE_INSTALL_DIR@") + +include(${myDir}/QJSONTargets.cmake) [-] [+] Added qjson-0.8.1.tar.bz2/QJSONConfigVersion.cmake.in @@ -0,0 +1,9 @@ +SET(PACKAGE_VERSION "@QJSON_LIB_VERSION_STRING@") +IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + SET(PACKAGE_VERSION_EXACT TRUE) +ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) +IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) + SET(PACKAGE_VERSION_COMPATIBLE TRUE) +ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) + SET(PACKAGE_VERSION_UNSUITABLE TRUE) +ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) [-] [+] Added qjson-0.8.1.tar.bz2/README.license @@ -0,0 +1,89 @@ +Qjson version xxxx, Date + +The following files are licensed under LGPL V2.1: +------------------------------------------------ +src/json_parser.yy +src/json_scanner.cpp +src/json_scanner.h +src/parser.cpp +src/parser.h +src/parser_p.h +src/parserrunnable.cpp +src/parserrunnable.h +src/qjson_debug.h +src/qjson_export.h +src/qobjecthelper.cpp +src/serializer.cpp +src/qobjecthelper.h +src/serializer.h +src/serializerrunnable.cpp +src/serializerrunnable.h +tests/cmdline_tester/cmdline_tester.cpp +tests/cmdline_tester/cmdlineparser.cpp +tests/cmdline_tester/cmdlineparser.h +tests/parser/testparser.cpp +tests/qobjecthelper/person.h +tests/qobjecthelper/testqobjecthelper.cpp +tests/serializer/testserializer.cpp + + +The following files are licensed under GPL V2 with Bison Exception: +-------------------------------------------------------------------- +/src/json_parser.cc +/src/stack.hh +/src/location.hh +/src/position.hh +/src/json_parser.hh + + +Copyrights: +---------- +Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +Copyright (C) 2009 Flavio Castelli 2009 Frank Osterfeld +Copyright (C) 2008 Flavio Castelli +Copyright (C) 2009 Till Adam +Copyright (C) 2009 Michael Leupold +Copyright (C) 2009 Flavio Castelli +Copyright (C) 2009 Frank Osterfeld +Copyright (C) 2009 Pino Toscano +Copyright (C) 2010 Flavio Castelli + + +GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999: +------------------------------------------------------------- + +Checkout COPYING.lib + + +GPL V2 with Bison Exception: +---------------------------- +Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. + +As a special exception, you may create a larger work that contains +part or all of the Bison parser skeleton and distribute that work +under terms of your choice, so long as that work isn't itself a +parser generator using the skeleton or a modified version thereof +as a parser skeleton. Alternatively, if you modify or redistribute +the parser skeleton itself, you may (at your option) remove this +special exception, which will cause the skeleton and the resulting +Bison output files to be licensed under the GNU General Public +License without this special exception. + +This special exception was added by the Free Software Foundation in +version 2.2 of Bison. + [-] [+] Added qjson-0.8.1.tar.bz2/README.md @@ -0,0 +1,44 @@ +# QJson +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.0 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 + +# License + This library is licensed under the Lesser GNU General Public License version 2.1. + See the COPYING.lib file for more information. + +# Resources + +* [Website](http://qjson.sourceforge.net/) +* [Mailing List](https://lists.sourceforge.net/mailman/listinfo/qjson-devel) +* Project Lead/Maintainer (2008-current): [Flavio Castelli](mailto:flavio@castelli.name). [-] [+] Added qjson-0.8.1.tar.bz2/cmake_uninstall.cmake.in @@ -0,0 +1,17 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) +ENDFOREACH(file) [-] [+] Changed qjson-0.8.1.tar.bz2/doc/Doxyfile @@ -1,16 +1,105 @@ -# Doxyfile 1.5.6 +# Doxyfile 1.8.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + PROJECT_NAME = QJson -PROJECT_NUMBER = 0.7.0 + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.8.1 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = the easiest way to manage JSON objects with Qt + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + OUTPUT_DIRECTORY = ./ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The$name class" "The $name widget" +# "The$name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + ABBREVIATE_BRIEF = "The $name class" \ "The$name widget" \ "The $name file" \ @@ -22,80 +111,579 @@ a \ an \ the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + TAB_SIZE = 8 -ALIASES = + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the$file, $line, and$text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + WARN_FORMAT = "$file:$line:$text" -WARN_LOGFILE = + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + INPUT = ./qjson.dox \ ../src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + FILE_PATTERNS = *.c \ *.cc \ *.cxx \ @@ -145,161 +733,1119 @@ *.F \ *.VHD \ *.VHDL + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + RECURSIVE = YES -EXCLUDE = + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + VERBATIM_HEADERS = YES + #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank html' will be used as the default path. + HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + HTML_HEADER = ./header.html + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + HTML_FOOTER = ./footer.html -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + DOCSET_BUNDLE_ID = org.doxygen.Project -HTML_DYNAMIC_SECTIONS = NO -CHM_FILE = -HHC_LOCATION = + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + GENERATE_CHI = NO -CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = NO + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank latex' will be used as the default path. + LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank makeindex' will be used as the +# default command name. + MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank rtf' will be used as the default path. + RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank man' will be used as the default path. + MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + MAN_LINKS = NO + #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank xml' will be used as the default path. + XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + XML_PROGRAMLISTING = YES + #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + GENERATE_AUTOGEN_DEF = NO + #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + SKIP_FUNCTION_MACROS = YES + #--------------------------------------------------------------------------- -# Configuration::additions related to external references +# Configuration::additions related to external references #--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of which perl'). + PERL_PATH = /usr/bin/perl + #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + CLASS_DIAGRAMS = NO -MSCGEN_PATH = + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + DOT_FONTNAME = FreeSans -DOT_FONTPATH = + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + MAX_DOT_GRAPH_DEPTH = 1000 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO [-] [+] Changed qjson-0.8.1.tar.bz2/doc/header.html @@ -8,17 +8,6 @@ - -
[-] [+] Changed qjson-0.8.1.tar.bz2/doc/qjson.dox @@ -83,13 +83,5 @@ sudo make install \endcode -\section _download Get the code -Actually QJson code is hosted on KDE subversion repository. You can download it using a svn client: -\code -svn co svn://anonsvn.kde.org/home/kde/trunk/playground/libs/qjson -\endcode - -Otherwise you can download source tarballs here. - \author Flavio Castelli */ [-] [+] Added qjson-0.8.1.tar.bz2/include +(directory) [-] [+] Added qjson-0.8.1.tar.bz2/include/QJson +(directory) [-] [+] Added qjson-0.8.1.tar.bz2/include/QJson/Parser @@ -0,0 +1 @@ +#include "../../src/parser.h" [-] [+] Added qjson-0.8.1.tar.bz2/include/QJson/QObjectHelper @@ -0,0 +1 @@ +#include "../../src/qobjecthelper.h" [-] [+] Added qjson-0.8.1.tar.bz2/include/QJson/Serializer @@ -0,0 +1 @@ +#include "../../src/serializer.h" [-] [+] Added qjson-0.8.1.tar.bz2/src/.gitignore @@ -0,0 +1,3 @@ +moc_* +*.o +Makefile [-] [+] Changed qjson-0.8.1.tar.bz2/src/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories (./) - # add_custom_command (OUTPUT ${qjson_SOURCE_DIR}/lib/json_parser.cc # PRE_BUILD # COMMAND bison -t -o json_parser.cc -d json_parser.yy @@ -7,16 +5,6 @@ # WORKING_DIRECTORY${qjson_SOURCE_DIR}/lib/ # ) -install(FILES - parser.h - parserrunnable.h - qobjecthelper.h - serializer.h - serializerrunnable.h - qjson_export.h - DESTINATION ${INCLUDE_INSTALL_DIR}/qjson COMPONENT Devel -) - set(qjson_MOC_HDRS parserrunnable.h serializerrunnable.h @@ -25,18 +13,27 @@ qt4_wrap_cpp(qjson_MOC_SRCS${qjson_MOC_HDRS}) set (qjson_SRCS parser.cpp qobjecthelper.cpp json_scanner.cpp json_parser.cc parserrunnable.cpp serializer.cpp serializerrunnable.cpp) +set (qjson_HEADERS parser.h parserrunnable.h qobjecthelper.h serializer.h serializerrunnable.h qjson_export.h) -add_library (qjson SHARED ${qjson_SRCS}${qjson_MOC_SRCS}) +add_library (qjson SHARED ${qjson_SRCS}${qjson_MOC_SRCS} ${qjson_HEADERS}) target_link_libraries( qjson${QT_LIBRARIES}) +if(NOT android) + set_target_properties(qjson PROPERTIES + VERSION ${QJSON_LIB_MAJOR_VERSION}.${QJSON_LIB_MINOR_VERSION}.${QJSON_LIB_PATCH_VERSION} + SOVERSION${QJSON_LIB_MAJOR_VERSION} + ) +endif() set_target_properties(qjson PROPERTIES - VERSION ${QJSON_LIB_MAJOR_VERSION}.${QJSON_LIB_MINOR_VERSION}.${QJSON_LIB_PATCH_VERSION} - SOVERSION${QJSON_LIB_MAJOR_VERSION} DEFINE_SYMBOL QJSON_MAKEDLL + PUBLIC_HEADER "${qjson_HEADERS}" + FRAMEWORK${OSX_FRAMEWORK} ) -INSTALL(TARGETS qjson +INSTALL(TARGETS qjson EXPORT qjson-export LIBRARY DESTINATION ${LIB_INSTALL_DIR} - RUNTIME DESTINATION bin - ARCHIVE DESTINATION${LIB_INSTALL_DIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + ARCHIVE DESTINATION${LIB_INSTALL_DIR} + FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR} + PUBLIC_HEADER DESTINATION${INCLUDE_INSTALL_DIR}/qjson ) [-] [+] Changed qjson-0.8.1.tar.bz2/src/json_parser.cc @@ -42,7 +42,7 @@ #line 43 "json_parser.cc" #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* FIXME: INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -384,7 +384,7 @@ switch (yyn) { case 2: -#line 80 "json_parser.yy" +#line 84 "json_parser.yy" { driver->m_result = (yysemantic_stack_[(1) - (1)]); qjsonDebug() << "json_parser - parsing finished"; @@ -392,36 +392,31 @@ break; case 3: -#line 85 "json_parser.yy" - {(yyval) = (yysemantic_stack_[(1) - (1)]); ;} +#line 89 "json_parser.yy" + { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} break; case 4: -#line 86 "json_parser.yy" - {(yyval) = (yysemantic_stack_[(1) - (1)]); ;} - break; - - case 5: -#line 88 "json_parser.yy" +#line 91 "json_parser.yy" { qCritical()<< "json_parser - syntax error found, " - << "forcing abort"; + << "forcing abort, Line" << (yyloc).begin.line << "Column" << (yyloc).begin.column; YYABORT; ;} break; - case 7: -#line 95 "json_parser.yy" + case 6: +#line 98 "json_parser.yy" { (yyval) = (yysemantic_stack_[(3) - (2)]); ;} break; - case 8: -#line 97 "json_parser.yy" + case 7: +#line 100 "json_parser.yy" { (yyval) = QVariant (QVariantMap()); ;} break; - case 9: -#line 98 "json_parser.yy" + case 8: +#line 101 "json_parser.yy" { QVariantMap members = (yysemantic_stack_[(2) - (2)]).toMap(); (yysemantic_stack_[(2) - (2)]) = QVariant(); // Allow reuse of map @@ -429,13 +424,13 @@ ;} break; - case 10: -#line 104 "json_parser.yy" + case 9: +#line 107 "json_parser.yy" { (yyval) = QVariant (QVariantMap()); ;} break; - case 11: -#line 105 "json_parser.yy" + case 10: +#line 108 "json_parser.yy" { QVariantMap members = (yysemantic_stack_[(3) - (3)]).toMap(); (yysemantic_stack_[(3) - (3)]) = QVariant(); // Allow reuse of map @@ -443,8 +438,8 @@ ;} break; - case 12: -#line 111 "json_parser.yy" + case 11: +#line 114 "json_parser.yy" { QVariantMap pair; pair.insert ((yysemantic_stack_[(3) - (1)]).toString(), QVariant((yysemantic_stack_[(3) - (3)]))); @@ -452,18 +447,18 @@ ;} break; - case 13: -#line 117 "json_parser.yy" + case 12: +#line 120 "json_parser.yy" { (yyval) = (yysemantic_stack_[(3) - (2)]); ;} break; - case 14: -#line 119 "json_parser.yy" + case 13: +#line 122 "json_parser.yy" { (yyval) = QVariant (QVariantList()); ;} break; - case 15: -#line 120 "json_parser.yy" + case 14: +#line 123 "json_parser.yy" { QVariantList members = (yysemantic_stack_[(2) - (2)]).toList(); (yysemantic_stack_[(2) - (2)]) = QVariant(); // Allow reuse of list @@ -472,13 +467,13 @@ ;} break; - case 16: -#line 127 "json_parser.yy" + case 15: +#line 130 "json_parser.yy" { (yyval) = QVariant (QVariantList()); ;} break; - case 17: -#line 128 "json_parser.yy" + case 16: +#line 131 "json_parser.yy" { QVariantList members = (yysemantic_stack_[(3) - (3)]).toList(); (yysemantic_stack_[(3) - (3)]) = QVariant(); // Allow reuse of list @@ -487,46 +482,61 @@ ;} break; + case 17: +#line 138 "json_parser.yy" + { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} + break; + case 18: -#line 135 "json_parser.yy" +#line 139 "json_parser.yy" { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} break; case 19: -#line 136 "json_parser.yy" +#line 140 "json_parser.yy" { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} break; case 20: -#line 137 "json_parser.yy" +#line 141 "json_parser.yy" { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} break; case 21: -#line 138 "json_parser.yy" - { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} - break; - - case 22: -#line 139 "json_parser.yy" +#line 142 "json_parser.yy" { (yyval) = QVariant (true); ;} break; - case 23: -#line 140 "json_parser.yy" + case 22: +#line 143 "json_parser.yy" { (yyval) = QVariant (false); ;} break; - case 24: -#line 141 "json_parser.yy" + case 23: +#line 144 "json_parser.yy" { QVariant null_variant; (yyval) = null_variant; ;} break; + case 24: +#line 149 "json_parser.yy" + { (yyval) = QVariant(QVariant::Double); (yyval).setValue( -std::numeric_limits::infinity() ); ;} + break; + case 25: -#line 146 "json_parser.yy" +#line 150 "json_parser.yy" + { (yyval) = QVariant(QVariant::Double); (yyval).setValue( std::numeric_limits::infinity() ); ;} + break; + + case 26: +#line 151 "json_parser.yy" + { (yyval) = QVariant(QVariant::Double); (yyval).setValue( std::numeric_limits::quiet_NaN() ); ;} + break; + + case 28: +#line 154 "json_parser.yy" { if ((yysemantic_stack_[(1) - (1)]).toByteArray().startsWith('-')) { (yyval) = QVariant (QVariant::LongLong); @@ -539,8 +549,8 @@ ;} break; - case 26: -#line 156 "json_parser.yy" + case 29: +#line 164 "json_parser.yy" { const QByteArray value = (yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray(); (yyval) = QVariant(QVariant::Double); @@ -548,65 +558,65 @@ ;} break; - case 27: -#line 161 "json_parser.yy" + case 30: +#line 169 "json_parser.yy" { (yyval) = QVariant ((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;} break; - case 28: -#line 162 "json_parser.yy" + case 31: +#line 170 "json_parser.yy" { const QByteArray value = (yysemantic_stack_[(3) - (1)]).toByteArray() + (yysemantic_stack_[(3) - (2)]).toByteArray() + (yysemantic_stack_[(3) - (3)]).toByteArray(); (yyval) = QVariant (value); ;} break; - case 29: -#line 167 "json_parser.yy" + case 32: +#line 175 "json_parser.yy" { (yyval) = QVariant ((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;} break; - case 30: -#line 168 "json_parser.yy" + case 33: +#line 176 "json_parser.yy" { (yyval) = QVariant (QByteArray("-") + (yysemantic_stack_[(3) - (2)]).toByteArray() + (yysemantic_stack_[(3) - (3)]).toByteArray()); ;} break; - case 31: -#line 170 "json_parser.yy" + case 34: +#line 178 "json_parser.yy" { (yyval) = QVariant (QByteArray("")); ;} break; - case 32: -#line 171 "json_parser.yy" + case 35: +#line 179 "json_parser.yy" { (yyval) = QVariant((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;} break; - case 33: -#line 175 "json_parser.yy" + case 36: +#line 183 "json_parser.yy" { (yyval) = QVariant(QByteArray(".") + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;} break; - case 34: -#line 179 "json_parser.yy" + case 37: +#line 187 "json_parser.yy" { (yyval) = QVariant((yysemantic_stack_[(2) - (1)]).toByteArray() + (yysemantic_stack_[(2) - (2)]).toByteArray()); ;} break; - case 35: -#line 181 "json_parser.yy" + case 38: +#line 189 "json_parser.yy" { (yyval) = (yysemantic_stack_[(3) - (2)]); ;} break; - case 36: -#line 183 "json_parser.yy" + case 39: +#line 191 "json_parser.yy" { (yyval) = QVariant (QString(QLatin1String(""))); ;} break; - case 37: -#line 184 "json_parser.yy" + case 40: +#line 192 "json_parser.yy" { (yyval) = (yysemantic_stack_[(1) - (1)]); ;} @@ -614,7 +624,7 @@ /* Line 675 of lalr1.cc. */ -#line 618 "json_parser.cc" +#line 628 "json_parser.cc" default: break; } YY_SYMBOL_PRINT ("-> $$=", yyr1_[yyn], &yyval, &yyloc); @@ -821,16 +831,16 @@ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ - const signed char json_parser::yypact_ninf_ = -18; + const signed char json_parser::yypact_ninf_ = -21; const signed char json_parser::yypact_[] = { - 5, -18, -18, 1, -2, 19, -18, -18, -18, 2, - 20, 17, 21, 16, 18, -18, -18, -18, -18, -18, - 24, 23, -18, -8, -18, -18, -18, 15, -18, 1, - -18, -2, 18, 18, -18, -18, -2, -18, 18, 18, - 22, -18, -18, 17, -18, -18, -18, 23, -18, -18, - -18, -18, -18 + 3, -21, -21, -6, 31, -10, 0, -21, -21, -21, + 6, -21, -21, 25, -21, -21, -21, -21, -21, -21, + -5, -21, 22, 19, 21, 23, 24, 0, -21, 0, + -21, -21, 13, -21, 0, 0, 29, -21, -21, -6, + -21, 31, -21, 31, -21, -21, -21, -21, -21, -21, + -21, 19, -21, 24, -21, -21 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -839,28 +849,28 @@ const unsigned char json_parser::yydefact_[] = { - 0, 6, 5, 8, 14, 0, 2, 3, 4, 36, - 0, 10, 0, 0, 31, 22, 23, 24, 20, 21, - 0, 16, 19, 25, 18, 1, 37, 0, 7, 0, - 9, 0, 31, 31, 29, 13, 0, 15, 31, 31, - 26, 27, 35, 10, 12, 30, 32, 16, 33, 34, - 28, 11, 17 + 0, 5, 4, 7, 13, 0, 34, 21, 22, 23, + 39, 25, 26, 0, 2, 19, 20, 3, 18, 27, + 28, 17, 0, 9, 0, 0, 15, 34, 24, 34, + 32, 40, 0, 1, 34, 34, 29, 30, 6, 0, + 8, 0, 12, 0, 14, 33, 35, 38, 36, 37, + 31, 9, 11, 15, 10, 16 }; /* YYPGOTO[NTERM-NUM]. */ const signed char json_parser::yypgoto_[] = { - -18, -18, -18, 33, -18, -7, 6, 37, -18, -9, - -13, -18, -18, -17, -18, -1, -3, -18 + -21, -21, -21, -21, -21, -20, 4, -21, -21, -18, + -4, -21, -21, -21, -14, -21, -3, -1, -21 }; /* YYDEFGOTO[NTERM-NUM]. */ const signed char json_parser::yydefgoto_[] = { - -1, 5, 6, 18, 10, 30, 11, 19, 20, 37, - 21, 22, 23, 34, 40, 41, 24, 27 + -1, 13, 14, 15, 22, 40, 23, 16, 25, 44, + 17, 18, 19, 20, 30, 36, 37, 21, 32 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -870,20 +880,24 @@ const unsigned char json_parser::yytable_[] = { - 12, 3, 38, 4, 39, 1, 2, 13, 3, 14, - 4, 15, 16, 17, 9, 45, 46, 9, 44, 25, - 26, 48, 49, 47, 28, 29, 12, 32, 31, 33, - 35, 36, 42, 7, 39, 43, 51, 8, 52, 50 + 26, 27, 24, 1, 2, 34, 3, 35, 4, 28, + 10, 29, 5, 45, 6, 46, 7, 8, 9, 10, + 48, 49, 11, 12, 31, 33, 38, 39, 41, 42, + 47, 54, 43, 50, 3, 55, 4, 52, 24, 53, + 5, 35, 6, 51, 7, 8, 9, 10, 0, 0, + 11, 12 }; /* YYCHECK. */ - const unsigned char + const signed char json_parser::yycheck_[] = { - 3, 3, 10, 5, 12, 0, 1, 9, 3, 11, - 5, 13, 14, 15, 16, 32, 33, 16, 31, 0, - 18, 38, 39, 36, 4, 8, 29, 11, 7, 11, - 6, 8, 17, 0, 12, 29, 43, 0, 47, 40 + 4, 11, 3, 0, 1, 10, 3, 12, 5, 19, + 16, 11, 9, 27, 11, 29, 13, 14, 15, 16, + 34, 35, 19, 20, 18, 0, 4, 8, 7, 6, + 17, 51, 8, 36, 3, 53, 5, 41, 39, 43, + 9, 12, 11, 39, 13, 14, 15, 16, -1, -1, + 19, 20 }; /* STOS_[STATE-NUM] -- The (internal number of the) accessing @@ -891,12 +905,12 @@ const unsigned char json_parser::yystos_[] = { - 0, 0, 1, 3, 5, 20, 21, 22, 26, 16, - 23, 25, 35, 9, 11, 13, 14, 15, 22, 26, - 27, 29, 30, 31, 35, 0, 18, 36, 4, 8, - 24, 7, 11, 11, 32, 6, 8, 28, 10, 12, - 33, 34, 17, 25, 29, 32, 32, 29, 32, 32, - 34, 24, 28 + 0, 0, 1, 3, 5, 9, 11, 13, 14, 15, + 16, 19, 20, 22, 23, 24, 28, 31, 32, 33, + 34, 38, 25, 27, 38, 29, 31, 11, 19, 11, + 35, 18, 39, 0, 10, 12, 36, 37, 4, 8, + 26, 7, 6, 8, 30, 35, 35, 17, 35, 35, + 37, 27, 31, 31, 26, 30 }; #if YYDEBUG @@ -906,7 +920,8 @@ json_parser::yytoken_number_[] = { 0, 256, 257, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16 + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18 }; #endif @@ -914,20 +929,22 @@ const unsigned char json_parser::yyr1_[] = { - 0, 19, 20, 21, 21, 21, 21, 22, 23, 23, - 24, 24, 25, 26, 27, 27, 28, 28, 29, 29, - 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, - 31, 32, 32, 33, 34, 35, 36, 36 + 0, 21, 22, 23, 23, 23, 24, 25, 25, 26, + 26, 27, 28, 29, 29, 30, 30, 31, 31, 31, + 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, + 33, 33, 34, 34, 35, 35, 36, 37, 38, 39, + 39 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ const unsigned char json_parser::yyr2_[] = { - 0, 2, 1, 1, 1, 1, 1, 3, 0, 2, - 0, 3, 3, 3, 0, 2, 0, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 2, 3, 2, - 3, 0, 2, 2, 2, 3, 0, 1 + 0, 2, 1, 1, 1, 1, 3, 0, 2, 0, + 3, 3, 3, 0, 2, 0, 3, 1, 1, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, + 2, 3, 2, 3, 0, 2, 2, 2, 3, 0, + 1 }; #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE @@ -940,9 +957,10 @@ "\"]\"", "\":\"", "\",\"", "\"-\"", "\".\"", "\"digit\"", "\"exponential\"", "\"true\"", "\"false\"", "\"null\"", "\"open quotation mark\"", "\"close quotation mark\"", "\"string\"", - "accept", "start", "data", "object", "members", "r_members", "pair", - "array", "values", "r_values", "value", "number", "int", "digits", - "fract", "exp", "string", "string_arg", 0 + "\"Infinity\"", "\"NaN\"", "accept", "start", "data", "object", + "members", "r_members", "pair", "array", "values", "r_values", "value", + "special_or_number", "number", "int", "digits", "fract", "exp", "string", + "string_arg", 0 }; #endif @@ -951,16 +969,16 @@ const json_parser::rhs_number_type json_parser::yyrhs_[] = { - 20, 0, -1, 21, -1, 22, -1, 26, -1, 1, - -1, 0, -1, 3, 23, 4, -1, -1, 25, 24, - -1, -1, 8, 25, 24, -1, 35, 7, 29, -1, - 5, 27, 6, -1, -1, 29, 28, -1, -1, 8, - 29, 28, -1, 35, -1, 30, -1, 22, -1, 26, - -1, 13, -1, 14, -1, 15, -1, 31, -1, 31, - 33, -1, 31, 34, -1, 31, 33, 34, -1, 11, - 32, -1, 9, 11, 32, -1, -1, 11, 32, -1, - 10, 32, -1, 12, 32, -1, 16, 36, 17, -1, - -1, 18, -1 + 22, 0, -1, 23, -1, 31, -1, 1, -1, 0, + -1, 3, 25, 4, -1, -1, 27, 26, -1, -1, + 8, 27, 26, -1, 38, 7, 31, -1, 5, 29, + 6, -1, -1, 31, 30, -1, -1, 8, 31, 30, + -1, 38, -1, 32, -1, 24, -1, 28, -1, 13, + -1, 14, -1, 15, -1, 9, 19, -1, 19, -1, + 20, -1, 33, -1, 34, -1, 34, 36, -1, 34, + 37, -1, 34, 36, 37, -1, 11, 35, -1, 9, + 11, 35, -1, -1, 11, 35, -1, 10, 35, -1, + 12, 35, -1, 16, 39, 17, -1, -1, 18, -1 }; /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in @@ -968,20 +986,22 @@ const unsigned char json_parser::yyprhs_[] = { - 0, 0, 3, 5, 7, 9, 11, 13, 17, 18, - 21, 22, 26, 30, 34, 35, 38, 39, 43, 45, - 47, 49, 51, 53, 55, 57, 59, 62, 65, 69, - 72, 76, 77, 80, 83, 86, 90, 91 + 0, 0, 3, 5, 7, 9, 11, 15, 16, 19, + 20, 24, 28, 32, 33, 36, 37, 41, 43, 45, + 47, 49, 51, 53, 55, 58, 60, 62, 64, 66, + 69, 72, 76, 79, 83, 84, 87, 90, 93, 97, + 98 }; /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ const unsigned char json_parser::yyrline_[] = { - 0, 80, 80, 85, 86, 87, 93, 95, 97, 98, - 104, 105, 111, 117, 119, 120, 127, 128, 135, 136, - 137, 138, 139, 140, 141, 146, 156, 161, 162, 167, - 168, 170, 171, 175, 179, 181, 183, 184 + 0, 84, 84, 89, 90, 96, 98, 100, 101, 107, + 108, 114, 120, 122, 123, 130, 131, 138, 139, 140, + 141, 142, 143, 144, 149, 150, 151, 152, 154, 164, + 169, 170, 175, 176, 178, 179, 183, 187, 189, 191, + 192 }; // Print the state stack on the debug stream. @@ -1022,7 +1042,7 @@ translate_table[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 2, 2, 2, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1055,20 +1075,20 @@ } const int json_parser::yyeof_ = 0; - const int json_parser::yylast_ = 39; - const int json_parser::yynnts_ = 18; + const int json_parser::yylast_ = 51; + const int json_parser::yynnts_ = 19; const int json_parser::yyempty_ = -2; - const int json_parser::yyfinal_ = 25; + const int json_parser::yyfinal_ = 33; const int json_parser::yyterror_ = 1; const int json_parser::yyerrcode_ = 256; - const int json_parser::yyntokens_ = 19; + const int json_parser::yyntokens_ = 21; const unsigned int json_parser::yyuser_token_number_max_ = 257; const json_parser::token_number_type json_parser::yyundef_token_ = 2; } // namespace yy -#line 188 "json_parser.yy" +#line 196 "json_parser.yy" int yy::yylex(YYSTYPE *yylval, yy::location *yylloc, QJson::ParserPrivate* driver) [-] [+] Changed qjson-0.8.1.tar.bz2/src/json_parser.hh @@ -59,6 +59,8 @@ #include #include + #include + class JSonScanner; namespace QJson { @@ -68,8 +70,8 @@ #define YYERROR_VERBOSE 1 -/* Line 303 of lalr1.cc. */ -#line 73 "json_parser.hh" +/* Line 35 of lalr1.cc. */ +#line 75 "json_parser.hh" #include "location.hh" @@ -146,7 +148,9 @@ NULL_VAL = 13, QUOTMARKOPEN = 14, QUOTMARKCLOSE = 15, - STRING = 16 + STRING = 16, + INFINITY_VAL = 17, + NAN_VAL = 18 }; }; @@ -241,7 +245,7 @@ static const unsigned char yytable_[]; static const signed char yytable_ninf_; - static const unsigned char yycheck_[]; + static const signed char yycheck_[]; /// For a state, its accessing symbol. static const unsigned char yystos_[]; [-] [+] Changed qjson-0.8.1.tar.bz2/src/json_parser.yy @@ -3,16 +3,16 @@ * Copyright (C) 2008 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -32,6 +32,8 @@ #include #include + #include + class JSonScanner; namespace QJson { @@ -69,6 +71,8 @@ %token QUOTMARKCLOSE 15 "close quotation mark" %token STRING 16 "string" +%token INFINITY_VAL 17 "Infinity" +%token NAN_VAL 18 "NaN" // define the initial token %start start @@ -82,12 +86,11 @@ qjsonDebug() << "json_parser - parsing finished"; }; -data: object {$$ = $1; } - | array {$$= 1; } +data: value {$$ =$1; } | error { qCritical()<< "json_parser - syntax error found, " - << "forcing abort"; + << "forcing abort, Line" << @$.begin.line << "Column" << @$.begin.column; YYABORT; } | END; @@ -133,7 +136,7 @@ }; value: string { $$= 1; } - | number {$$ = $1; } + | special_or_number { $$= 1; } | object {$$ =$1; } | array { $$= 1; } | TRUE_VAL {$$ = QVariant (true); } @@ -143,6 +146,11 @@ $$= null_variant; }; +special_or_number: MINUS INFINITY_VAL {$$ = QVariant(QVariant::Double); $$.setValue( -std::numeric_limits::infinity() ); } + | INFINITY_VAL {$$ = QVariant(QVariant::Double); $$.setValue( std::numeric_limits::infinity() ); } + | NAN_VAL {$$ = QVariant(QVariant::Double); $$.setValue( std::numeric_limits::quiet_NaN() ); } + | number; + number: int { if (1.toByteArray().startsWith('-')) {$$ = QVariant (QVariant::LongLong); [-] [+] Changed qjson-0.8.1.tar.bz2/src/json_scanner.cpp @@ -3,16 +3,16 @@ * Copyright (C) 2008 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -38,12 +38,17 @@ } JSonScanner::JSonScanner(QIODevice* io) - : m_io (io) + : m_allowSpecialNumbers(false), + m_io (io) { m_quotmarkClosed = true; m_quotmarkCount = 0; } +void JSonScanner::allowSpecialNumbers(bool allow) { + m_allowSpecialNumbers = allow; +} + static QString unescape( const QByteArray& ba, bool* ok ) { assert( ok ); *ok = false; @@ -125,7 +130,7 @@ int JSonScanner::yylex(YYSTYPE* yylval, yy::location *yylloc) { char ch; - + if (!m_io->isOpen()) { qCritical() << "JSonScanner::yylex - io device is not open"; return -1; @@ -148,32 +153,34 @@ } qjsonDebug() << "JSonScanner::yylex - got |" << ch << "|"; - yylloc->columns(); - + if (ch == '\n' || ch == '\r') yylloc->lines(); - } while (m_quotmarkClosed && (isspace(ch) != 0)); - if (m_quotmarkClosed && ((ch == 't') || (ch == 'T') - || (ch == 'n') || (ch == 'N'))) { - // check true & null value + if (m_quotmarkClosed && ((ch == 't') || (ch == 'T'))) { const QByteArray buf = m_io->peek(3).toLower(); + if (buf == "rue") { + m_io->read (3); + yylloc->columns(3); + qjsonDebug() << "JSonScanner::yylex - TRUE_VAL"; + return yy::json_parser::token::TRUE_VAL; + } + } + else if (m_quotmarkClosed && ((ch == 'n') || (ch == 'N'))) { + const QByteArray buf = m_io->peek(3).toLower(); + if (buf == "ull") { + m_io->read (3); + yylloc->columns(3); + qjsonDebug() << "JSonScanner::yylex - NULL_VAL"; + return yy::json_parser::token::NULL_VAL; + } else if (buf.startsWith("an") && m_allowSpecialNumbers) { + m_io->read(2); + yylloc->columns(2); + qjsonDebug() << "JSonScanner::yylex - NAN_VAL"; + return yy::json_parser::token::NAN_VAL; - if (buf.length() == 3) { - if (buf == "rue") { - m_io->read (3); - yylloc->columns(3); - qjsonDebug() << "JSonScanner::yylex - TRUE_VAL"; - return yy::json_parser::token::TRUE_VAL; - } - else if (buf == "ull") { - m_io->read (3); - yylloc->columns(3); - qjsonDebug() << "JSonScanner::yylex - NULL_VAL"; - return yy::json_parser::token::NULL_VAL; - } } } else if (m_quotmarkClosed && ((ch == 'f') || (ch == 'F'))) { @@ -193,14 +200,24 @@ const QByteArray buf = m_io->peek(1); if (!buf.isEmpty()) { if ((buf[0] == '+' ) || (buf[0] == '-' )) { - ret += m_io->read (1); + ret += m_io->read (1); yylloc->columns(); } } *yylval = QVariant(QString::fromUtf8(ret)); return yy::json_parser::token::E; } - + else if (m_allowSpecialNumbers && m_quotmarkClosed && ((ch == 'I') || (ch == 'i'))) { + QByteArray ret(1, ch); + const QByteArray buf = m_io->peek(7); + if (buf == "nfinity") { + m_io->read(7); + yylloc->columns(7); + qjsonDebug() << "JSonScanner::yylex - INFINITY_VAL"; + return yy::json_parser::token::INFINITY_VAL; + } + } + if (ch != '"' && !m_quotmarkClosed) { // we're inside a " " block QByteArray raw; @@ -259,7 +276,38 @@ } } else if (isdigit(ch) != 0 && m_quotmarkClosed) { - *yylval = QVariant(QString::fromLatin1(QByteArray(&ch,1))); + bool ok; + QByteArray numArray = QByteArray::fromRawData( &ch, 1 * sizeof(char) ); + qulonglong number = numArray.toULongLong(&ok); + if (!ok) { + //This shouldn't happen + qCritical() << "JSonScanner::yylex - error while converting char to ulonglong, returning -1"; + return -1; + } + if (number == 0) { + // we have to return immediately otherwise numbers like + // 2.04 will be converted to 2.4 + *yylval = QVariant(number); + qjsonDebug() << "JSonScanner::yylex - yy::json_parser::token::DIGIT"; + return yy::json_parser::token::DIGIT; + } + + char nextCh; + qint64 ret = m_io->peek(&nextCh, 1); + while (ret == 1 && isdigit(nextCh)) { + m_io->read(1); //consume + yylloc->columns(1); + numArray = QByteArray::fromRawData( &nextCh, 1 * sizeof(char) ); + number = number * 10 + numArray.toULongLong(&ok); + if (!ok) { + //This shouldn't happen + qCritical() << "JSonScanner::yylex - error while converting char to ulonglong, returning -1"; + return -1; + } + ret = m_io->peek(&nextCh, 1); + } + + *yylval = QVariant(number); qjsonDebug() << "JSonScanner::yylex - yy::json_parser::token::DIGIT"; return yy::json_parser::token::DIGIT; } [-] [+] Changed qjson-0.8.1.tar.bz2/src/json_scanner.h @@ -3,16 +3,16 @@ * Copyright (C) 2008 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -41,9 +41,11 @@ public: explicit JSonScanner(QIODevice* io); int yylex(YYSTYPE* yylval, yy::location *yylloc); - + void allowSpecialNumbers(bool allow); + protected: bool m_quotmarkClosed; + bool m_allowSpecialNumbers; unsigned int m_quotmarkCount; QIODevice* m_io; }; [-] [+] Changed qjson-0.8.1.tar.bz2/src/parser.cpp @@ -3,16 +3,16 @@ * Copyright (C) 2008 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -34,6 +34,8 @@ m_scanner(0) , m_negate(false) , m_error(false) + , m_errorLine(0) + , m_specialNumbersAllowed(false) { } @@ -82,6 +84,7 @@ } d->m_scanner = new JSonScanner (io); + d->m_scanner->allowSpecialNumbers(d->m_specialNumbersAllowed); yy::json_parser parser(d); parser.parse(); @@ -112,3 +115,11 @@ { return d->m_errorLine; } + +void QJson::Parser::allowSpecialNumbers(bool allowSpecialNumbers) { + d->m_specialNumbersAllowed = allowSpecialNumbers; +} + +bool Parser::specialNumbersAllowed() const { + return d->m_specialNumbersAllowed; +} [-] [+] Changed qjson-0.8.1.tar.bz2/src/parser.h @@ -3,16 +3,16 @@ * Copyright (C) 2008 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -26,13 +26,16 @@ class QIODevice; class QVariant; +/** + * Namespace used by QJson + */ namespace QJson { class ParserPrivate; /** - * @brief Main class used to convert JSON data to QVariant objects - */ + * @brief Main class used to convert JSON data to QVariant objects + */ class QJSON_EXPORT Parser { public: @@ -71,6 +74,20 @@ */ int errorLine() const; + /** + * Sets whether special numbers (Infinity, -Infinity, NaN) are allowed as an extension to + * the standard + * @param allowSpecialNumbers new value of whether special numbers are allowed + * @sa specialNumbersAllowed + */ + void allowSpecialNumbers(bool allowSpecialNumbers); + + /** + * @returns whether special numbers (Infinity, -Infinity, NaN) are allowed + * @sa allowSpecialNumbers + */ + bool specialNumbersAllowed() const; + private: Q_DISABLE_COPY(Parser) ParserPrivate* const d; [-] [+] Changed qjson-0.8.1.tar.bz2/src/parser_p.h @@ -4,16 +4,16 @@ * Copyright (C) 2009 Michael Leupold * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -49,6 +49,7 @@ int m_errorLine; QString m_errorMsg; QVariant m_result; + bool m_specialNumbersAllowed; }; } [-] [+] Changed qjson-0.8.1.tar.bz2/src/parserrunnable.cpp @@ -3,16 +3,16 @@ * Copyright (C) 2009 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -61,7 +61,7 @@ qDebug() << "successfully converted json item to QVariant object"; emit parsingFinished(result, true, QString()); } else { - const QString errorText = tr("An error occured while parsing json: %1").arg(parser.errorString()); + const QString errorText = tr("An error occurred while parsing json: %1").arg(parser.errorString()); qCritical() << errorText; emit parsingFinished(QVariant(), false, errorText); } [-] [+] Changed qjson-0.8.1.tar.bz2/src/parserrunnable.h @@ -3,16 +3,16 @@ * Copyright (C) 2009 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -36,11 +36,6 @@ { Q_OBJECT public: - /** - * This signal is emitted when the conversion process has been completed - * @param data contains the JSON data that has to be converted - * @param parent parent of the object - **/ explicit ParserRunnable(QObject* parent = 0); ~ParserRunnable(); [-] [+] Changed qjson-0.8.1.tar.bz2/src/qjson_debug.h @@ -3,16 +3,16 @@ * Copyright (C) 2009 Michael Leupold * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. [-] [+] Changed qjson-0.8.1.tar.bz2/src/qjson_export.h @@ -2,16 +2,16 @@ Copyright (C) 2009 Pino Toscano This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + modify it under the terms of the GNU Lesser General Public + License version 2.1, as published by the Free Software Foundation. + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public License + You should have received a copy of the GNU Lesser General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. [-] [+] Changed qjson-0.8.1.tar.bz2/src/qobjecthelper.cpp @@ -4,16 +4,16 @@ * Copyright (C) 2009 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -62,20 +62,24 @@ void QObjectHelper::qvariant2qobject(const QVariantMap& variant, QObject* object) { - QStringList properies; const QMetaObject *metaobject = object->metaObject(); - int count = metaobject->propertyCount(); - for (int i=0; iproperty(i); - if (metaproperty.isWritable()) { - properies << QLatin1String( metaproperty.name()); - } - } QVariantMap::const_iterator iter; - for (iter = variant.constBegin(); iter != variant.end(); iter++) { - if (properies.contains(iter.key())) { - object->setProperty(iter.key().toAscii(), iter.value()); + for (iter = variant.constBegin(); iter != variant.constEnd(); ++iter) { + int pIdx = metaobject->indexOfProperty( iter.key().toAscii() ); + + if ( pIdx < 0 ) { + continue; + } + + QMetaProperty metaproperty = metaobject->property( pIdx ); + QVariant::Type type = metaproperty.type(); + QVariant v( iter.value() ); + if ( v.canConvert( type ) ) { + v.convert( type ); + metaproperty.write( object, v ); + } else if (QString(QLatin1String("QVariant")).compare(QLatin1String(metaproperty.typeName())) == 0) { + metaproperty.write( object, v ); } } } [-] [+] Changed qjson-0.8.1.tar.bz2/src/qobjecthelper.h @@ -3,16 +3,16 @@ * Copyright (C) 2009 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -34,6 +34,7 @@ * @brief Class used to convert QObject into QVariant and vivce-versa. * During these operations only the class attributes defined as properties will * be considered. + * Properties marked as 'non-stored' will be ignored. * * Suppose the declaration of the Person class looks like this: * \code @@ -116,7 +117,7 @@ public: QObjectHelper(); ~QObjectHelper(); - + /** * This method converts a QObject instance into a QVariantMap. * @@ -129,7 +130,8 @@ /** * This method converts a QVariantMap instance into a QObject * - * @param object The QObject instance to be converted. + * @param variant Attributes to assign to the object. + * @param object The QObject instance to update. */ static void qvariant2qobject(const QVariantMap& variant, QObject* object); [-] [+] Changed qjson-0.8.1.tar.bz2/src/serializer.cpp @@ -4,16 +4,16 @@ * Copyright (C) 2009 Flavio Castelli * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -25,61 +25,33 @@ #include #include -using namespace QJson; +#include -class Serializer::SerializerPrivate { -}; - -Serializer::Serializer() : d( new SerializerPrivate ) { -} +#ifdef _MSC_VER // using MSVC compiler +#include +#endif -Serializer::~Serializer() { - delete d; -} +using namespace QJson; -void Serializer::serialize( const QVariant& v, QIODevice* io, bool* ok ) -{ - Q_ASSERT( io ); - if (!io->isOpen()) { - if (!io->open(QIODevice::WriteOnly)) { - if ( ok != 0 ) - *ok = false; - qCritical ("Error opening device"); - return; +class Serializer::SerializerPrivate { + public: + SerializerPrivate() : + specialNumbersAllowed(false), + indentMode(QJson::IndentNone), + doublePrecision(6) { + errorMessage.clear(); } - } - - if (!io->isWritable()) { - if (ok != 0) - *ok = false; - qCritical ("Device is not readable"); - io->close(); - return; - } - - const QByteArray str = serialize( v ); - if ( !str.isNull() ) { - QDataStream stream( io ); - stream << str; - } else { - if ( ok ) - *ok = false; - } -} - -static QString sanitizeString( QString str ) -{ - str.replace( QLatin1String( "\\" ), QLatin1String( "\\\\" ) ); - str.replace( QLatin1String( "\"" ), QLatin1String( "\\\"" ) ); - str.replace( QLatin1String( "\b" ), QLatin1String( "\\b" ) ); - str.replace( QLatin1String( "\f" ), QLatin1String( "\\f" ) ); - str.replace( QLatin1String( "\n" ), QLatin1String( "\\n" ) ); - str.replace( QLatin1String( "\r" ), QLatin1String( "\\r" ) ); - str.replace( QLatin1String( "\t" ), QLatin1String( "\\t" ) ); - return QString( QLatin1String( "\"%1\"" ) ).arg( str ); -} + QString errorMessage; + bool specialNumbersAllowed; + IndentMode indentMode; + int doublePrecision; + QByteArray buildIndent(int spaces); + QByteArray serialize( const QVariant &v, bool *ok, int indentLevel = 0); + QString sanitizeString( QString str ); + QByteArray join( const QList& list, const QByteArray& sep ); +}; -static QByteArray join( const QList& list, const QByteArray& sep ) { +QByteArray Serializer::SerializerPrivate::join( const QList& list, const QByteArray& sep ) { QByteArray res; Q_FOREACH( const QByteArray& i, list ) { if ( !res.isEmpty() ) @@ -89,64 +61,353 @@ return res; } -QByteArray Serializer::serialize( const QVariant &v ) +QByteArray Serializer::SerializerPrivate::serialize( const QVariant &v, bool *ok, int indentLevel) { QByteArray str; bool error = false; + QByteArray indent; if ( ! v.isValid() ) { // invalid or null? str = "null"; - } else if ( v.type() == QVariant::List ) { // variant is a list? + } else if (( v.type() == QVariant::List ) || ( v.type() == QVariant::StringList )){ // an array or a stringlist? const QVariantList list = v.toList(); QList values; - Q_FOREACH( const QVariant& v, list ) + Q_FOREACH( const QVariant& var, list ) { - QByteArray serializedValue = serialize( v ); - if ( serializedValue.isNull() ) { - error = true; + indentLevel++; + QByteArray serializedValue = serialize( var, ok, indentLevel); + indentLevel--; + if ( !*ok ) { break; } values << serializedValue; } - str = "[ " + join( values, ", " ) + " ]"; + + if (indentMode == QJson::IndentMinimum) { + QByteArray indent = buildIndent(indentLevel - 1); + str = "[\n" + join( values, ",\n" ) + "\n" + indent + "]"; + } + else if (indentMode == QJson::IndentMedium || indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel); + str = "[\n" + join( values, ",\n" ) + "\n" + indent + "]"; + } + else if (indentMode == QJson::IndentCompact) { + str = "[" + join( values, "," ) + "]"; + } + else { + str = "[ " + join( values, ", " ) + " ]"; + } + } else if ( v.type() == QVariant::Map ) { // variant is a map? const QVariantMap vmap = v.toMap(); QMapIterator it( vmap ); - str = "{ "; + + if (indentMode == QJson::IndentMinimum) { + QByteArray indent = buildIndent(indentLevel); + str = indent + "{ "; + } + else if (indentMode == QJson::IndentMedium || indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel); + QByteArray nextindent = buildIndent(indentLevel + 1); + str = indent + "{\n" + nextindent; + } + else if (indentMode == QJson::IndentCompact) { + str = "{"; + } + else { + str = "{ "; + } + QList pairs; while ( it.hasNext() ) { it.next(); - QByteArray serializedValue = serialize( it.value() ); - if ( serializedValue.isNull() ) { - error = true; + indentLevel++; + QByteArray serializedValue = serialize( it.value(), ok, indentLevel); + indentLevel--; + if ( !*ok ) { break; } - pairs << sanitizeString( it.key() ).toUtf8() + " : " + serializedValue; + QByteArray key = sanitizeString( it.key() ).toUtf8(); + QByteArray value = serializedValue; + if (indentMode == QJson::IndentCompact) { + pairs << key + ":" + value; + } else { + pairs << key + " : " + value; + } + } + + if (indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel + 1); + str += join( pairs, ",\n" + indent); + } + else if (indentMode == QJson::IndentCompact) { + str += join( pairs, "," ); + } + else { + str += join( pairs, ", " ); + } + + if (indentMode == QJson::IndentMedium || indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel); + str += "\n" + indent + "}"; + } + else if (indentMode == QJson::IndentCompact) { + str += "}"; } - str += join( pairs, ", " ); - str += " }"; + else { + str += " }"; + } + + } else if ( v.type() == QVariant::Hash ) { // variant is a hash? + const QVariantHash vhash = v.toHash(); + QHashIterator it( vhash ); + + if (indentMode == QJson::IndentMinimum) { + QByteArray indent = buildIndent(indentLevel); + str = indent + "{ "; + } + else if (indentMode == QJson::IndentMedium || indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel); + QByteArray nextindent = buildIndent(indentLevel + 1); + str = indent + "{\n" + nextindent; + } + else if (indentMode == QJson::IndentCompact) { + str = "{"; + } + else { + str = "{ "; + } + + QList pairs; + while ( it.hasNext() ) { + it.next(); + indentLevel++; + QByteArray serializedValue = serialize( it.value(), ok, indentLevel); + indentLevel--; + if ( !*ok ) { + break; + } + QByteArray key = sanitizeString( it.key() ).toUtf8(); + QByteArray value = serializedValue; + if (indentMode == QJson::IndentCompact) { + pairs << key + ":" + value; + } else { + pairs << key + " : " + value; + } + } + + if (indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel + 1); + str += join( pairs, ",\n" + indent); + } + else if (indentMode == QJson::IndentCompact) { + str += join( pairs, "," ); + } + else { + str += join( pairs, ", " ); + } + + if (indentMode == QJson::IndentMedium || indentMode == QJson::IndentFull) { + QByteArray indent = buildIndent(indentLevel); + str += "\n" + indent + "}"; + } + else if (indentMode == QJson::IndentCompact) { + str += "}"; + } + else { + str += " }"; + } + } else if (( v.type() == QVariant::String ) || ( v.type() == QVariant::ByteArray )) { // a string or a byte array? str = sanitizeString( v.toString() ).toUtf8(); - } else if ( v.type() == QVariant::Double ) { // a double? - str = QByteArray::number( v.toDouble() ); - if( ! str.contains( "." ) && ! str.contains( "e" ) ) { - str += ".0"; + } else if (( v.type() == QVariant::Double) || ((QMetaType::Type)v.type() == QMetaType::Float)) { // a double or a float? + const double value = v.toDouble(); +#if defined _WIN32 && !defined(Q_OS_SYMBIAN) + const bool special = _isnan(value) || !_finite(value); +#elif defined(Q_OS_SYMBIAN) || defined(Q_OS_ANDROID) + const bool special = isnan(value) || isinf(value); +#else + const bool special = std::isnan(value) || std::isinf(value); +#endif + if (special) { + if (specialNumbersAllowed) { +#if defined _WIN32 && !defined(Q_OS_SYMBIAN) + if (_isnan(value)) { +#elif defined(Q_OS_SYMBIAN) || defined(Q_OS_ANDROID) + if (isnan(value)) { +#else + if (std::isnan(value)) { +#endif + str += "NaN"; + } else { + if (value<0) { + str += '-'; + } + str += "Infinity"; + } + } else { + errorMessage += QLatin1String("Attempt to write NaN or infinity, which is not supported by json\n"); + *ok = false; + } + } else { + str = QByteArray::number( value , 'g', doublePrecision); + if( ! str.contains( "." ) && ! str.contains( "e" ) ) { + str += ".0"; + } } } else if ( v.type() == QVariant::Bool ) { // boolean value? str = ( v.toBool() ? "true" : "false" ); } else if ( v.type() == QVariant::ULongLong ) { // large unsigned number? str = QByteArray::number( v.value() ); + } else if ( v.type() == QVariant::UInt ) { // unsigned int number? + str = QByteArray::number( v.value() ); } else if ( v.canConvert() ) { // any signed number? str = QByteArray::number( v.value() ); + } else if ( v.canConvert() ) { // unsigned short number? + str = QByteArray::number( v.value() ); } else if ( v.canConvert() ){ // can value be converted to string? // this will catch QDate, QDateTime, QUrl, ... str = sanitizeString( v.toString() ).toUtf8(); //TODO: catch other values like QImage, QRect, ... } else { - error = true; + *ok = false; + errorMessage += QLatin1String("Cannot serialize "); + errorMessage += v.toString(); + errorMessage += QLatin1String(" because type "); + errorMessage += QLatin1String(v.typeName()); + errorMessage += QLatin1String(" is not supported by QJson\n"); } - if ( !error ) + if ( *ok ) + { return str; + } else return QByteArray(); } + +QByteArray Serializer::SerializerPrivate::buildIndent(int spaces) +{ + QByteArray indent; + if (spaces < 0) { + spaces = 0; + } + for (int i = 0; i < spaces; i++ ) { + indent += " "; + } + return indent; +} + +QString Serializer::SerializerPrivate::sanitizeString( QString str ) +{ + str.replace( QLatin1String( "\\" ), QLatin1String( "\\\\" ) ); + + // escape unicode chars + QString result; + const ushort* unicode = str.utf16(); + unsigned int i = 0; + + while ( unicode[ i ] ) { + if ( unicode[ i ] < 128 ) { + result.append( QChar( unicode[ i ] ) ); + } + else { + QString hexCode = QString::number( unicode[ i ], 16 ).rightJustified( 4, + QLatin1Char('0') ); + + result.append( QLatin1String ("\\u") ).append( hexCode ); + } + ++i; + } + str = result; + + str.replace( QLatin1String( "\"" ), QLatin1String( "\\\"" ) ); + str.replace( QLatin1String( "\b" ), QLatin1String( "\\b" ) ); + str.replace( QLatin1String( "\f" ), QLatin1String( "\\f" ) ); + str.replace( QLatin1String( "\n" ), QLatin1String( "\\n" ) ); + str.replace( QLatin1String( "\r" ), QLatin1String( "\\r" ) ); + str.replace( QLatin1String( "\t" ), QLatin1String( "\\t" ) ); + + return QString( QLatin1String( "\"%1\"" ) ).arg( str ); +} + +Serializer::Serializer() + : d( new SerializerPrivate ) +{ +} + +Serializer::~Serializer() { + delete d; +} + +void Serializer::serialize( const QVariant& v, QIODevice* io, bool* ok) +{ + Q_ASSERT( io ); + *ok = true; + + if (!io->isOpen()) { + if (!io->open(QIODevice::WriteOnly)) { + d->errorMessage = QLatin1String("Error opening device"); + *ok = false; + return; + } + } + + if (!io->isWritable()) { + d->errorMessage = QLatin1String("Device is not readable"); + io->close(); + *ok = false; + return; + } + + const QByteArray str = serialize( v, ok); + if (*ok && (io->write(str) != str.count())) { + *ok = false; + d->errorMessage = QLatin1String("Something went wrong while writing to IO device"); + } +} + +QByteArray Serializer::serialize( const QVariant &v) +{ + bool ok; + + return serialize(v, &ok); +} + +QByteArray Serializer::serialize( const QVariant &v, bool *ok) +{ + bool _ok = true; + d->errorMessage.clear(); + + if (ok) { + *ok = true; + } else { + ok = &_ok; + } + + return d->serialize(v, ok); +} + +void QJson::Serializer::allowSpecialNumbers(bool allow) { + d->specialNumbersAllowed = allow; +} + +bool QJson::Serializer::specialNumbersAllowed() const { + return d->specialNumbersAllowed; +} + +void QJson::Serializer::setIndentMode(IndentMode mode) { + d->indentMode = mode; +} + +void QJson::Serializer::setDoublePrecision(int precision) { + d->doublePrecision = precision; +} + +IndentMode QJson::Serializer::indentMode() const { + return d->indentMode; +} + +QString QJson::Serializer::errorMessage() const { + return d->errorMessage; +} + [-] [+] Changed qjson-0.8.1.tar.bz2/src/serializer.h @@ -3,16 +3,16 @@ * Copyright (C) 2009 Till Adam * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -29,10 +29,83 @@ namespace QJson { /** + @brief How the indentation should work. + \verbatim + none (default) : { "foo" : 0, "foo1" : 1, "foo2" : [ { "foo3" : 3, "foo4" : 4 } ] } + + compact : {"foo":0,"foo1":1,"foo2":[{"foo3":3,"foo4":4}]} + + minimum : { "foo" : 0, "foo1" : 1, "foo2" : [ + { "foo3" : 3, "foo4" : 4 } + ] } + + medium : { + "foo" : 0, "foo1" : 1, "foo2" : [ + { + "foo3" : 3, "foo4" : 4 + } + ] + } + full : { + "foo" : 0, + "foo1" : 1, + "foo2" : [ + { + "foo3" : 3, + "foo4" : 4 + } + ] + } + + \endverbatim + */ + enum IndentMode { + IndentNone, + IndentCompact, + IndentMinimum, + IndentMedium, + IndentFull + }; + /** * @brief Main class used to convert QVariant objects to JSON data. * * QVariant objects are converted to a string containing the JSON data. - * If QVariant object is empty or not valid a null json object is returned. + * + * + * Usage: + * + * \code + * QVariantList people; + * + * QVariantMap bob; + * bob.insert("Name", "Bob"); + * bob.insert("Phonenumber", 123); + * + * QVariantMap alice; + * alice.insert("Name", "Alice"); + * alice.insert("Phonenumber", 321); + * + * people << bob << alice; + * + * QJson::Serializer serializer; + * bool ok; + * QByteArray json = serializer.serialize(people, &ok); + * + * if (ok) { + * qDebug() << json; + * } else { + * qCritical() << "Something went wrong:" << serializer.errorMessage(); + * } + * \endcode + * + * The output will be: + * + * \code + * "[ { "Name" : "Bob", "Phonenumber" : 123 }, + * { "Name" : "Alice", "Phonenumber" : 321 } ]" + * \endcode + * + * It's possible to tune the indentation level of the resulting string. \sa setIndentMode */ class QJSON_EXPORT Serializer { public: @@ -47,7 +120,7 @@ * @param out Input output device * @param ok if a conversion error occurs, *ok is set to false; otherwise *ok is set to true */ - void serialize( const QVariant& variant, QIODevice* out, bool* ok = 0 ); + void serialize( const QVariant& variant, QIODevice* out, bool* ok); /** * This is a method provided for convenience. It turns the passed in in-memory @@ -57,9 +130,54 @@ * * @param variant The JSON document in its in-memory representation as generated by the * parser. + * + * \deprecated This method is going to be removed with the next major release of QJson. */ + QByteArray serialize( const QVariant& variant); - QByteArray serialize( const QVariant& variant ); + /** + * This is a method provided for convenience. It turns the passed in in-memory + * representation of the JSON document into a textual one, which is returned. + * If the returned string is empty, the document was empty. If it was null, there + * was a parsing error. + * + * @param variant The JSON document in its in-memory representation as generated by the + * parser. + * @param ok if a conversion error occurs, *ok is set to false; otherwise *ok is set to true + */ + QByteArray serialize( const QVariant& variant, bool *ok); + + /** + * Allow or disallow writing of NaN and/or Infinity (as an extension to QJson) + */ + void allowSpecialNumbers(bool allow); + + /** + * Is Nan and/or Infinity allowed? + */ + bool specialNumbersAllowed() const; + + /** + * set output indentation mode as defined in QJson::IndentMode + */ + void setIndentMode(IndentMode mode = QJson::IndentNone); + + + /** + * set double precision used while converting Double + * \sa QByteArray::number + */ + void setDoublePrecision(int precision); + + /** + * Returns one of the indentation modes defined in QJson::IndentMode + */ + IndentMode indentMode() const; + + /** + * Returns the error message + */ + QString errorMessage() const; private: Q_DISABLE_COPY(Serializer) [-] [+] Changed qjson-0.8.1.tar.bz2/src/serializerrunnable.cpp @@ -6,16 +6,16 @@ * 2009 Frank Osterfeld * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -56,5 +56,7 @@ void SerializerRunnable::run() { Serializer serializer; - emit parsingFinished( Serializer().serialize( d->json ), true, QString() ); + bool ok; + const QByteArray serialized = serializer.serialize( d->json, &ok); + emit parsingFinished( serialized, ok, serializer.errorMessage() ); } [-] [+] Changed qjson-0.8.1.tar.bz2/src/serializerrunnable.h @@ -3,16 +3,16 @@ * Copyright (C) 2009 Frank Osterfeld * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. @@ -38,11 +38,6 @@ { Q_OBJECT public: - /** - * This signal is emitted when the conversion process has been completed - * @param data contains the JSON data that has to be converted - * @param parent parent of the object - **/ explicit SerializerRunnable(QObject* parent = 0); ~SerializerRunnable(); [-] [+] Added qjson-0.8.1.tar.bz2/tests/.gitignore @@ -0,0 +1 @@ +Makefile [-] [+] Changed qjson-0.8.1.tar.bz2/tests/CMakeLists.txt @@ -1,62 +1,4 @@ -##### Probably don't want to edit below this line ##### - -SET( QT_USE_QTTEST TRUE ) - -# Use it -INCLUDE( ${QT_USE_FILE} ) - -INCLUDE(AddFileDependencies) - -# Include the library include directories, and the current build directory (moc) -INCLUDE_DIRECTORIES( - ../src -${CMAKE_CURRENT_BINARY_DIR} -) - -ADD_EXECUTABLE( - cmdline_tester - cmdline_tester.cpp -) - -SET (qjson_test_support_SRCS person.cpp) -QT4_WRAP_CPP(qjson_test_support_MOC_SRCS person.h) - -ADD_LIBRARY (qjson_test_support STATIC ${qjson_test_support_SRCS} -${qjson_test_support_MOC_SRCS}) - -#ADD_FILE_DEPENDENCIES(cmdline_tester.cpp ${MOC_SOURCE}) -TARGET_LINK_LIBRARIES( - cmdline_tester -${QT_LIBRARIES} - qjson -) - -SET( UNIT_TESTS - testparser - testqobjecthelper - testserializer -) - -# Build the tests -FOREACH(test ${UNIT_TESTS}) - MESSAGE(STATUS "Building${test}") - QT4_WRAP_CPP(MOC_SOURCE ${test}.cpp) - ADD_EXECUTABLE( -${test} - ${test}.cpp - ) - - ADD_FILE_DEPENDENCIES(${test}.cpp ${MOC_SOURCE}) - TARGET_LINK_LIBRARIES( -${test} - ${QT_LIBRARIES} - qjson - qjson_test_support - ) - if (QJSON_TEST_OUTPUT STREQUAL "xml") - # produce XML output - add_test(${test} ${test} -xml -o${test}.tml ) - else (QJSON_TEST_OUTPUT STREQUAL "xml") - add_test( ${test}${test} ) - endif (QJSON_TEST_OUTPUT STREQUAL "xml") -ENDFOREACH() +ADD_SUBDIRECTORY(cmdline_tester) +ADD_SUBDIRECTORY(parser) +ADD_SUBDIRECTORY(qobjecthelper) +ADD_SUBDIRECTORY(serializer) [-] [+] Added qjson-0.8.1.tar.bz2/tests/cmdline_tester +(directory) [-] [+] Added qjson-0.8.1.tar.bz2/tests/cmdline_tester/.gitignore @@ -0,0 +1,4 @@ +Makefile +*.o +*.moc +cmdline_tester [-] [+] Added qjson-0.8.1.tar.bz2/tests/cmdline_tester/CMakeLists.txt @@ -0,0 +1,24 @@ +##### Probably don't want to edit below this line ##### + +# Use it +INCLUDE( ${QT_USE_FILE} ) + +INCLUDE(AddFileDependencies) + +# Include the library include directories, and the current build directory (moc) +INCLUDE_DIRECTORIES( + ../../include +${CMAKE_CURRENT_BINARY_DIR} +) + +ADD_EXECUTABLE( + cmdline_tester + cmdline_tester.cpp + cmdlineparser.cpp +) + +TARGET_LINK_LIBRARIES( + cmdline_tester + ${QT_LIBRARIES} + qjson +) [-] [+] Added qjson-0.8.1.tar.bz2/tests/cmdline_tester/cmdline_tester.cpp @@ -0,0 +1,92 @@ +/* This file is part of QJson + * + * Copyright (C) 2009 Flavio Castelli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cmdlineparser.h" + +using namespace QJson; + +int main(int argc, char *argv[]) { + QCoreApplication app (argc, argv); + QTime time; + int duration; + + + CmdLineParser cmd (app.arguments()); + CmdLineParser::Result res = cmd.parse(); + if (res == CmdLineParser::Help) + return 0; + else if (res == CmdLineParser::Error) + return -1; + + QString filename = cmd.file(); + if (!QFile::exists ( filename )) { + qCritical ("The file you specified doesn't exist!"); + exit (1); + } + + Parser parser; + bool ok; + + QFile file (filename); + time.start(); + QVariant data = parser.parse (&file, &ok); + duration = time.elapsed(); + if (!ok) { + qCritical("%s:%i - Error: %s", filename.toLatin1().data(), parser.errorLine(), qPrintable(parser.errorString())); + exit (1); + } + else { + qDebug() << "Parsing of" << filename << "took" << duration << "ms"; + if (!cmd.quiet()) + qDebug() << data; + } + + if (cmd.serialize()) { + // serializer tests + qDebug() << "Serializing... "; + QJson::Serializer serializer; + serializer.setIndentMode(cmd.indentationMode()); + time.start(); + QByteArray b = serializer.serialize(data, &ok); + if (!ok) { + qCritical() << "Serialization failed:" << serializer.errorMessage(); + exit(1); + } else { + duration = time.elapsed(); + qDebug() << "Serialization took:" << duration << "ms"; + if (!cmd.quiet()) + qDebug() << b; + } + } + + qDebug() << "JOB DONE, BYE"; + return 0; +} + [-] [+] Added qjson-0.8.1.tar.bz2/tests/cmdline_tester/cmdlineparser.cpp @@ -0,0 +1,159 @@ +/* This file is part of qjson + * + * Copyright (C) 2010 Flavio Castelli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include + +#include +#include + +#include "cmdlineparser.h" + +using namespace QJson; + +const QString CmdLineParser::m_helpMessage = QLatin1String( + "Usage: cmdline_tester [options] file\n\n" + "This program converts the json data read from 'file' to a QVariant object.\n" + "--quiet Do not print output generated by parser and serializer.\n" + "--serialize Parses the QVariant object back to json.\n" + "--indent Sets the indentation level used by the 'serialize' option.\n" + " Allowed values:\n" + " - none [default]\n" + " - minimum\n" + " - medium\n" + " - full\n" + "--help Displays this help.\n" + ); + + +CmdLineParser::CmdLineParser(const QStringList &arguments) + : m_pos(0), + m_indentationMode(IndentNone), + m_serialize(false), + m_quiet(false) +{ + for (int i = 1; i < arguments.count(); ++i) { + const QString &arg = arguments.at(i); + m_arguments.append(arg); + } +} + +CmdLineParser::Result CmdLineParser::parse() +{ + bool showHelp = false; + + while (m_error.isEmpty() && hasMoreArgs()) { + const QString &arg = nextArg(); + if (arg.toLower() == QLatin1String("--indent")) + handleSetIndentationMode(); + else if (arg.toLower() == QLatin1String("--help")) + showHelp = true; + else if (arg.toLower() == QLatin1String("--serialize")) + m_serialize = true; + else if (arg.toLower() == QLatin1String("--quiet")) + m_quiet = true; + else if (!arg.startsWith(QLatin1String("--"))) + m_file = arg; + else + m_error = QString(QLatin1String("Unknown option: %1")).arg(arg); + } + + if (m_file.isEmpty()) { + m_error = QLatin1String("You have to specify the file containing the json data."); + } + + if (!m_error.isEmpty()) { + showMessage(m_error + QLatin1String("\n\n\n") + m_helpMessage, true); + return Error; + } else if (showHelp) { + showMessage(m_helpMessage, false); + return Help; + } + return Ok; +} + +bool CmdLineParser::hasMoreArgs() const +{ + return m_pos < m_arguments.count(); +} + +const QString &CmdLineParser::nextArg() +{ + Q_ASSERT(hasMoreArgs()); + return m_arguments.at(m_pos++); +} + +void CmdLineParser::handleSetIndentationMode() +{ + if (hasMoreArgs()) { + const QString &indentationMode = nextArg(); + if (indentationMode.compare(QLatin1String("none"), Qt::CaseInsensitive) == 0) + m_indentationMode = IndentNone; + else if (indentationMode.compare(QLatin1String("minimum"), Qt::CaseInsensitive) == 0) + m_indentationMode = IndentMinimum; + else if (indentationMode.compare(QLatin1String("medium"), Qt::CaseInsensitive) == 0) + m_indentationMode = IndentMedium; + else if (indentationMode.compare(QLatin1String("full"), Qt::CaseInsensitive) == 0) + m_indentationMode = IndentFull; + else + m_error = QString(QLatin1String("Unknown indentation mode '%1'.")). + arg(indentationMode); + } else { + m_error = QLatin1String("Missing indentation level."); + } +} + +void CmdLineParser::showMessage(const QString &msg, bool error) +{ +#ifdef Q_OS_WIN + QString message = QLatin1String(" ") % msg % QLatin1String(" "); + if (error) + QMessageBox::critical(0, QLatin1String("Error"), message); + else + QMessageBox::information(0, QLatin1String("Notice"), message); +#else + fprintf(error ? stderr : stdout, "%s\n", qPrintable(msg)); +#endif +} + +void CmdLineParser::setIndentationMode(const IndentMode &mode) +{ + m_indentationMode = mode; +} + +IndentMode CmdLineParser::indentationMode() const +{ + return m_indentationMode; +} + +QString CmdLineParser::file() const +{ + return m_file; +} + +bool CmdLineParser::serialize() +{ + return m_serialize; +} + +bool CmdLineParser::quiet() +{ + return m_quiet; +} + [-] [+] Added qjson-0.8.1.tar.bz2/tests/cmdline_tester/cmdlineparser.h @@ -0,0 +1,64 @@ +/* This file is part of qjson + * + * Copyright (C) 2010 Flavio Castelli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef CMDLINEPARSER_H +#define CMDLINEPARSER_H + +#include +#include + +#include + +namespace QJson { + class CmdLineParser + { + public: + enum Result {Ok, Help, Error}; + + CmdLineParser(const QStringList &arguments); + Result parse(); + + void setIndentationMode(const IndentMode &mode); + IndentMode indentationMode() const; + QString helpFile() const; + QString file() const; + bool serialize(); + bool quiet(); + + void showMessage(const QString &msg, bool error); + + private: + bool hasMoreArgs() const; + const QString &nextArg(); + void handleSetIndentationMode(); + + QStringList m_arguments; + int m_pos; + IndentMode m_indentationMode; + QString m_file; + bool m_serialize; + bool m_quiet; + static const QString m_helpMessage; + QString m_error; + }; +} + +#endif + [-] [+] Changed qjson-0.8.1.tar.bz2/tests/cmdline_tester/example.txt (renamed to tests/cmdline_tester/example.txt) [-] [+] Changed qjson-0.8.1.tar.bz2/tests/cmdline_tester/example.txt (renamed to tests/cmdline_tester/example.txt) [-] [+] Added qjson-0.8.1.tar.bz2/tests/parser +(directory) [-] [+] Added qjson-0.8.1.tar.bz2/tests/parser/.gitignore @@ -0,0 +1,4 @@ +Makefile +*.o +*.moc +parser [-] [+] Added qjson-0.8.1.tar.bz2/tests/parser/CMakeLists.txt @@ -0,0 +1,41 @@ +##### Probably don't want to edit below this line ##### + +SET( QT_USE_QTTEST TRUE ) + +# Use it +INCLUDE(${QT_USE_FILE} ) + +INCLUDE(AddFileDependencies) + +# Include the library include directories, and the current build directory (moc) +INCLUDE_DIRECTORIES( + ../../include + ${CMAKE_CURRENT_BINARY_DIR} +) + +SET( UNIT_TESTS + testparser +) + +# Build the tests +FOREACH(test${UNIT_TESTS}) + MESSAGE(STATUS "Building ${test}") + QT4_WRAP_CPP(MOC_SOURCE${test}.cpp) + ADD_EXECUTABLE( + ${test} +${test}.cpp + ) + + ADD_FILE_DEPENDENCIES(${test}.cpp${MOC_SOURCE}) + TARGET_LINK_LIBRARIES( + ${test} +${QT_LIBRARIES} + qjson + ) + if (QJSON_TEST_OUTPUT STREQUAL "xml") + # produce XML output + add_test( ${test}${test} -xml -o ${test}.tml ) + else (QJSON_TEST_OUTPUT STREQUAL "xml") + add_test(${test} ${test} ) + endif (QJSON_TEST_OUTPUT STREQUAL "xml") +ENDFOREACH() [-] [+] Added qjson-0.8.1.tar.bz2/tests/parser/testparser.cpp @@ -0,0 +1,503 @@ +/* This file is part of QJson + * + * Copyright (C) 2008 Flavio Castelli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include + +#include + +#include + +#include +#include + + +class TestParser: public QObject +{ + Q_OBJECT + private slots: + void parseNonAsciiString(); + void parseSimpleObject(); + void parseEmptyObject(); + void parseEmptyValue(); + void parseUrl(); + void parseMultipleObject(); + + void parseSimpleArray(); + void parseInvalidObject(); + void parseInvalidObject_data(); + void parseMultipleArray(); + + void testTrueFalseNullValues(); + void testEscapeChars(); + void testNumbers(); + void testNumbers_data(); + void testTopLevelValues(); + void testTopLevelValues_data(); + void testSpecialNumbers(); + void testSpecialNumbers_data(); + void testReadWrite(); + void testReadWrite_data(); +}; + +Q_DECLARE_METATYPE(QVariant) +Q_DECLARE_METATYPE(QVariant::Type) + +using namespace QJson; + +void TestParser::parseSimpleObject() { + QByteArray json = "{\"foo\":\"bar\"}"; + QVariantMap map; + map.insert (QLatin1String("foo"), QLatin1String("bar")); + QVariant expected(map); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); +} + +void TestParser::parseEmptyObject() { + QByteArray json = "{}"; + QVariantMap map; + QVariant expected (map); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); +} + +void TestParser::parseEmptyValue() { + QByteArray json = "{\"value\": \"\"}"; + + QVariantMap map; + map.insert (QLatin1String("value"), QString(QLatin1String(""))); + QVariant expected (map); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); + QVERIFY (result.toMap().value(QLatin1String("value")).type() == QVariant::String); + + QString value = result.toMap().value(QLatin1String("value")).toString(); + QVERIFY (value.isEmpty()); +} + +void TestParser::parseInvalidObject() { + QFETCH(QByteArray, json); + + Parser parser; + bool ok; + parser.parse (json, &ok); + QVERIFY (!ok); +} + +void TestParser::parseInvalidObject_data() { + QTest::addColumn("json"); + + QTest::newRow("unclosed object") << QByteArray("{\"foo\":\"bar\""); + QTest::newRow("infinum (disallow") << QByteArray("Infinum"); + QTest::newRow("Nan (disallow") << QByteArray("NaN"); +} + + +void TestParser::parseNonAsciiString() { + QByteArray json = "{\"artist\":\"Queensr\\u00ffche\"}"; + QVariantMap map; + + QChar unicode_char (0x00ff); + QString unicode_string; + unicode_string.setUnicode(&unicode_char, 1); + unicode_string = QLatin1String("Queensr") + unicode_string + QLatin1String("che"); + + map.insert (QLatin1String("artist"), unicode_string); + QVariant expected (map); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); +} + +void TestParser::parseMultipleObject() { + //put also some extra spaces inside the json string + QByteArray json = "{ \"foo\":\"bar\",\n\"number\" : 51.3 , \"array\":[\"item1\", 123]}"; + QVariantMap map; + map.insert (QLatin1String("foo"), QLatin1String("bar")); + map.insert (QLatin1String("number"), 51.3); + QVariantList list; + list.append (QLatin1String("item1")); + list.append (QLatin1String("123")); + map.insert (QLatin1String("array"), list); + QVariant expected (map); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); + QVERIFY (result.toMap().value(QLatin1String("number")).canConvert()); + QVERIFY (result.toMap().value(QLatin1String("array")).canConvert()); +} + +void TestParser::parseUrl(){ + //"http:\/\/www.last.fm\/venue\/8926427" + QByteArray json = "[\"http:\\/\\/www.last.fm\\/venue\\/8926427\"]"; + QVariantList list; + list.append (QVariant(QLatin1String("http://www.last.fm/venue/8926427"))); + QVariant expected (list); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); +} + + void TestParser::parseSimpleArray() { + QByteArray json = "[\"foo\",\"bar\"]"; + QVariantList list; + list.append (QLatin1String("foo")); + list.append (QLatin1String("bar")); + QVariant expected (list); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); +} + +void TestParser::parseMultipleArray() { + //put also some extra spaces inside the json string + QByteArray json = "[ {\"foo\":\"bar\"},\n\"number\",51.3 , [\"item1\", 123]]"; + QVariantMap map; + map.insert (QLatin1String("foo"), QLatin1String("bar")); + + QVariantList array; + array.append (QLatin1String("item1")); + array.append (123); + + QVariantList list; + list.append (map); + list.append (QLatin1String("number")); + list.append (QLatin1String("51.3")); + list.append ((QVariant) array); + + QVariant expected (list); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); +} + +void TestParser::testTrueFalseNullValues() { + QByteArray json = "[true,false, null, {\"foo\" : true}]"; + QVariantList list; + list.append (QVariant(true)); + list.append (QVariant(false)); + list.append (QVariant()); + QVariantMap map; + map.insert (QLatin1String("foo"), true); + list.append (map); + QVariant expected (list); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result, expected); + QCOMPARE (result.toList().at(0).toBool(), true); + QCOMPARE (result.toList().at(1).toBool(), false); + QVERIFY (result.toList().at(2).isNull()); +} + +void TestParser::testEscapeChars() { + QByteArray json = "[\"\\b \\f \\n \\r \\t \", \" \\\\ \\/ \\\\\", \"http:\\/\\/foo.com\"]"; + + QVariantList list; + list.append (QLatin1String("\b \f \n \r \t ")); + list.append (QLatin1String(" \\ / \\")); + list.append (QLatin1String("http://foo.com")); + + QVariant expected (list); + + Parser parser; + bool ok; + QVariant result = parser.parse (json, &ok); + QVERIFY (ok); + QCOMPARE(result.toList().size(), expected.toList().size() ); + QCOMPARE(result, expected); +} + +void TestParser::testNumbers() { + QFETCH(QByteArray, input); + QFETCH(QVariant, expected); + QFETCH(QVariant::Type, type); + + Parser parser; + bool ok; + QVariant result = parser.parse ('[' + input + ']', &ok); + QVERIFY (ok); + + QVariant value = result.toList().at(0); + QCOMPARE(value, expected); + QCOMPARE( value.type(), type); +} + +void TestParser::testNumbers_data() { + QTest::addColumn( "input" ); + QTest::addColumn( "expected" ); + QTest::addColumn( "type" ); + + QByteArray input; + QVariant output; + + // simple ulonglong + input = QByteArray("1"); + output = QVariant(QVariant::ULongLong); + output.setValue(1); + + QTest::newRow("simple ulonglong") << input << output << QVariant::ULongLong; + + // big number + input = QByteArray("12345678901234567890"); + output = QVariant(QVariant::ULongLong); + output.setValue(12345678901234567890ull); + + QTest::newRow("big number") << input << output << QVariant::ULongLong; + + // simple double + input = QByteArray("2.004"); + output = QVariant(QVariant::Double); + output.setValue(2.004); + + QTest::newRow("simple double") << input << output << QVariant::Double; + + // negative int + input = QByteArray("-100"); + output = QVariant(QVariant::LongLong); + output.setValue(-100); + + QTest::newRow("negative int") << input << output << QVariant::LongLong; + + // negative double + input = QByteArray("-3.4"); + output = QVariant(QVariant::Double); + output.setValue(-3.4); + + QTest::newRow("negative double") << input << output << QVariant::Double; + + // exp1 + input = QByteArray("-5e+"); + output = QVariant(QVariant::ByteArray); + output.setValue(input); + + QTest::newRow("exp1") << input << output << QVariant::ByteArray; + + // exp2 + input = QByteArray("2e"); + output = QVariant(QVariant::ByteArray); + output.setValue(input); + + QTest::newRow("exp2") << input << output << QVariant::ByteArray; + + // exp3 + input = QByteArray("3e+"); + output = QVariant(QVariant::ByteArray); + output.setValue(input); + + QTest::newRow("exp3") << input << output << QVariant::ByteArray; + + // exp4 + input = QByteArray("4.3E"); + output = QVariant(QVariant::ByteArray); + output.setValue(input); + + QTest::newRow("exp4") << input << output << QVariant::ByteArray; + + // exp5 + input = QByteArray("5.4E-"); + output = QVariant(QVariant::ByteArray); + output.setValue(input); + + QTest::newRow("exp5") << input << output << QVariant::ByteArray; +} + +void TestParser::testTopLevelValues() { + QFETCH(QByteArray, input); + QFETCH(QVariant, expected); + QFETCH(QVariant::Type, type); + + Parser parser; + bool ok; + QVariant result = parser.parse (input, &ok); + QVERIFY (ok); + + QCOMPARE(result, expected); + QCOMPARE(result.type(), type); +} + +void TestParser::testTopLevelValues_data() { + QTest::addColumn( "input" ); + QTest::addColumn( "expected" ); + QTest::addColumn( "type" ); + + QByteArray input; + QVariant output; + + // string + input = QByteArray("\"foo bar\""); + output = QVariant(QLatin1String("foo bar")); + QTest::newRow("string") << input << output << QVariant::String; + + // number + input = QByteArray("2.4"); + output = QVariant(QVariant::Double); + output.setValue(2.4); + QTest::newRow("simple double") << input << output << QVariant::Double; + + // boolean + input = QByteArray("true"); + output = QVariant(QVariant::Bool); + output.setValue(true); + QTest::newRow("bool") << input << output << QVariant::Bool; + + // null + input = QByteArray("null"); + output = QVariant(); + QTest::newRow("null") << input << output << QVariant::Invalid; + + // array + input = QByteArray("[1,2,3]"); + QVariantList list; + list << QVariant(1) << QVariant(2) << QVariant(3); + output = QVariant(QVariant::List); + output.setValue(list); + QTest::newRow("array") << input << output << QVariant::List; + + // object + input = QByteArray("{\"foo\" : \"bar\"}"); + QVariantMap map; + map.insert(QLatin1String("foo"), QLatin1String("bar")); + output = QVariant(QVariant::Map); + output.setValue(map); + QTest::newRow("object") << input << output << QVariant::Map; +} + +void TestParser::testSpecialNumbers() { + QFETCH(QByteArray, input); + QFETCH(bool, isOk); + QFETCH(bool, isInfinity); + QFETCH(bool, isNegative); + QFETCH(bool, isNan); + + Parser parser; + QVERIFY(!parser.specialNumbersAllowed()); + parser.allowSpecialNumbers(true); + QVERIFY(parser.specialNumbersAllowed()); + bool ok; + QVariant value = parser.parse(input, &ok); + QCOMPARE(ok, isOk); + QVERIFY(value.type() == QVariant::Double); + if (ok) { + double v = value.toDouble(); +#ifdef Q_OS_SYMBIAN + QCOMPARE(bool(isinf(v)), isInfinity); +#else +// skip this test for MSVC, because there is no "isinf" function. +#ifndef Q_CC_MSVC + QCOMPARE(bool(std::isinf(v)), isInfinity); +#endif +#endif + QCOMPARE(v<0, isNegative); +#ifdef Q_OS_SYMBIAN + QCOMPARE(bool(isnan(v)), isNan); +#else +// skip this test for MSVC, because there is no "isinf" function. +#ifndef Q_CC_MSVC + QCOMPARE(bool(std::isnan(v)), isNan); +#endif +#endif + } +} +void TestParser::testSpecialNumbers_data() { + QTest::addColumn("input"); + QTest::addColumn("isOk"); + QTest::addColumn("isInfinity"); + QTest::addColumn("isNegative"); + QTest::addColumn("isNan"); + + QTest::newRow("42.0") << QByteArray("42.0") << true << false << false << false; + QTest::newRow("0.0") << QByteArray("0.0") << true << false << false << false; + QTest::newRow("-42.0") << QByteArray("-42.0") << true << false << true << false; + QTest::newRow("Infinity") << QByteArray("Infinity") << true << true << false << false; + QTest::newRow("-Infinity") << QByteArray("-Infinity") << true << true << true << false; + QTest::newRow("NaN") << QByteArray("NaN") << true << false << false << true; +} + +void TestParser::testReadWrite() +{ + QFETCH( QVariant, variant ); + Serializer serializer; + bool ok; + + QByteArray json = serializer.serialize(variant, &ok); + QVERIFY(ok); + + Parser parser; + QVariant result = parser.parse( json, &ok ); + QVERIFY(ok); + QCOMPARE( result, variant ); +} + +void TestParser::testReadWrite_data() +{ + QTest::addColumn( "variant" ); + + // array tests + QTest::newRow( "empty array" ) << QVariant(QVariantList()); + + // basic array + QVariantList list; + list << QString(QLatin1String("hello")); + list << 12; + QTest::newRow( "basic array" ) << QVariant(list); + + // simple map + QVariantMap map; + map[QString(QLatin1String("Name"))] = 32; + QTest::newRow( "complicated array" ) << QVariant(map); +} + +QTEST_MAIN(TestParser) + +#ifdef QMAKE_BUILD + #include "testparser.moc" +#else + #include "moc_testparser.cxx" +#endif [-] [+] Added qjson-0.8.1.tar.bz2/tests/qobjecthelper +(directory) [-] [+] Added qjson-0.8.1.tar.bz2/tests/qobjecthelper/.gitignore @@ -0,0 +1,5 @@ +Makefile +*.o +*.moc +moc_* +qobjecthelper [-] [+] Added qjson-0.8.1.tar.bz2/tests/qobjecthelper/CMakeLists.txt @@ -0,0 +1,48 @@ +##### Probably don't want to edit below this line ##### + +SET( QT_USE_QTTEST TRUE ) + +# Use it +INCLUDE(${QT_USE_FILE} ) + +INCLUDE(AddFileDependencies) + +# Include the library include directories, and the current build directory (moc) +INCLUDE_DIRECTORIES( + ../../include + ${CMAKE_CURRENT_BINARY_DIR} +) + +SET (qjson_test_support_SRCS person.cpp) +QT4_WRAP_CPP(qjson_test_support_MOC_SRCS person.h) + +ADD_LIBRARY (qjson_test_support STATIC${qjson_test_support_SRCS} + ${qjson_test_support_MOC_SRCS}) + +SET( UNIT_TESTS + testqobjecthelper +) + +# Build the tests +FOREACH(test${UNIT_TESTS}) + MESSAGE(STATUS "Building ${test}") + QT4_WRAP_CPP(MOC_SOURCE${test}.cpp) + ADD_EXECUTABLE( + ${test} +${test}.cpp + ) + + ADD_FILE_DEPENDENCIES(${test}.cpp${MOC_SOURCE}) + TARGET_LINK_LIBRARIES( + ${test} +${QT_LIBRARIES} + qjson + qjson_test_support + ) + if (QJSON_TEST_OUTPUT STREQUAL "xml") + # produce XML output + add_test( ${test}${test} -xml -o ${test}.tml ) + else (QJSON_TEST_OUTPUT STREQUAL "xml") + add_test(${test} ${test} ) + endif (QJSON_TEST_OUTPUT STREQUAL "xml") +ENDFOREACH() [-] [+] Added qjson-0.8.1.tar.bz2/tests/qobjecthelper/person.cpp @@ -0,0 +1,75 @@ +#include "person.h" + +Person::Person(QObject* parent) + : QObject(parent), + m_name(), + m_phoneNumber(0), + m_gender(Female), + m_luckyNumber(0) +{ +} + +Person::~Person() +{ +} + +QString Person::name() const +{ + return m_name; +} + +void Person::setName(const QString& name) +{ + m_name = name; +} + +int Person::phoneNumber() const +{ + return m_phoneNumber; +} + +void Person::setPhoneNumber(const int phoneNumber) +{ + m_phoneNumber = phoneNumber; +} + +void Person::setGender(Gender gender) +{ + m_gender = gender; +} + +Person::Gender Person::gender() const +{ + return m_gender; +} + +QDate Person::dob() const +{ + return m_dob; +} + +void Person::setDob(const QDate& dob) +{ + m_dob = dob; +} + +QVariant Person::customField() const +{ + return m_customField; +} + +void Person::setCustomField(const QVariant& customField) +{ + m_customField = customField; +} + +const quint16 Person::luckyNumber() const +{ + return m_luckyNumber; +} + +void Person::setLuckyNumber(const quint16 luckyNumber) +{ + m_luckyNumber = luckyNumber; +} + [-] [+] Added qjson-0.8.1.tar.bz2/tests/qobjecthelper/person.h @@ -0,0 +1,73 @@ +/* This file is part of qjson + * + * Copyright (C) 2009 Till Adam + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PERSON_H +#define PERSON_H + +#include +#include +#include +#include + +class Person : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(int phoneNumber READ phoneNumber WRITE setPhoneNumber) + Q_PROPERTY(Gender gender READ gender WRITE setGender) + Q_PROPERTY(QDate dob READ dob WRITE setDob) + Q_PROPERTY(QVariant customField READ customField WRITE setCustomField) + Q_PROPERTY(quint16 luckyNumber READ luckyNumber WRITE setLuckyNumber) + Q_ENUMS(Gender) + + public: + Person(QObject* parent = 0); + ~Person(); + + QString name() const; + void setName(const QString& name); + + int phoneNumber() const; + void setPhoneNumber(const int phoneNumber); + + enum Gender {Male, Female}; + void setGender(Gender gender); + Gender gender() const; + + QDate dob() const; + void setDob(const QDate& dob); + + QVariant customField() const; + void setCustomField(const QVariant& customField); + + const quint16 luckyNumber() const; + void setLuckyNumber(const quint16 luckyNumber); + + private: + QString m_name; + int m_phoneNumber; + Gender m_gender; + QDate m_dob; + QVariant m_customField; + quint16 m_luckyNumber; +}; + +#endif [-] [+] Added qjson-0.8.1.tar.bz2/tests/qobjecthelper/testqobjecthelper.cpp @@ -0,0 +1,124 @@ + +/* This file is part of QJson + * + * Copyright (C) 2009 Flavio Castelli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include + +#include +#include + +#include + +#include +#include +#include + +#include "person.h" + +class TestQObjectHelper: public QObject +{ + Q_OBJECT + private slots: + void testQObject2QVariant(); + void testQVariant2QObject(); +}; + +using namespace QJson; + +void TestQObjectHelper::testQObject2QVariant() +{ + QString name = QLatin1String("Flavio Castelli"); + int phoneNumber = 123456; + Person::Gender gender = Person::Male; + QDate dob (1982, 7, 12); + QVariantList nicknames; + nicknames << QLatin1String("nickname1") << QLatin1String("nickname2"); + quint16 luckyNumber = 123; + + Person person; + person.setName(name); + person.setPhoneNumber(phoneNumber); + person.setGender(gender); + person.setDob(dob); + person.setCustomField(nicknames); + person.setLuckyNumber(luckyNumber); + + QVariantMap expected; + expected[QLatin1String("name")] = QVariant(name); + expected[QLatin1String("phoneNumber")] = QVariant(phoneNumber); + expected[QLatin1String("gender")] = QVariant(gender); + expected[QLatin1String("dob")] = QVariant(dob); + expected[QLatin1String("customField")] = nicknames; + expected[QLatin1String("luckyNumber")] = luckyNumber; + + QVariantMap result = QObjectHelper::qobject2qvariant(&person); + QCOMPARE(result, expected); +} + +void TestQObjectHelper::testQVariant2QObject() +{ + bool ok; + QString name = QLatin1String("Flavio Castelli"); + int phoneNumber = 123456; + Person::Gender gender = Person::Male; + QDate dob (1982, 7, 12); + QVariantList nicknames; + nicknames << QLatin1String("nickname1") << QLatin1String("nickname2"); + quint16 luckyNumber = 123; + + Person expected_person; + expected_person.setName(name); + expected_person.setPhoneNumber(phoneNumber); + expected_person.setGender(gender); + expected_person.setDob(dob); + expected_person.setCustomField(nicknames); + expected_person.setLuckyNumber(luckyNumber); + + QVariantMap variant = QObjectHelper::qobject2qvariant(&expected_person); + + Serializer serializer; + QByteArray json = serializer.serialize(variant, &ok); + qDebug() << "json is" << json; + QVERIFY(ok); + + Parser parser; + QVariant parsedVariant = parser.parse(json,&ok); + QVERIFY(ok); + qDebug() << parsedVariant; + QVERIFY(parsedVariant.canConvert(QVariant::Map)); + + Person person; + QCOMPARE(Person::Female, person.gender()); + QObjectHelper::qvariant2qobject(parsedVariant.toMap(), &person); + + QCOMPARE(person.name(), name); + QCOMPARE(person.phoneNumber(), phoneNumber); + QCOMPARE(person.gender(), gender); + QCOMPARE(person.dob(), dob); + QCOMPARE(person.customField(), QVariant(nicknames)); + QCOMPARE(person.luckyNumber(), luckyNumber); +} + +QTEST_MAIN(TestQObjectHelper) +#ifdef QMAKE_BUILD + #include "testqobjecthelper.moc" +#else + #include "moc_testqobjecthelper.cxx" +#endif [-] [+] Added qjson-0.8.1.tar.bz2/tests/serializer +(directory) [-] [+] Added qjson-0.8.1.tar.bz2/tests/serializer/.gitignore @@ -0,0 +1,4 @@ +Makefile +*.o +*.moc +serializer [-] [+] Added qjson-0.8.1.tar.bz2/tests/serializer/CMakeLists.txt @@ -0,0 +1,41 @@ +##### Probably don't want to edit below this line ##### + +SET( QT_USE_QTTEST TRUE ) + +# Use it +INCLUDE(${QT_USE_FILE} ) + +INCLUDE(AddFileDependencies) + +# Include the library include directories, and the current build directory (moc) +INCLUDE_DIRECTORIES( + ../../include + ${CMAKE_CURRENT_BINARY_DIR} +) + +SET( UNIT_TESTS + testserializer +) + +# Build the tests +FOREACH(test${UNIT_TESTS}) + MESSAGE(STATUS "Building ${test}") + QT4_WRAP_CPP(MOC_SOURCE${test}.cpp) + ADD_EXECUTABLE( + ${test} +${test}.cpp + ) + + ADD_FILE_DEPENDENCIES(${test}.cpp${MOC_SOURCE}) + TARGET_LINK_LIBRARIES( + ${test} +${QT_LIBRARIES} + qjson + ) + if (QJSON_TEST_OUTPUT STREQUAL "xml") + # produce XML output + add_test( ${test}${test} -xml -o ${test}.tml ) + else (QJSON_TEST_OUTPUT STREQUAL "xml") + add_test(${test} ${test} ) + endif (QJSON_TEST_OUTPUT STREQUAL "xml") +ENDFOREACH() [-] [+] Added qjson-0.8.1.tar.bz2/tests/serializer/testserializer.cpp @@ -0,0 +1,541 @@ +/* This file is part of QJson + * + * Copyright (C) 2009 Flavio Castelli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include + +#include + +#include + +#include +#include + +class TestSerializer: public QObject +{ + Q_OBJECT + private slots: + void testReadWriteEmptyDocument(); + void testReadWrite(); + void testReadWrite_data(); + void testValueNull(); + void testValueString(); + void testValueString_data(); + void testValueStringList(); + void testValueStringList_data(); + void testValueHashMap(); + void testValueInteger(); + void testValueInteger_data(); + void testValueDouble(); + void testValueDouble_data(); + void testSetDoublePrecision(); + void testValueFloat(); + void testValueFloat_data(); + void testValueBoolean(); + void testValueBoolean_data(); + void testSpecialNumbers(); + void testSpecialNumbers_data(); + void testIndentation(); + void testIndentation_data(); + void testSerializetoQIODevice(); + void testSerializeWithoutOkParam(); + + private: + void valueTest( const QVariant& value, const QString& expectedRegExp, bool errorExpected = false ); + void valueTest( const QObject* object, const QString& expectedRegExp ); +}; + +Q_DECLARE_METATYPE(QVariant) + +using namespace QJson; + +void TestSerializer::testReadWriteEmptyDocument() +{ + QByteArray json = ""; + Parser parser; + bool ok; + QVariant result = parser.parse( json, &ok ); + QVERIFY(ok); + QVERIFY( ! result.isValid() ); + Serializer serializer; + const QByteArray serialized = serializer.serialize( result, &ok); + QVERIFY( ok ); + QByteArray expected = "null"; + QCOMPARE(expected, serialized); +} + +void TestSerializer::testReadWrite() +{ + QFETCH( QByteArray, json ); + Parser parser; + bool ok; + QVariant result = parser.parse( json, &ok ); + QVERIFY(ok); + Serializer serializer; + const QByteArray serialized = serializer.serialize( result, &ok); + QVERIFY(ok); + QVariant writtenThenRead = parser.parse( serialized, &ok ); + QVERIFY(ok); + QCOMPARE( result, writtenThenRead ); +} + +void TestSerializer::testReadWrite_data() +{ + QTest::addColumn( "json" ); + + // array tests + QTest::newRow( "empty array" ) << QByteArray("[]"); + QTest::newRow( "basic array" ) << QByteArray("[\"person\",\"bar\"]"); + QTest::newRow( "single int array" ) << QByteArray("[6]"); + QTest::newRow( "int array" ) << QByteArray("[6,5,6,7]"); + const QByteArray json = "[1,2.4, -100, -3.4, -5e+, 2e,3e+,4.3E,5.4E-]"; + QTest::newRow( QByteArray("array of various numbers") ) << json; + + // document tests + QTest::newRow( "empty object" ) << QByteArray("{}"); + QTest::newRow( "basic document" ) << QByteArray("{\"person\":\"bar\"}"); + QTest::newRow( "object with ints" ) << QByteArray("{\"person\":6}"); + const QByteArray json2 = "{ \"person\":\"bar\",\n\"number\" : 51.3 , \"array\":[\"item1\", 123]}"; + QTest::newRow( "complicated document" ) << json2; + + // more complex cases + const QByteArray json3 = "[ {\"person\":\"bar\"},\n\"number\",51.3 , [\"item1\", 123]]"; + QTest::newRow( "complicated array" ) << json3; +} + +void TestSerializer::testIndentation() +{ + QFETCH( QByteArray, json ); + QFETCH( QByteArray, expected_compact ); + QFETCH( QByteArray, expected_min ); + QFETCH( QByteArray, expected_med ); + QFETCH( QByteArray, expected_full ); + + // parse + Parser parser; + bool ok; + QVariant parsed = parser.parse( json, &ok ); + QVERIFY(ok); + + Serializer serializer; + QVariant reparsed; + QByteArray serialized; + + // serialize with indent compact and reparse + serializer.setIndentMode(QJson::IndentCompact); + serialized = serializer.serialize( parsed, &ok); + QVERIFY(ok); + QCOMPARE( serialized, expected_compact); + reparsed = parser.parse( serialized, &ok); + QVERIFY(ok); + QCOMPARE( parsed, reparsed); + + // serialize with indent minimum and reparse + serializer.setIndentMode(QJson::IndentMinimum); + serialized = serializer.serialize( parsed, &ok); + QVERIFY(ok); + QCOMPARE( serialized, expected_min); + reparsed = parser.parse( serialized, &ok); + QVERIFY(ok); + QCOMPARE( parsed, reparsed); + + // serialize with indent medium and reparse + serializer.setIndentMode(QJson::IndentMedium); + serialized = serializer.serialize( parsed, &ok); + QVERIFY(ok); + QCOMPARE( serialized, expected_med); + reparsed = parser.parse( serialized, &ok ); + QVERIFY(ok); + QCOMPARE( parsed, reparsed); + + // serialize with indent full and reparse + serializer.setIndentMode(QJson::IndentFull); + serialized = serializer.serialize( parsed, &ok); + QVERIFY(ok); + QCOMPARE( serialized, expected_full); + reparsed = parser.parse( serialized, &ok ); + QVERIFY(ok); + QCOMPARE( parsed, reparsed); +} + +void TestSerializer::testIndentation_data() +{ + QTest::addColumn( "json" ); + QTest::addColumn( "expected_compact" ); + QTest::addColumn( "expected_min" ); + QTest::addColumn( "expected_med" ); + QTest::addColumn( "expected_full" ); + const QByteArray json = " { \"foo\" : 0, \"foo1\" : 1, \"foo2\" : [ { \"foo3\" : 3, \"foo4\" : 4 } ] }"; + const QByteArray ex_compact = "{\"foo\":0,\"foo1\":1,\"foo2\":[{\"foo3\":3,\"foo4\":4}]}"; + const QByteArray ex_min = "{ \"foo\" : 0, \"foo1\" : 1, \"foo2\" : [\n { \"foo3\" : 3, \"foo4\" : 4 }\n] }"; + const QByteArray ex_med = "{\n \"foo\" : 0, \"foo1\" : 1, \"foo2\" : [\n {\n \"foo3\" : 3, \"foo4\" : 4\n }\n ]\n}"; + const QByteArray ex_full = "{\n \"foo\" : 0,\n \"foo1\" : 1,\n \"foo2\" : [\n {\n \"foo3\" : 3,\n \"foo4\" : 4\n }\n ]\n}"; + QTest::newRow( "test indents" ) << json << ex_compact << ex_min << ex_med << ex_full; +} + +void TestSerializer::valueTest( const QVariant& value, const QString& expectedRegExp, bool errorExpected ) +{ + Serializer serializer; + bool ok; + const QByteArray serialized = serializer.serialize( value, &ok); + QCOMPARE(ok, !errorExpected); + QCOMPARE(serialized.isNull(), errorExpected); + const QString serializedUnicode = QString::fromUtf8( serialized ); + if (!errorExpected) { + QRegExp expected( expectedRegExp ); + QVERIFY( expected.isValid() ); + QVERIFY2( expected.exactMatch( serializedUnicode ), + qPrintable( QString( QLatin1String( "Expected regexp \"%1\" but got \"%2\"." ) ) + .arg( expectedRegExp ).arg( serializedUnicode ) ) ); + } else { + QVERIFY(!serializer.errorMessage().isEmpty()); + } +} + +void TestSerializer::valueTest( const QObject* object, const QString& expectedRegExp ) +{ + Serializer serializer; + bool ok; + const QByteArray serialized = serializer.serialize( object, &ok); + QVERIFY(ok); + const QString serializedUnicode = QString::fromUtf8( serialized ); + QRegExp expected( expectedRegExp ); + QVERIFY( expected.isValid() ); + QVERIFY2( expected.exactMatch( serializedUnicode ), + qPrintable( QString( QLatin1String( "Expected regexp \"%1\" but got \"%2\"." ) ) + .arg( expectedRegExp ).arg( serializedUnicode ) ) ); +} + +void TestSerializer::testValueNull() +{ + valueTest( QVariant(), QLatin1String( "\\s*null\\s*" ) ); + QVariantMap map; + map[QLatin1String("value")] = QVariant(); + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:\\s*null\\s*\\}\\s*" ) ); +} + +void TestSerializer::testValueString() +{ + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + valueTest( value, expected ); + + QVariantMap map; + map[QLatin1String("value")] = value; + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); +} + +void TestSerializer::testValueString_data() +{ + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + QTest::newRow( "null string" ) << QVariant( QString() ) << QString( QLatin1String( "\\s*\"\"\\s*" ) ); + QTest::newRow( "empty string" ) << QVariant( QString( QLatin1String( "" ) ) ) << QString( QLatin1String( "\\s*\"\"\\s*" ) ); + QTest::newRow( "Simple String" ) << QVariant( QString( QLatin1String( "simpleString" ) ) ) << QString( QLatin1String( "\\s*\"simpleString\"\\s*" ) ); + QTest::newRow( "string with tab" ) << QVariant( QString( QLatin1String( "string\tstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\tstring\"\\s*" ) ); + QTest::newRow( "string with newline" ) << QVariant( QString( QLatin1String( "string\nstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\nstring\"\\s*" ) ); + QTest::newRow( "string with bell" ) << QVariant( QString( QLatin1String( "string\bstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\bstring\"\\s*" ) ); + QTest::newRow( "string with return" ) << QVariant( QString( QLatin1String( "string\rstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\rstring\"\\s*" ) ); + QTest::newRow( "string with double quote" ) << QVariant( QString( QLatin1String( "string\"string" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\\"string\"\\s*" ) ); + QTest::newRow( "string with backslash" ) << QVariant( QString( QLatin1String( "string\\string" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\\\\\string\"\\s*" ) ); + QString testStringWithUnicode = QString( QLatin1String( "string" ) ) + QChar( 0x2665 ) + QLatin1String( "string" ); + QString testEscapedString = QString( QLatin1String( "string" ) ) + QLatin1String("\\\\u2665") + QLatin1String( "string" ); + QTest::newRow( "string with unicode" ) << QVariant( testStringWithUnicode ) << QLatin1String( "\\s*\"" ) + testEscapedString + QLatin1String( "\"\\s*" ); +} + +void TestSerializer::testValueStringList() +{ + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + valueTest( value, expected ); + + QVariantMap map; + map[QLatin1String("value")] = value; + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); +} + +void TestSerializer::testValueStringList_data() +{ + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + + QStringList stringlist; + QString expected; + + // simple QStringList + stringlist << QLatin1String("hello") << QLatin1String("world"); + expected = QLatin1String( "\\s*\$\\s*\"hello\"\\s*,\\s*\"world\"\\s*\$\\s*" ); + QTest::newRow( "simple QStringList" ) << QVariant( stringlist) << expected; +} + +void TestSerializer::testValueInteger() +{ + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + valueTest( value, expected ); + + QVariantMap map; + map[QLatin1String("value")] = value; + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); +} + +void TestSerializer::testValueInteger_data() +{ + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + + QTest::newRow( "int 0" ) << QVariant( static_cast( 0 ) ) << QString( QLatin1String( "\\s*0\\s*" ) ); + QTest::newRow( "uint 0" ) << QVariant( static_cast( 0 ) ) << QString( QLatin1String( "\\s*0\\s*" ) ); + QTest::newRow( "int -1" ) << QVariant( static_cast( -1 ) ) << QString( QLatin1String( "\\s*-1\\s*" ) ); + QTest::newRow( "int 2133149800" ) << QVariant( static_cast(2133149800) ) << QString( QLatin1String( "\\s*2133149800\\s*" ) ); + QTest::newRow( "uint 4133149800" ) << QVariant( static_cast(4133149800u) ) << QString( QLatin1String( "\\s*4133149800\\s*" ) ); + QTest::newRow( "uint64 932838457459459" ) << QVariant( Q_UINT64_C(932838457459459) ) << QString( QLatin1String( "\\s*932838457459459\\s*" ) ); + QTest::newRow( "max unsigned long long" ) << QVariant( std::numeric_limits::max() ) << QString( QLatin1String( "\\s*%1\\s*" ) ).arg(std::numeric_limits::max()); +} + +void TestSerializer::testValueDouble() +{ + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + QFETCH( bool, errorExpected ); + valueTest( value, expected, errorExpected ); + + QVariantMap map; + map[QLatin1String("value")] = value; + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ), errorExpected ); +} + +void TestSerializer::testValueDouble_data() +{ + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + QTest::addColumn( "errorExpected" ); + + QTest::newRow( "double 0" ) << QVariant( 0.0 ) << QString( QLatin1String( "\\s*0.0\\s*" ) ) << false; + QTest::newRow( "double -1" ) << QVariant( -1.0 ) << QString( QLatin1String( "\\s*-1.0\\s*" ) ) << false; + QTest::newRow( "double 1.5E-20" ) << QVariant( 1.5e-20 ) << QString( QLatin1String( "\\s*1.5[Ee]-20\\s*" ) ) << false; + QTest::newRow( "double -1.5E-20" ) << QVariant( -1.5e-20 ) << QString( QLatin1String( "\\s*-1.5[Ee]-20\\s*" ) ) << false; + QTest::newRow( "double 2.0E-20" ) << QVariant( 2.0e-20 ) << QString( QLatin1String( "\\s*2(?:.0)?[Ee]-20\\s*" ) ) << false; + QTest::newRow( "double infinity" ) << QVariant( std::numeric_limits< double >::infinity() ) << QString( ) << true; + QTest::newRow( "double -infinity" ) << QVariant( -std::numeric_limits< double >::infinity() ) << QString( ) << true; + QTest::newRow( "double NaN" ) << QVariant( std::numeric_limits< double >::quiet_NaN() ) << QString( ) << true; +} + +void TestSerializer::testSetDoublePrecision() +{ + bool ok; + Serializer serializer; + QByteArray actual; + QString expected, actualUnicode; + + double num = 0.12345678; + + // Set 1 as double precision + serializer.setDoublePrecision(1); + expected = QString(QLatin1String("0.1")); + actual = serializer.serialize( QVariant(num), &ok); + QVERIFY(ok); + actualUnicode = QString::fromUtf8(actual); + + QVERIFY2( QString::compare(expected, actualUnicode ) == 0, + qPrintable( QString( QLatin1String( "Expected \"%1\" but got \"%2\"." ) ) + .arg( expected ).arg( actualUnicode ) ) ); + + // Set 2 as double precision + serializer.setDoublePrecision(2); + expected = QString(QLatin1String("0.12")); + actual = serializer.serialize( QVariant(num), &ok); + QVERIFY(ok); + actualUnicode = QString::fromUtf8(actual); + + QVERIFY2( QString::compare(expected, actualUnicode ) == 0, + qPrintable( QString( QLatin1String( "Expected \"%1\" but got \"%2\"." ) ) + .arg( expected ).arg( actualUnicode ) ) ); + + // Set 4 as double precision + serializer.setDoublePrecision(4); + expected = QString(QLatin1String("0.1235")); + actual = serializer.serialize( QVariant(num), &ok); + QVERIFY(ok); + actualUnicode = QString::fromUtf8(actual); + + QVERIFY2( QString::compare(expected, actualUnicode ) == 0, + qPrintable( QString( QLatin1String( "Expected \"%1\" but got \"%2\"." ) ) + .arg( expected ).arg( actualUnicode ) ) ); + + // Set 14 as double precision + serializer.setDoublePrecision(14); + expected = QString(QLatin1String("0.12345678")); + actual = serializer.serialize( QVariant(num), &ok); + QVERIFY(ok); + actualUnicode = QString::fromUtf8(actual); + + QVERIFY2( QString::compare(expected, actualUnicode ) == 0, + qPrintable( QString( QLatin1String( "Expected \"%1\" but got \"%2\"." ) ) + .arg( expected ).arg( actualUnicode ) ) ); +} + +void TestSerializer::testValueFloat() +{ + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + QFETCH( bool, errorExpected ); + valueTest( value, expected, errorExpected ); + + QVariantMap map; + map[QLatin1String("value")] = value; + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ), errorExpected ); +} + +void TestSerializer::testValueFloat_data() +{ + QVariant v (QMetaType::Float); + float value; + + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + QTest::addColumn( "errorExpected" ); + + value = 0; + v.setValue(value); + QTest::newRow( "float 0" ) << v << QString( QLatin1String( "\\s*0.0\\s*" ) ) << false; + + value = -1; + v.setValue(value); + QTest::newRow( "float -1" ) << v << QString( QLatin1String( "\\s*-1.0\\s*" ) ) << false; + + value = 1.12f; + v.setValue(value); + QTest::newRow( "float 1.12" ) << v << QString( QLatin1String( "\\s*1.12\\s*" ) ) << false; +} + +void TestSerializer::testValueBoolean() +{ + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + valueTest( value, expected ); + + QVariantMap map; + map[QLatin1String("value")] = value; + valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); +} + +void TestSerializer::testValueBoolean_data() +{ + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + + QTest::newRow( "bool false" ) << QVariant( false ) << QString( QLatin1String( "\\s*false\\s*" ) ); + QTest::newRow( "bool true" ) << QVariant( true ) << QString( QLatin1String( "\\s*true\\s*" ) ); +} + +void TestSerializer::testSpecialNumbers() { + bool ok; + QFETCH( QVariant, value ); + QFETCH( QString, expected ); + Serializer specialSerializer; + QVERIFY(!specialSerializer.specialNumbersAllowed()); + specialSerializer.allowSpecialNumbers(true); + QVERIFY(specialSerializer.specialNumbersAllowed()); + QByteArray serialized = specialSerializer.serialize(value, &ok); + QVERIFY(ok); + QCOMPARE(QString::fromLocal8Bit(serialized), expected); +} + +void TestSerializer::testSpecialNumbers_data() { + QTest::addColumn( "value" ); + QTest::addColumn( "expected" ); + + QTest::newRow( "Infinity" ) << QVariant( std::numeric_limits< double >::infinity() ) << QString::fromLocal8Bit("Infinity"); + QTest::newRow( "-Infinity" ) << QVariant( -std::numeric_limits< double >::infinity() ) << QString::fromLocal8Bit("-Infinity"); + QTest::newRow( "Infinity" ) << QVariant( std::numeric_limits< double >::quiet_NaN() ) << QString::fromLocal8Bit("NaN"); +} + +void TestSerializer::testSerializetoQIODevice() { + QBuffer buffer; + QVariantList variant; + variant << QVariant(QLatin1String("Hello")); + variant << QVariant(QLatin1String("world!")); + + Serializer serializer; + bool ok; + + serializer.serialize(variant, &buffer, &ok); + + QCOMPARE(QString(QLatin1String(buffer.data())), + QString(QLatin1String("[ \"Hello\", \"world!\" ]"))); + QVERIFY(ok); +} + +void TestSerializer::testSerializeWithoutOkParam() { + QBuffer buffer; + QVariantList variant; + variant << QVariant(QLatin1String("Hello")); + variant << QVariant(QLatin1String("world!")); + + Serializer serializer; + + const QByteArray serialized = serializer.serialize(variant); + const QByteArray expected = "[ \"Hello\", \"world!\" ]"; + QCOMPARE(expected, serialized); + + + // test a serialization which produces an error + QVariant brokenVariant ( std::numeric_limits< double >::quiet_NaN() ); + QVERIFY(serializer.serialize(brokenVariant).isEmpty()); +} + +void TestSerializer::testValueHashMap() +{ + Serializer serializer; + bool ok; + + QVariantHash hash; + hash[QLatin1String("one")] = 1; + hash[QLatin1String("three")] = 3; + hash[QLatin1String("seven")] = 7; + + QByteArray json = serializer.serialize(hash, &ok); + QVERIFY(ok); + + Parser parser; + QVariant var = parser.parse(json, &ok); + QVERIFY(ok); + + QVariantMap vmap = var.toMap(); + QHashIterator hIt( hash ); + while ( hIt.hasNext() ) { + hIt.next(); + QString key = hIt.key(); + QVariant value = hIt.value(); + + QMap::const_iterator mIt = vmap.constFind(key); + QVERIFY(mIt != vmap.constEnd()); + QCOMPARE(mIt.value(), value); + } + +} + +QTEST_MAIN(TestSerializer) + +#ifdef QMAKE_BUILD + #include "testserializer.moc" +#else + #include "moc_testserializer.cxx" +#endif [-] [+] Deleted qjson-svn-r1058132.tar.bz2/COPYING @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - [-] [+] Deleted qjson-svn-r1058132.tar.bz2/INSTALL @@ -1,18 +0,0 @@ -Installing QJson --------------- - -QJson requires: -- Qt 4.0 or greater -- cmake 2.6 or greater - -For Unix/Linux/Mac: - - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=_preferred_path_ .. - make - make install - /sbin/ldconfig, if necessary - -Please report problems to: - https://lists.sourceforge.net/mailman/listinfo/qjson-devel [-] [+] Deleted qjson-svn-r1058132.tar.bz2/README @@ -1,28 +0,0 @@ -QJson version 0.5.0 -------------------------------------------------- -Date: April 3rd, 2009 -Website: http://qjson.sourceforge.net/ -Mailing List: https://lists.sourceforge.net/mailman/listinfo/qjson-devel - -Project Lead/Maintainer (2008-current): - Flavio Castelli - -Install -------- - For installation or compiling instructions, see the INSTALL file. - -License -------- - This library is licensed under the Lesser GNU General Public License. See - the COPYING file for more information. - -Description ------------ - 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. - -Happy hacking -Flavio [-] [+] Deleted qjson-svn-r1058132.tar.bz2/cmake -(directory) [-] [+] Deleted qjson-svn-r1058132.tar.bz2/cmake/modules -(directory) [-] [+] Deleted qjson-svn-r1058132.tar.bz2/cmake/modules/CMakeLists.txt @@ -1,2 +0,0 @@ -set(cmakeFiles FindQJSON.cmake) -install(FILES${cmakeFiles} DESTINATION ${CMAKE_MODULES_INSTALL_DIR}) [-] [+] Deleted qjson-svn-r1058132.tar.bz2/cmake/modules/FindQJSON.cmake @@ -1,46 +0,0 @@ -# Find QJSON - JSON handling library for Qt -# -# This module defines -# QJSON_FOUND - whether the qsjon library was found -# QJSON_LIBRARIES - the qjson library -# QJSON_INCLUDE_DIR - the include path of the qjson library -# - -if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - # Already in cache - set (QJSON_FOUND TRUE) - -else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) - - if (NOT WIN32) - # use pkg-config to get the values of QJSON_INCLUDE_DIRS - # and QJSON_LIBRARY_DIRS to add as hints to the find commands. - include (FindPkgConfig) - pkg_check_modules (QJSON REQUIRED QJson>=0.5) - endif (NOT WIN32) - - find_library (QJSON_LIBRARIES - NAMES - qjson - PATHS -${QJSON_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} -${KDE4_LIB_DIR} - ) - - find_path (QJSON_INCLUDE_DIR - NAMES - parser.h - PATH_SUFFIXES - qjson - PATHS - ${QJSON_INCLUDE_DIRS} -${INCLUDE_INSTALL_DIR} - \${KDE4_INCLUDE_DIR} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR) - -endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES) [-] [+] Deleted qjson-svn-r1058132.tar.bz2/doc/html -(directory) [-] [+] Deleted qjson-svn-r1058132.tar.bz2/lib -(directory) [-] [+] Deleted qjson-svn-r1058132.tar.bz2/tests/cmdline_tester.cpp @@ -1,62 +0,0 @@ -/* This file is part of QJson - * - * Copyright (C) 2009 Flavio Castelli - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include -#include -#include -#include -#include - -#include "parser.h" - -using namespace QJson; - -int main(int argc, char *argv[]) { - QCoreApplication app (argc, argv); - - if (app.arguments().size() != 2) { - qCritical("You have to specify the file containing the json code"); - exit (1); - } - - QString filename = app.arguments()[1]; - if (!QFile::exists ( filename )) { - qCritical ("The file you specified doesn't exist!"); - exit (1); - } - - Parser driver; - bool ok; - - QFile file (filename); - QVariant data = driver.parse (&file, &ok); - if (!ok) { - qCritical("%s:%i - Error: %s", filename.toLatin1().data(), driver.errorLine(), qPrintable(driver.errorString())); - exit (1); - } - else { - qDebug() << "json object successfully converted to:"; - qDebug() << data; - } - - qDebug() << "JOB DONE, BYE"; - return 0; -} - [-] [+] Deleted qjson-svn-r1058132.tar.bz2/tests/person.cpp @@ -1,50 +0,0 @@ -#include "person.h" - -Person::Person(QObject* parent) - : QObject(parent) -{ -} - -Person::~Person() -{ -} - -QString Person::name() const -{ - return m_name; -} - -void Person::setName(const QString& name) -{ - m_name = name; -} - -int Person::phoneNumber() const -{ - return m_phoneNumber; -} - -void Person::setPhoneNumber(const int phoneNumber) -{ - m_phoneNumber = phoneNumber; -} - -void Person::setGender(Gender gender) -{ - m_gender = gender; -} - -Person::Gender Person::gender() const -{ - return m_gender; -} - -QDate Person::dob() const -{ - return m_dob; -} - -void Person::setDob(const QDate& dob) -{ - m_dob = dob; -} [-] [+] Deleted qjson-svn-r1058132.tar.bz2/tests/person.h @@ -1,61 +0,0 @@ -/* This file is part of qjson - * - * Copyright (C) 2009 Till Adam - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef PERSON_H -#define PERSON_H - -#include -#include - -class Person : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(int phoneNumber READ phoneNumber WRITE setPhoneNumber) - Q_PROPERTY(Gender gender READ gender WRITE setGender) - Q_PROPERTY(QDate dob READ dob WRITE setDob) - Q_ENUMS(Gender) - - public: - Person(QObject* parent = 0); - ~Person(); - - QString name() const; - void setName(const QString& name); - - int phoneNumber() const; - void setPhoneNumber(const int phoneNumber); - - enum Gender {Male, Female}; - void setGender(Gender gender); - Gender gender() const; - - QDate dob() const; - void setDob(const QDate& dob); - - private: - QString m_name; - int m_phoneNumber; - Gender m_gender; - QDate m_dob; -}; - -#endif [-] [+] Deleted qjson-svn-r1058132.tar.bz2/tests/testparser.cpp @@ -1,332 +0,0 @@ -/* This file is part of QJson - * - * Copyright (C) 2008 Flavio Castelli - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include - -#include "parser.h" - -#include - -class TestParser: public QObject -{ - Q_OBJECT - private slots: - void parseNonAsciiString(); - void parseSimpleObject(); - void parseEmptyObject(); - void parseEmptyValue(); - void parseUrl(); - void parseMultipleObject(); - - void parseSimpleArray(); - void parseInvalidObject(); - void parseMultipleArray(); - - void testTrueFalseNullValues(); - void testEscapeChars(); - void testNumbers(); - void testNumbers_data(); -}; - -Q_DECLARE_METATYPE(QVariant) -Q_DECLARE_METATYPE(QVariant::Type) - -using namespace QJson; - -void TestParser::parseSimpleObject() { - QByteArray json = "{\"foo\":\"bar\"}"; - QVariantMap map; - map.insert (QLatin1String("foo"), QLatin1String("bar")); - QVariant expected(map); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); -} - -void TestParser::parseEmptyObject() { - QByteArray json = "{}"; - QVariantMap map; - QVariant expected (map); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); -} - -void TestParser::parseEmptyValue() { - QByteArray json = "{\"value\": \"\"}"; - - QVariantMap map; - map.insert (QLatin1String("value"), QString(QLatin1String(""))); - QVariant expected (map); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); - QVERIFY (result.toMap().value(QLatin1String("value")).type() == QVariant::String); - - QString value = result.toMap().value(QLatin1String("value")).toString(); - QVERIFY (value.isEmpty()); -} - -void TestParser::parseInvalidObject() { - QByteArray json = "{\"foo\":\"bar\""; - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (!ok); -} - -void TestParser::parseNonAsciiString() { - QByteArray json = "{\"artist\":\"Queensr\\u00ffche\"}"; - QVariantMap map; - - QChar unicode_char (0x00ff); - QString unicode_string; - unicode_string.setUnicode(&unicode_char, 1); - unicode_string = QLatin1String("Queensr") + unicode_string + QLatin1String("che"); - - map.insert (QLatin1String("artist"), unicode_string); - QVariant expected (map); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); -} - -void TestParser::parseMultipleObject() { - //put also some extra spaces inside the json string - QByteArray json = "{ \"foo\":\"bar\",\n\"number\" : 51.3 , \"array\":[\"item1\", 123]}"; - QVariantMap map; - map.insert (QLatin1String("foo"), QLatin1String("bar")); - map.insert (QLatin1String("number"), 51.3); - QVariantList list; - list.append (QLatin1String("item1")); - list.append (QLatin1String("123")); - map.insert (QLatin1String("array"), list); - QVariant expected (map); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); - QVERIFY (result.toMap().value(QLatin1String("number")).canConvert()); - QVERIFY (result.toMap().value(QLatin1String("array")).canConvert()); -} - -void TestParser::parseUrl(){ - //"http:\/\/www.last.fm\/venue\/8926427" - QByteArray json = "[\"http:\\/\\/www.last.fm\\/venue\\/8926427\"]"; - QVariantList list; - list.append (QVariant(QLatin1String("http://www.last.fm/venue/8926427"))); - QVariant expected (list); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); -} - - void TestParser::parseSimpleArray() { - QByteArray json = "[\"foo\",\"bar\"]"; - QVariantList list; - list.append (QLatin1String("foo")); - list.append (QLatin1String("bar")); - QVariant expected (list); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); -} - -void TestParser::parseMultipleArray() { - //put also some extra spaces inside the json string - QByteArray json = "[ {\"foo\":\"bar\"},\n\"number\",51.3 , [\"item1\", 123]]"; - QVariantMap map; - map.insert (QLatin1String("foo"), QLatin1String("bar")); - - QVariantList array; - array.append (QLatin1String("item1")); - array.append (123); - - QVariantList list; - list.append (map); - list.append (QLatin1String("number")); - list.append (QLatin1String("51.3")); - list.append ((QVariant) array); - - QVariant expected (list); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); -} - -void TestParser::testTrueFalseNullValues() { - QByteArray json = "[true,false, null, {\"foo\" : true}]"; - QVariantList list; - list.append (QVariant(true)); - list.append (QVariant(false)); - list.append (QVariant()); - QVariantMap map; - map.insert (QLatin1String("foo"), true); - list.append (map); - QVariant expected (list); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result, expected); - QCOMPARE (result.toList().at(0).toBool(), true); - QCOMPARE (result.toList().at(1).toBool(), false); - QVERIFY (result.toList().at(2).isNull()); -} - -void TestParser::testEscapeChars() { - QByteArray json = "[\"\\b \\f \\n \\r \\t \", \" \\\\ \\/ \\\\\", \"http:\\/\\/foo.com\"]"; - - QVariantList list; - list.append (QLatin1String("\b \f \n \r \t ")); - list.append (QLatin1String(" \\ / \\")); - list.append (QLatin1String("http://foo.com")); - - QVariant expected (list); - - Parser parser; - bool ok; - QVariant result = parser.parse (json, &ok); - QVERIFY (ok); - QCOMPARE(result.toList().size(), expected.toList().size() ); - QCOMPARE(result, expected); -} - -void TestParser::testNumbers() { - QFETCH(QByteArray, input); - QFETCH(QVariant, expected); - QFETCH(QVariant::Type, type); - - Parser parser; - bool ok; - QVariant result = parser.parse ("[" + input +"]", &ok); - QVERIFY (ok); - - QVariant value = result.toList().at(0); - QCOMPARE(value, expected); - QCOMPARE( value.type(), type); -} - -void TestParser::testNumbers_data() { - QTest::addColumn( "input" ); - QTest::addColumn( "expected" ); - QTest::addColumn( "type" ); - - QByteArray input; - QVariant output; - - // simple ulonglong - input = QByteArray("1"); - output = QVariant(QVariant::ULongLong); - output.setValue(1); - - QTest::newRow("simple ulonglong") << input << output << QVariant::ULongLong; - - // big number - input = QByteArray("128708157440"); - output = QVariant(QVariant::ULongLong); - output.setValue(128708157440ull); - - QTest::newRow("big number") << input << output << QVariant::ULongLong; - - // simple double - input = QByteArray("2.4"); - output = QVariant(QVariant::Double); - output.setValue(2.4); - - QTest::newRow("simple double") << input << output << QVariant::Double; - - // negative int - input = QByteArray("-100"); - output = QVariant(QVariant::LongLong); - output.setValue(-100); - - QTest::newRow("negative int") << input << output << QVariant::LongLong; - - // negative double - input = QByteArray("-3.4"); - output = QVariant(QVariant::Double); - output.setValue(-3.4); - - QTest::newRow("negative double") << input << output << QVariant::Double; - - // exp1 - input = QByteArray("-5e+"); - output = QVariant(QVariant::ByteArray); - output.setValue(input); - - QTest::newRow("exp1") << input << output << QVariant::ByteArray; - - // exp2 - input = QByteArray("2e"); - output = QVariant(QVariant::ByteArray); - output.setValue(input); - - QTest::newRow("exp2") << input << output << QVariant::ByteArray; - - // exp3 - input = QByteArray("3e+"); - output = QVariant(QVariant::ByteArray); - output.setValue(input); - - QTest::newRow("exp3") << input << output << QVariant::ByteArray; - - // exp4 - input = QByteArray("4.3E"); - output = QVariant(QVariant::ByteArray); - output.setValue(input); - - QTest::newRow("exp4") << input << output << QVariant::ByteArray; - - // exp5 - input = QByteArray("5.4E-"); - output = QVariant(QVariant::ByteArray); - output.setValue(input); - - QTest::newRow("exp5") << input << output << QVariant::ByteArray; -} - -QTEST_MAIN(TestParser) -#include "moc_testparser.cxx" [-] [+] Deleted qjson-svn-r1058132.tar.bz2/tests/testqobjecthelper.cpp @@ -1,91 +0,0 @@ - -/* This file is part of QJson - * - * Copyright (C) 2009 Flavio Castelli - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include - -#include - -#include "person.h" -#include "qobjecthelper.h" - -#include - -class TestQObjectHelper: public QObject -{ - Q_OBJECT - private slots: - void testQObject2QVariant(); - void testQVariant2QObject(); -}; - -Q_DECLARE_METATYPE(QVariant) - -using namespace QJson; - -void TestQObjectHelper::testQObject2QVariant() -{ - QString name = QLatin1String("Flavio Castelli"); - int phoneNumber = 123456; - Person::Gender gender = Person::Male; - QDate dob (1982, 7, 12); - - Person person; - person.setName(name); - person.setPhoneNumber(phoneNumber); - person.setGender(gender); - person.setDob(dob); - - QVariantMap expected; - expected[QLatin1String("name")] = QVariant(name); - expected[QLatin1String("phoneNumber")] = QVariant(phoneNumber); - expected[QLatin1String("gender")] = QVariant(gender); - expected[QLatin1String("dob")] = QVariant(dob); - - QVariantMap result = QObjectHelper::qobject2qvariant(&person); - - QCOMPARE(result, expected); -} - -void TestQObjectHelper::testQVariant2QObject() -{ - QString name = QLatin1String("Flavio Castelli"); - int phoneNumber = 123456; - Person::Gender gender = Person::Male; - QDate dob (1982, 7, 12); - - Person person; - - QVariantMap variant; - variant[QLatin1String("name")] = QVariant(name); - variant[QLatin1String("phoneNumber")] = QVariant(phoneNumber); - variant[QLatin1String("gender")] = QVariant(gender); - variant[QLatin1String("dob")] = QVariant(dob); - - QObjectHelper::qvariant2qobject(variant, &person); - - QCOMPARE(person.name(), name); - QCOMPARE(person.phoneNumber(),phoneNumber); - QCOMPARE(person.gender(), gender); - QCOMPARE(person.dob(), dob); -} - -QTEST_MAIN(TestQObjectHelper) -#include "moc_testqobjecthelper.cxx" [-] [+] Deleted qjson-svn-r1058132.tar.bz2/tests/testserializer.cpp @@ -1,241 +0,0 @@ -/* This file is part of QJson - * - * Copyright (C) 2009 Flavio Castelli - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include - -#include - -#include "parser.h" -#include "serializer.h" - -#include - - -class TestSerializer: public QObject -{ - Q_OBJECT - private slots: - void testReadWriteEmptyDocument(); - void testReadWrite(); - void testReadWrite_data(); - void testValueNull(); - void testValueString(); - void testValueString_data(); - void testValueInteger(); - void testValueInteger_data(); - void testValueDouble(); - void testValueDouble_data(); - void testValueBoolean(); - void testValueBoolean_data(); - - private: - void valueTest( const QVariant& value, const QString& expectedRegExp ); - void valueTest( const QObject* object, const QString& expectedRegExp ); -}; - -Q_DECLARE_METATYPE(QVariant) - -using namespace QJson; - -void TestSerializer::testReadWriteEmptyDocument() -{ - QByteArray json = ""; - Parser parser; - bool ok; - QVariant result = parser.parse( json, &ok ); - QVERIFY(ok); - QVERIFY( ! result.isValid() ); - Serializer serializer; - const QByteArray serialized = serializer.serialize( result ); - QVERIFY( !serialized.isNull() ); - QByteArray expected = "null"; - QCOMPARE(expected, serialized); -} - -void TestSerializer::testReadWrite() -{ - QFETCH( QByteArray, json ); - Parser parser; - bool ok; - QVariant result = parser.parse( json, &ok ); - QVERIFY(ok); - Serializer serializer; - const QByteArray serialized = serializer.serialize( result ); - QVariant writtenThenRead = parser.parse( serialized, &ok ); - QVERIFY(ok); - QCOMPARE( result, writtenThenRead ); -} - -void TestSerializer::testReadWrite_data() -{ - QTest::addColumn( "json" ); - - // array tests - QTest::newRow( "empty array" ) << QByteArray("[]"); - QTest::newRow( "basic array" ) << QByteArray("[\"person\",\"bar\"]"); - QTest::newRow( "single int array" ) << QByteArray("[6]"); - QTest::newRow( "int array" ) << QByteArray("[6,5,6,7]"); - const QByteArray json = "[1,2.4, -100, -3.4, -5e+, 2e,3e+,4.3E,5.4E-]"; - QTest::newRow( QByteArray("array of various numbers") ) << json; - - // document tests - QTest::newRow( "empty object" ) << QByteArray("{}"); - QTest::newRow( "basic document" ) << QByteArray("{\"person\":\"bar\"}"); - QTest::newRow( "object with ints" ) << QByteArray("{\"person\":6}"); - const QByteArray json2 = "{ \"person\":\"bar\",\n\"number\" : 51.3 , \"array\":[\"item1\", 123]}"; - QTest::newRow( "complicated document" ) << json2; - - // more complex cases - const QByteArray json3 = "[ {\"person\":\"bar\"},\n\"number\",51.3 , [\"item1\", 123]]"; - QTest::newRow( "complicated array" ) << json3; -} - - -void TestSerializer::valueTest( const QVariant& value, const QString& expectedRegExp ) -{ - Serializer serializer; - const QByteArray serialized = serializer.serialize( value ); - const QString serializedUnicode = QString::fromUtf8( serialized ); - QRegExp expected( expectedRegExp ); - QVERIFY( expected.isValid() ); - QVERIFY2( expected.exactMatch( serializedUnicode ), - qPrintable( QString( QLatin1String( "Expected regexp \"%1\" but got \"%2\"." ) ) - .arg( expectedRegExp ).arg( serializedUnicode ) ) ); -} - -void TestSerializer::valueTest( const QObject* object, const QString& expectedRegExp ) -{ - Serializer serializer; - const QByteArray serialized = serializer.serialize( object ); - const QString serializedUnicode = QString::fromUtf8( serialized ); - QRegExp expected( expectedRegExp ); - QVERIFY( expected.isValid() ); - QVERIFY2( expected.exactMatch( serializedUnicode ), - qPrintable( QString( QLatin1String( "Expected regexp \"%1\" but got \"%2\"." ) ) - .arg( expectedRegExp ).arg( serializedUnicode ) ) ); -} - -void TestSerializer::testValueNull() -{ - valueTest( QVariant(), QLatin1String( "\\s*null\\s*" ) ); - QVariantMap map; - map[QLatin1String("value")] = QVariant(); - valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:\\s*null\\s*\\}\\s*" ) ); -} - -void TestSerializer::testValueString() -{ - QFETCH( QVariant, value ); - QFETCH( QString, expected ); - valueTest( value, expected ); - - QVariantMap map; - map[QLatin1String("value")] = value; - valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); -} - -void TestSerializer::testValueString_data() -{ - QTest::addColumn( "value" ); - QTest::addColumn( "expected" ); - - QTest::newRow( "null string" ) << QVariant( QString() ) << QString( QLatin1String( "\\s*\"\"\\s*" ) ); - QTest::newRow( "empty string" ) << QVariant( QString( QLatin1String( "" ) ) ) << QString( QLatin1String( "\\s*\"\"\\s*" ) ); - QTest::newRow( "Simple String" ) << QVariant( QString( QLatin1String( "simpleString" ) ) ) << QString( QLatin1String( "\\s*\"simpleString\"\\s*" ) ); - QTest::newRow( "string with tab" ) << QVariant( QString( QLatin1String( "string\tstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\tstring\"\\s*" ) ); - QTest::newRow( "string with newline" ) << QVariant( QString( QLatin1String( "string\nstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\nstring\"\\s*" ) ); - QTest::newRow( "string with bell" ) << QVariant( QString( QLatin1String( "string\bstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\bstring\"\\s*" ) ); - QTest::newRow( "string with return" ) << QVariant( QString( QLatin1String( "string\rstring" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\rstring\"\\s*" ) ); - QTest::newRow( "string with double quote" ) << QVariant( QString( QLatin1String( "string\"string" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\\"string\"\\s*" ) ); - QTest::newRow( "string with backslash" ) << QVariant( QString( QLatin1String( "string\\string" ) ) ) << QString( QLatin1String( "\\s*\"string\\\\\\\\string\"\\s*" ) ); - QString testStringWithUnicode = QString( QLatin1String( "string" ) ) + QChar( 0x2665 ) + QLatin1String( "string" ); - QTest::newRow( "string with unicode" ) << QVariant( testStringWithUnicode ) << QLatin1String( "\\s*\"" ) + testStringWithUnicode + QLatin1String( "\"\\s*" ); -} - -void TestSerializer::testValueInteger() -{ - QFETCH( QVariant, value ); - QFETCH( QString, expected ); - valueTest( value, expected ); - - QVariantMap map; - map[QLatin1String("value")] = value; - valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); -} - -void TestSerializer::testValueInteger_data() -{ - QTest::addColumn( "value" ); - QTest::addColumn( "expected" ); - - QTest::newRow( "int 0" ) << QVariant( static_cast( 0 ) ) << QString( QLatin1String( "\\s*0\\s*" ) ); - QTest::newRow( "uint 0" ) << QVariant( static_cast( 0 ) ) << QString( QLatin1String( "\\s*0\\s*" ) ); - QTest::newRow( "int -1" ) << QVariant( static_cast( -1 ) ) << QString( QLatin1String( "\\s*-1\\s*" ) ); - QTest::newRow( "int 2133149800" ) << QVariant( static_cast(2133149800) ) << QString( QLatin1String( "\\s*2133149800\\s*" ) ); - QTest::newRow( "uint 4133149800" ) << QVariant( static_cast(4133149800u) ) << QString( QLatin1String( "\\s*4133149800\\s*" ) ); - QTest::newRow( "uint64 932838457459459" ) << QVariant( Q_UINT64_C(932838457459459) ) << QString( QLatin1String( "\\s*932838457459459\\s*" ) ); - QTest::newRow( "max unsigned long long" ) << QVariant( std::numeric_limits::max() ) << QString( QLatin1String( "\\s*%1\\s*" ) ).arg(std::numeric_limits::max()); -} - -void TestSerializer::testValueDouble() -{ - QFETCH( QVariant, value ); - QFETCH( QString, expected ); - valueTest( value, expected ); - - QVariantMap map; - map[QLatin1String("value")] = value; - valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); -} - -void TestSerializer::testValueDouble_data() -{ - QTest::addColumn( "value" ); - QTest::addColumn( "expected" ); - - QTest::newRow( "double 0" ) << QVariant( 0.0 ) << QString( QLatin1String( "\\s*0.0\\s*" ) ); - QTest::newRow( "double -1" ) << QVariant( -1.0 ) << QString( QLatin1String( "\\s*-1.0\\s*" ) ); - QTest::newRow( "double 1.5E-20" ) << QVariant( 1.5e-20 ) << QString( QLatin1String( "\\s*1.5[Ee]-20\\s*" ) ); - QTest::newRow( "double -1.5E-20" ) << QVariant( -1.5e-20 ) << QString( QLatin1String( "\\s*-1.5[Ee]-20\\s*" ) ); - QTest::newRow( "double 2.0E-20" ) << QVariant( 2.0e-20 ) << QString( QLatin1String( "\\s*2(?:.0)?[Ee]-20\\s*" ) ); -} - -void TestSerializer::testValueBoolean() -{ - QFETCH( QVariant, value ); - QFETCH( QString, expected ); - valueTest( value, expected ); - - QVariantMap map; - map[QLatin1String("value")] = value; - valueTest( QVariant(map), QLatin1String( "\\s*\\{\\s*\"value\"\\s*:" ) + expected + QLatin1String( "\\}\\s*" ) ); -} - -void TestSerializer::testValueBoolean_data() -{ - QTest::addColumn( "value" ); - QTest::addColumn( "expected" ); - - QTest::newRow( "bool false" ) << QVariant( false ) << QString( QLatin1String( "\\s*false\\s*" ) ); - QTest::newRow( "bool true" ) << QVariant( true ) << QString( QLatin1String( "\\s*true\\s*" ) ); -} - -QTEST_MAIN(TestSerializer) -#include "moc_testserializer.cxx"