* Ends a JSON container (object or array) by writing the closing character and adjusting the * indentation level if pretty-printing is enabled. * * @param closeChar The character that closes the container (either '}' for objects or ']' for arrays). * @param isContainerEmpty Whether the container is empty, used to determine if a newline should be written. */
| 261 | * @param isContainerEmpty Whether the container is empty, used to determine if a newline should be written. |
| 262 | */ |
| 263 | void JsonEncoder::EndContainer(char closeChar, bool isContainerEmpty) |
| 264 | { |
| 265 | if (m_Pretty) { |
| 266 | ASSERT(m_Indent >= m_IndentSize); // Ensure we don't underflow the indent size. |
| 267 | m_Indent -= m_IndentSize; |
| 268 | if (!isContainerEmpty) { |
| 269 | Write("\n"); |
| 270 | m_Writer->write_characters(m_IndentStr.c_str(), m_Indent); |
| 271 | } |
| 272 | } |
| 273 | m_Writer->write_character(closeChar); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Writes a separator (comma) and an indentation string if pretty-printing is enabled. |
nothing calls this directly
no test coverage detected