1 /* 2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz> 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _JSON_WRITER_H 6 #define _JSON_WRITER_H 7 8 9 #include "JsonEventListener.h" 10 11 #include <DataIO.h> 12 #include <String.h> 13 14 15 namespace BPrivate { 16 17 class BJsonWriter : public BJsonEventListener { 18 public: 19 BJsonWriter(); 20 virtual ~BJsonWriter(); 21 22 void HandleError(status_t status, int32 line, 23 const char* message); 24 status_t ErrorStatus(); 25 26 status_t WriteBoolean(bool value); 27 status_t WriteTrue(); 28 status_t WriteFalse(); 29 status_t WriteNull(); 30 31 status_t WriteInteger(int64 value); 32 status_t WriteDouble(double value); 33 34 status_t WriteString(const char* value); 35 36 status_t WriteObjectStart(); 37 status_t WriteObjectName(const char* value); 38 status_t WriteObjectEnd(); 39 40 status_t WriteArrayStart(); 41 status_t WriteArrayEnd(); 42 43 protected: 44 status_t fErrorStatus; 45 46 }; 47 48 } // namespace BPrivate 49 50 using BPrivate::BJsonWriter; 51 52 #endif // _JSON_WRITER_H 53