Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
describe.cpp File Reference

How sonde tools and sonde describe show a tool. More...

#include "describe.h"
#include "common.h"
#include <QtCore/QJsonArray>
#include <QtCore/QRegularExpression>
#include <algorithm>
#include <utility>

Namespaces

namespace  Sonde
 Embeddable Model Context Protocol server for Qt applications.

Functions

const QRegularExpression & Sonde::Cli::anonymous_namespace{describe.cpp}::wordSeparator ()
 The chunks textwrap breaks lines between: Python's TextWrapper.wordsep_re (words, their hyphenated parts, and runs of white space), in PCRE's syntax.
QStringList Sonde::Cli::anonymous_namespace{describe.cpp}::chunksOf (const QString &text)
 text split into chunks, as TextWrapper._split() does.
bool Sonde::Cli::anonymous_namespace{describe.cpp}::isSpace (const QString &chunk)
 Whether chunk is only white space.
void Sonde::Cli::anonymous_namespace{describe.cpp}::handleLongWord (QStringList &reversed, QStringList &line, qsizetype used, qsizetype width)
 Puts as much of the chunk at the end of reversed on line as fits in width after used characters, as TextWrapper._handle_long_word() does.
QString Sonde::Cli::anonymous_namespace{describe.cpp}::enumText (const QJsonValue &values)
 values as sonde describe lists an enum: each as JSON, between " | ".
QString Sonde::Cli::anonymous_namespace{describe.cpp}::kindOf (const QJsonObject &prop)
 What kind of value argument prop takes, as sonde describe says it.
QString Sonde::Cli::firstSentence (const QString &text)
 The first sentence of a tool's description text, with its white space made single spaces.
QStringList Sonde::Cli::wrap (const QString &text, int width, const QString &initialIndent, const QString &subsequentIndent)
 text in lines of at most width characters, as Python's textwrap.wrap() makes them: the first line starts with initialIndent, the others with subsequentIndent, and words that don't fit are broken (after a hyphen if they have one).
QString Sonde::Cli::describeTool (const QJsonObject &tool)
 A tool's name, title, description and arguments, as sonde describe shows them.

Detailed Description

How sonde tools and sonde describe show a tool.