VirtualBox

Changeset 73865 in vbox


Ignore:
Timestamp:
Aug 23, 2018 9:53:15 PM (6 years ago)
Author:
vboxsync
Message:

iprt/swagger-codegen: Started on the model source template. bugref:9167

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/restbase.h

    r73864 r73865  
    4343
    4444
    45 /**
    46  * Very limited map class that avoids dragging in std::map.
    47  */
    48 template<class Type> class RTCRestStringMap
    49 {
    50 public:
    51     RTCRestStringMap() {};
    52     ~RTCRestStringMap() {};
    53 /** @todo more later. */
    54 };
    55 
    5645
    5746/**
     
    6857     *
    6958     * @returns Number of bytes outputted.
    70      * @param   uIndent     The indentation level.
    7159     * @param   pszFormat   The format string.
    7260     * @param   ...         Argument specfied in @a pszFormat.
    7361     */
    74     size_t         printf(unsigned uIndent, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3)
     62    size_t         printf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3)
    7563    {
    7664        va_list va;
    7765        va_start(va, pszFormat);
    78         size_t cchWritten = this->vprintf(uIndent, pszFormat, va);
     66        size_t cchWritten = this->vprintf(pszFormat, va);
    7967        va_end(va);
    8068        return cchWritten;
     
    8573     *
    8674     * @returns Number of bytes outputted.
    87      * @param   uIndent     The indentation level.
    8875     * @param   pszFormat   The format string.
    8976     * @param   va          Argument specfied in @a pszFormat.
    9077     */
    91     virtual size_t vprintf(unsigned uIndent, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0) = 0;
     78    virtual size_t vprintf(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0) = 0;
     79
     80    /**
     81     * Sets the indentation level for use when pretty priting things.
     82     *
     83     * @returns Previous indentation level.
     84     * @param   uIndent     The indentation level.
     85     */
     86    unsigned setIndent(unsigned uIndent)
     87    {
     88        unsigned const uRet = m_uIndent;
     89        m_uIndent = uIndent;
     90        return uRet;
     91    }
     92
     93    /**
     94     * Increases the indentation level.
     95     *
     96     * @returns Previous indentation level.
     97     */
     98    unsigned incrementIndent()
     99    {
     100        unsigned const uRet = m_uIndent;
     101        m_uIndent = uRet + 1;
     102        return uRet;
     103    }
     104
     105protected:
     106    /** The current indentation level. */
     107    unsigned m_uIndent;
    92108};
    93109
     
    107123    virtual ~RTCRestOutputToString();
    108124
    109     size_t vprintf(unsigned uIndent, const char *pszFormat, va_list va);
     125    size_t vprintf(const char *pszFormat, va_list va);
    110126
    111127    /**
     
    149165     * @returns a_rDst
    150166     * @param   a_rDst      The destination for the serialization.
    151      * @param   uIndent     The indentation level.  Increment by 1 for child
    152      *                      objects.
    153      */
    154     virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst, unsigned uIndent) = 0;
     167     */
     168    virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) = 0;
    155169
    156170    /**
     
    165179     */
    166180    virtual int deserializeFromJson(RTJSONIT hJsonIt, PRTERRINFO pErrInfo) = 0;
     181};
     182
     183
     184/**
     185 * Limited array class.
     186 */
     187template<class Type> class RTCRestArray : public RTCRestObjectBase
     188{
     189public:
     190    RTCRestArray() {};
     191    ~RTCRestArray() {};
     192/** @todo more later. */
     193
     194    virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst);
     195    virtual int deserializeFromJson(RTJSONIT hJsonIt, PRTERRINFO pErrInfo);
     196};
     197
     198
     199/**
     200 * Limited map class.
     201 */
     202template<class Type> class RTCRestStringMap : public RTCRestObjectBase
     203{
     204public:
     205    RTCRestStringMap() {};
     206    ~RTCRestStringMap() {};
     207/** @todo more later. */
     208
     209    virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst);
     210    virtual int deserializeFromJson(RTJSONIT hJsonIt, PRTERRINFO pErrInfo);
    167211};
    168212
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