Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cppcodemarker.cpp File Reference

(5087d098d34e0fc4ab67681d4fad566fe8b6bedf)

#include "cppcodemarker.h"
#include "access.h"
#include "enumnode.h"
#include "functionnode.h"
#include "genustypes.h"
#include "namespacenode.h"
#include "propertynode.h"
#include "qmlpropertynode.h"
#include "template_declaration.h"
#include "text.h"
#include "tree.h"
#include "typedefnode.h"
#include "variablenode.h"
#include <QtCore/qdebug.h>
#include <QtCore/qregularexpression.h>
Include dependency graph for cppcodemarker.cpp:

Go to the source code of this file.

Functions

static QString markupConceptReferences (QString text, const QStringList &concepts)
static QStringList toQStringList (const std::vector< std::string > &refs)

Function Documentation

◆ markupConceptReferences()

QString markupConceptReferences ( QString text,
const QStringList & concepts )
static

Wraps occurrences of each name in concepts inside text with {<@concept target="FULLY::QUALIFIED">unqualified</@concept>} markers so the HTML generator can resolve them to anchors pointing at the documented concept's reference page. The target carries the fully-qualified name the lookup needs; the body carries the unqualified spelling the reader sees, matching the source.

concepts holds fully-qualified concept names captured from the AST. They map to their unqualified last segment for matching against the requires-clause text. The fully-qualified name goes in the marker target so the generator's lookup follows the same contract as the {\concept} command, which registers the concept under its fully-qualified name.

A single combined pass substitutes every concept in one sweep over the original text. Replacing one concept at a time would re-scan the markers it just inserted, so a later display name could match inside an earlier marker's target attribute and corrupt it. The display names are de-duplicated (the requires-clause text alone can't tell two concepts that share an unqualified spelling apart) and the alternation lists the longest first so a prefix such as {Hashable} yields to {HashableContainer}.

The input text is expected to be the {protect()}-escaped requires clause. The unqualified concept identifiers consist of letters, digits, and underscores only, so they pass through {protect()} unchanged; word boundary anchors ensure only standalone concept-name tokens are substituted.

Definition at line 58 of file cppcodemarker.cpp.

◆ toQStringList()

QStringList toQStringList ( const std::vector< std::string > & refs)
static

Returns a {QStringList} carrying the contents of refs converted from {std::string}.

Definition at line 98 of file cppcodemarker.cpp.