Changeset 73865 in vbox
- Timestamp:
- Aug 23, 2018 9:53:15 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/restbase.h
r73864 r73865 43 43 44 44 45 /**46 * Very limited map class that avoids dragging in std::map.47 */48 template<class Type> class RTCRestStringMap49 {50 public:51 RTCRestStringMap() {};52 ~RTCRestStringMap() {};53 /** @todo more later. */54 };55 56 45 57 46 /** … … 68 57 * 69 58 * @returns Number of bytes outputted. 70 * @param uIndent The indentation level.71 59 * @param pszFormat The format string. 72 60 * @param ... Argument specfied in @a pszFormat. 73 61 */ 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) 75 63 { 76 64 va_list va; 77 65 va_start(va, pszFormat); 78 size_t cchWritten = this->vprintf( uIndent,pszFormat, va);66 size_t cchWritten = this->vprintf(pszFormat, va); 79 67 va_end(va); 80 68 return cchWritten; … … 85 73 * 86 74 * @returns Number of bytes outputted. 87 * @param uIndent The indentation level.88 75 * @param pszFormat The format string. 89 76 * @param va Argument specfied in @a pszFormat. 90 77 */ 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 105 protected: 106 /** The current indentation level. */ 107 unsigned m_uIndent; 92 108 }; 93 109 … … 107 123 virtual ~RTCRestOutputToString(); 108 124 109 size_t vprintf( unsigned uIndent,const char *pszFormat, va_list va);125 size_t vprintf(const char *pszFormat, va_list va); 110 126 111 127 /** … … 149 165 * @returns a_rDst 150 166 * @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; 155 169 156 170 /** … … 165 179 */ 166 180 virtual int deserializeFromJson(RTJSONIT hJsonIt, PRTERRINFO pErrInfo) = 0; 181 }; 182 183 184 /** 185 * Limited array class. 186 */ 187 template<class Type> class RTCRestArray : public RTCRestObjectBase 188 { 189 public: 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 */ 202 template<class Type> class RTCRestStringMap : public RTCRestObjectBase 203 { 204 public: 205 RTCRestStringMap() {}; 206 ~RTCRestStringMap() {}; 207 /** @todo more later. */ 208 209 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst); 210 virtual int deserializeFromJson(RTJSONIT hJsonIt, PRTERRINFO pErrInfo); 167 211 }; 168 212
Note:
See TracChangeset
for help on using the changeset viewer.