|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
Stopping, printing, and JSON values written as the Python sonde wrote them. More...
#include "common.h"#include <QtCore/QDir>#include <QtCore/QJsonArray>#include <QtCore/QJsonDocument>#include <QtCore/QJsonObject>#include <QtCore/QLocale>#include <cmath>#include <cstdio>Namespaces | |
| namespace | Sonde |
| Embeddable Model Context Protocol server for Qt applications. | |
Functions | |
| void | Sonde::Cli::anonymous_namespace{common.cpp}::writeTo (FILE *stream, const QString &text) |
Writes text to stream in UTF-8. | |
| QString | Sonde::Cli::anonymous_namespace{common.cpp}::pyNumber (double d) |
| A JSON number as Python shows it: an integer without a fraction, otherwise its shortest representation. | |
| QString | Sonde::Cli::anonymous_namespace{common.cpp}::pyQuote (const QString &text) |
text as Python's repr() quotes it. | |
| QString | Sonde::Cli::anonymous_namespace{common.cpp}::jsonQuote (const QString &text) |
text as a JSON string with only ASCII in it, as json.dumps() writes it. | |
| void | Sonde::Cli::fail (const QString &message, int status=3) |
Stops with "sonde: @p message" on stderr and exit status status (3, a configuration error, unless said otherwise). | |
| void | Sonde::Cli::exitWith (int status) |
Stops with exit status status, printing nothing more. | |
| void | Sonde::Cli::write (const QString &text) |
Writes text to stdout, in UTF-8. | |
| void | Sonde::Cli::print (const QString &text) |
Writes text and a newline to stdout, as Python's print() does. | |
| void | Sonde::Cli::printError (const QString &text) |
Writes text and a newline to stderr. | |
| QString | Sonde::Cli::nativePath (const QString &path) |
path with the platform's separators, as Python's os.path functions give it. | |
| QString | Sonde::Cli::pyStr (const QJsonValue &value) |
value as Python's str() gives it for what json.load() returned. | |
| QString | Sonde::Cli::pyRepr (const QJsonValue &value) |
value as Python's repr() gives it for what json.load() returned. | |
| QString | Sonde::Cli::pyJson (const QJsonValue &value) |
value as Python's json.dumps() gives it (ASCII only, ", " and ": "). | |
| std::optional< QJsonValue > | Sonde::Cli::parseJson (const QByteArray &data, QString *error) |
Any JSON value in data (an object, array, string, number, true, false or null), or nothing with error set. | |
Stopping, printing, and JSON values written as the Python sonde wrote them.
| QString Sonde::Cli::pyRepr | ( | const QJsonValue & | value | ) |
value as Python's repr() gives it for what json.load() returned.
Objects come with their keys sorted, as a Sonde server writes them.