comparison Core/RestApi/RestApiOutput.h @ 1046:00f9f36bcd94

on-the-fly conversion of JSON to XML according to HTTP Accept
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Jul 2014 17:15:34 +0200
parents 8d1845feb277
children ba5c0908600c
comparison
equal deleted inserted replaced
1045:0bfeeb6d340f 1046:00f9f36bcd94
42 class RestApiOutput 42 class RestApiOutput
43 { 43 {
44 private: 44 private:
45 HttpOutput& output_; 45 HttpOutput& output_;
46 bool alreadySent_; 46 bool alreadySent_;
47 bool convertJsonToXml_;
47 48
48 void CheckStatus(); 49 void CheckStatus();
49 50
50 public: 51 public:
51 RestApiOutput(HttpOutput& output); 52 RestApiOutput(HttpOutput& output);
58 } 59 }
59 60
60 void MarkLowLevelOutputDone() 61 void MarkLowLevelOutputDone()
61 { 62 {
62 alreadySent_ = true; 63 alreadySent_ = true;
64 }
65
66 void SetConvertJsonToXml(bool convert)
67 {
68 convertJsonToXml_ = convert;
69 }
70
71 bool IsConvertJsonToXml() const
72 {
73 return convertJsonToXml_;
63 } 74 }
64 75
65 void AnswerFile(HttpFileSender& sender); 76 void AnswerFile(HttpFileSender& sender);
66 77
67 void AnswerJson(const Json::Value& value); 78 void AnswerJson(const Json::Value& value);