| 1157 | } // namespace |
| 1158 | |
| 1159 | Result JsonWriter::start( |
| 1160 | const Settings &settings, |
| 1161 | const Environment &environment, |
| 1162 | Stats *stats) { |
| 1163 | Expects(_output == nullptr); |
| 1164 | Expects(settings.path.endsWith('/')); |
| 1165 | |
| 1166 | _settings = base::duplicate(settings); |
| 1167 | _environment = environment; |
| 1168 | _stats = stats; |
| 1169 | _output = fileWithRelativePath(mainFileRelativePath()); |
| 1170 | if (_settings.onlySinglePeer()) { |
| 1171 | return Result::Success(); |
| 1172 | } |
| 1173 | auto block = pushNesting(Context::kObject); |
| 1174 | block.append(prepareObjectItemStart("about")); |
| 1175 | block.append(SerializeString(_environment.aboutTelegram)); |
| 1176 | return _output->writeBlock(block); |
| 1177 | } |
| 1178 | |
| 1179 | QByteArray JsonWriter::pushNesting(Context::Type type) { |
| 1180 | Expects(_output != nullptr); |
no test coverage detected