VirtualBox

Changeset 74027 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Sep 2, 2018 2:49:45 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/json: Implemented support for parsing floating point values. bugref:9167

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/json.h

    r73978 r74027  
    5151    /** Value containing a string. */
    5252    RTJSONVALTYPE_STRING,
    53     /** Value containg a number. */
     53    /** Value containg an integer number. */
     54    RTJSONVALTYPE_INTEGER,
     55    /** Value containg an floating point number. */
    5456    RTJSONVALTYPE_NUMBER,
    5557    /** Value containg the special null value. */
     
    172174
    173175/**
    174  * Returns the number from a given JSON number value.
     176 * Returns the integer from a given JSON integer value.
    175177 *
    176178 * @returns IPRT status code.
     
    178180 * @param   hJsonVal        The JSON value handle.
    179181 * @param   pi64Num         WHere to store the number on success.
    180  *
    181  * @note    This JSON implementation does not implement support for floating point
    182  *          numbers currently.  When it does, it will be in the form of a
    183  *          RTJsonValueQueryFloat method.
     182 * @sa      RTJsonValueQueryNumber
    184183 */
    185184RTDECL(int) RTJsonValueQueryInteger(RTJSONVAL hJsonVal, int64_t *pi64Num);
    186185
    187186/**
     187 * Returns the floating point value from a given JSON number value.
     188 *
     189 * @returns IPRT status code.
     190 * @retval  VERR_JSON_VALUE_INVALID_TYPE if the JSON value is not a number.
     191 * @param   hJsonVal        The JSON value handle.
     192 * @param   prdNum          WHere to store the floating point number on success.
     193 * @sa      RTJsonValueQueryInteger
     194 */
     195RTDECL(int) RTJsonValueQueryNumber(RTJSONVAL hJsonVal, double *prdNum);
     196
     197/**
    188198 * Returns the value associated with a given name for the given JSON object value.
    189199 *
     
    196206 */
    197207RTDECL(int) RTJsonValueQueryByName(RTJSONVAL hJsonVal, const char *pszName, PRTJSONVAL phJsonVal);
     208
     209/**
     210 * Returns the number of a number value associated with a given name for the given JSON object value.
     211 *
     212 * @returns IPRT status code.
     213 * @retval  VERR_JSON_VALUE_INVALID_TYPE if the JSON value is not an object or
     214 *          the name does not point to an integer value.
     215 * @retval  VERR_NOT_FOUND if the name is not known for this JSON object.
     216 * @param   hJsonVal        The JSON value handle.
     217 * @param   pszName         The member name of the object.
     218 * @param   pi64Num         Where to store the number on success.
     219 */
     220RTDECL(int) RTJsonValueQueryIntegerByName(RTJSONVAL hJsonVal, const char *pszName, int64_t *pi64Num);
    198221
    199222/**
     
    206229 * @param   hJsonVal        The JSON value handle.
    207230 * @param   pszName         The member name of the object.
    208  * @param   pi64Num         Where to store the number on success.
    209  */
    210 RTDECL(int) RTJsonValueQueryIntegerByName(RTJSONVAL hJsonVal, const char *pszName, int64_t *pi64Num);
     231 * @param   prdNum          WHere to store the floating point number on success.
     232 */
     233RTDECL(int) RTJsonValueQueryNumberByName(RTJSONVAL hJsonVal, const char *pszName, double *prdNum);
    211234
    212235/**
  • trunk/include/iprt/mangling.h

    r73956 r74027  
    11191119# define RTJsonValueQueryInteger                        RT_MANGLER(RTJsonValueQueryInteger)
    11201120# define RTJsonValueQueryIntegerByName                  RT_MANGLER(RTJsonValueQueryIntegerByName)
     1121# define RTJsonValueQueryNumber                         RT_MANGLER(RTJsonValueQueryNumber)
     1122# define RTJsonValueQueryNumberByName                   RT_MANGLER(RTJsonValueQueryNumberByName)
    11211123# define RTJsonValueQueryString                         RT_MANGLER(RTJsonValueQueryString)
    11221124# define RTJsonValueQueryStringByName                   RT_MANGLER(RTJsonValueQueryStringByName)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette