| 1 | #ifndef SIMDJSON_MINIFY_H |
| 2 | #define SIMDJSON_MINIFY_H |
| 3 | |
| 4 | #include "simdjson/common_defs.h" |
| 5 | #include "simdjson/padded_string.h" |
| 6 | #include <string> |
| 7 | #include <ostream> |
| 8 | #include <sstream> |
| 9 | |
| 10 | namespace simdjson { |
| 11 | |
| 12 | |
| 13 | |
| 14 | /** |
| 15 | * |
| 16 | * Minify the input string assuming that it represents a JSON string, does not parse or validate. |
| 17 | * This function is much faster than parsing a JSON string and then writing a minified version of it. |
| 18 | * However, it does not validate the input. It will merely return an error in simple cases (e.g., if |
| 19 | * there is a string that was never terminated). |
| 20 | * |
| 21 | * |
| 22 | * @param buf the json document to minify. |
| 23 | * @param len the length of the json document. |
| 24 | * @param dst the buffer to write the minified document to. *MUST* be allocated up to len bytes. |
| 25 | * @param dst_len the number of bytes written. Output only. |
| 26 | * @return the error code, or SUCCESS if there was no error. |
| 27 | */ |
| 28 | simdjson_warn_unused error_code minify(const char *buf, size_t len, char *dst, size_t &dst_len) noexcept; |
| 29 | |
| 30 | } // namespace simdjson |
| 31 | |
| 32 | #endif // SIMDJSON_MINIFY_H |