Refactoring: Changed all check parameters starting with a 'p' to the new rulespec...
[check_mk.git] / livestatus / src / RendererPython3.cc
blob80f48f2d8e1731222add37b7a1fd40bf4279669b
1 // +------------------------------------------------------------------+
2 // | ____ _ _ __ __ _ __ |
3 // | / ___| |__ ___ ___| | __ | \/ | |/ / |
4 // | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
5 // | | |___| | | | __/ (__| < | | | | . \ |
6 // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
7 // | |
8 // | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
9 // +------------------------------------------------------------------+
11 // This file is part of Check_MK.
12 // The official homepage is at http://mathias-kettner.de/check_mk.
14 // check_mk is free software; you can redistribute it and/or modify it
15 // under the terms of the GNU General Public License as published by
16 // the Free Software Foundation in version 2. check_mk is distributed
17 // in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
18 // out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19 // PARTICULAR PURPOSE. See the GNU General Public License for more de-
20 // tails. You should have received a copy of the GNU General Public
21 // License along with GNU Make; see the file COPYING. If not, write
22 // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 // Boston, MA 02110-1301 USA.
25 #include "RendererPython3.h"
26 #include <ostream>
27 class Logger;
29 RendererPython3::RendererPython3(std::ostream &os, Logger *logger,
30 Encoding data_encoding)
31 : Renderer(os, logger, data_encoding) {}
33 // --------------------------------------------------------------------------
35 void RendererPython3::beginQuery() { _os << "["; }
36 void RendererPython3::separateQueryElements() { _os << ",\n"; }
37 void RendererPython3::endQuery() { _os << "]\n"; }
39 // --------------------------------------------------------------------------
41 void RendererPython3::beginRow() { _os << "["; }
42 void RendererPython3::beginRowElement() {}
43 void RendererPython3::endRowElement() {}
44 void RendererPython3::separateRowElements() { _os << ","; }
45 void RendererPython3::endRow() { _os << "]"; }
47 // --------------------------------------------------------------------------
49 void RendererPython3::beginList() { _os << "["; }
50 void RendererPython3::separateListElements() { _os << ","; }
51 void RendererPython3::endList() { _os << "]"; }
53 // --------------------------------------------------------------------------
55 void RendererPython3::beginSublist() { beginList(); }
56 void RendererPython3::separateSublistElements() { separateListElements(); }
57 void RendererPython3::endSublist() { endList(); }
59 // --------------------------------------------------------------------------
61 void RendererPython3::beginDict() { _os << "{"; }
62 void RendererPython3::separateDictElements() { _os << ","; }
63 void RendererPython3::separateDictKeyValue() { _os << ":"; }
64 void RendererPython3::endDict() { _os << "}"; }
66 // --------------------------------------------------------------------------
68 void RendererPython3::outputNull() { _os << "None"; }
70 void RendererPython3::outputBlob(const std::vector<char> &value) {
71 outputByteString("b", value);
74 void RendererPython3::outputString(const std::string &value) {
75 outputUnicodeString("", &value[0], &value[value.size()], _data_encoding);