Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::anonymous_namespace{introspectiontools.cpp} Namespace Reference

Classes

class  TreePrinter
 Prints an object tree as indented describe() lines, with the object_tree tool's limits and filters. More...

Functions

bool isHidden (const QObject *o)
 Whether o has a false "visible" property.
QObject * argumentObject (const QJsonObject &args, QString *error)
 Resolves the "object" argument, or explains why it can't.
ToolResult objectTree (const QJsonObject &args)
 The object_tree tool.
void installObjectTree (Server &server)
 Registers object_tree.
bool hasBinding (const QMetaProperty &p, QObject *o)
 Whether property p of o is BINDABLE and has a binding now.
QStringList propertyLines (QObject *o)
 " name: Type = value" lines for the static and dynamic properties of o.
QStringList methodLines (const QMetaObject *mo)
 The "signals:", "slots:" and "invokables:" sections for mo (QObject's own methods omitted).
ToolResult objectInspect (const QJsonObject &args)
 The object_inspect tool.
void installObjectInspect (Server &server)
 Registers object_inspect.
ToolResult objectSetProperty (const QJsonObject &args)
 The object_set tool.
void installObjectSetProperty (Server &server)
 Registers object_set.
std::optional< ToolResult > tryInvoke (QObject *o, const QMetaMethod &m, const QJsonArray &callArgs, QString *conversionError)
 Converts callArgs to m's parameter types and invokes it on o.
ToolResult objectInvoke (const QJsonObject &args)
 The object_invoke tool: tries each overload with a matching argument count.
void installObjectInvoke (Server &server)
 Registers object_invoke.

Variables

constexpr qsizetype kMaxInvokeArguments = 10
 Most arguments object_invoke passes (QMetaMethod::invoke's limit).

Function Documentation

◆ propertyLines()

QStringList Sonde::anonymous_namespace{introspectiontools.cpp}::propertyLines ( QObject * o)

" name: Type = value" lines for the static and dynamic properties of o.

A BINDABLE property with a binding is marked "(bound)". Properties declared in QML aren't BINDABLE (the QML engine keeps their bindings itself); the qml_binding tool covers those.

◆ tryInvoke()

std::optional< ToolResult > Sonde::anonymous_namespace{introspectiontools.cpp}::tryInvoke ( QObject * o,
const QMetaMethod & m,
const QJsonArray & callArgs,
QString * conversionError )

Converts callArgs to m's parameter types and invokes it on o.

Returns
The tool result, or std::nullopt if the arguments don't fit this overload (with conversionError set), so the caller tries the next.