Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJS::Dom::DomUniverse Class Referencefinal

Represents a set of parsed/loaded modules libraries and a plugins. More...

#include <qqmldomtop_p.h>

+ Inheritance diagram for QQmlJS::Dom::DomUniverse:
+ Collaboration diagram for QQmlJS::Dom::DomUniverse:

Public Types

enum class  Option { Default , SingleThreaded }
 
- Public Types inherited from QQmlJS::Dom::DomTop
using Callback = DomItem::Callback
 
- Public Types inherited from QQmlJS::Dom::DomBase
using FilterT = function_ref< bool(DomItem &, const PathEls::PathComponent &, DomItem &)>
 

Public Member Functions

 Q_DECLARE_FLAGS (Options, Option)
 
DomType kind () const override
 
 DomUniverse (QString universeName, Options options=Option::SingleThreaded)
 
 DomUniverse (const DomUniverse &)=delete
 
Path canonicalPath () const override
 
bool iterateDirectSubpaths (DomItem &self, DirectVisitor) override
 
std::shared_ptr< DomUniversemakeCopy (DomItem &self) const
 
void loadFile (DomItem &self, const FileToLoad &file, Callback callback, LoadOptions loadOptions, std::optional< DomType > fileType=std::optional< DomType >())
 
void execQueue ()
 
void removePath (const QString &dir)
 
std::shared_ptr< ExternalItemPair< GlobalScope > > globalScopeWithName (QString name) const
 
std::shared_ptr< ExternalItemPair< GlobalScope > > ensureGlobalScopeWithName (QString name)
 
QSet< QStringglobalScopeNames () const
 
std::shared_ptr< ExternalItemPair< QmlDirectory > > qmlDirectoryWithPath (QString path) const
 
QSet< QStringqmlDirectoryPaths () const
 
std::shared_ptr< ExternalItemPair< QmldirFile > > qmldirFileWithPath (QString path) const
 
QSet< QStringqmldirFilePaths () const
 
std::shared_ptr< ExternalItemPair< QmlFile > > qmlFileWithPath (QString path) const
 
QSet< QStringqmlFilePaths () const
 
std::shared_ptr< ExternalItemPair< JsFile > > jsFileWithPath (QString path) const
 
QSet< QStringjsFilePaths () const
 
std::shared_ptr< ExternalItemPair< QmltypesFile > > qmltypesFileWithPath (QString path) const
 
QSet< QStringqmltypesFilePaths () const
 
QString name () const
 
Options options () const
 
QQueue< ParsingTaskqueue () const
 
virtual Path canonicalPath () const=0
 
Path canonicalPath (DomItem &) const override
 QQml::Dom::DomTop::loadFile.
 
- Public Member Functions inherited from QQmlJS::Dom::DomTop
 DomTop (QMap< QString, OwnerT > extraOwningItems={}, int derivedFrom=0)
 
 DomTop (const DomTop &o)
 
virtual Path canonicalPath () const =0
 
Path canonicalPath (DomItem &) const override
 QQml::Dom::DomTop::loadFile.
 
DomItem containingObject (DomItem &) const override
 
bool iterateDirectSubpaths (DomItem &self, DirectVisitor) override
 
template<typename T >
void setExtraOwningItem (QString fieldName, std::shared_ptr< T > item)
 
void clearExtraOwningItems ()
 
QMap< QString, OwnerTextraOwningItems () const
 
- Public Member Functions inherited from QQmlJS::Dom::OwningItem
 OwningItem (const OwningItem &o)
 
 OwningItem (int derivedFrom=0)
 
 OwningItem (int derivedFrom, QDateTime lastDataUpdateAt)
 
 OwningItem (const OwningItem &&)=delete
 
OwningItemoperator= (const OwningItem &&)=delete
 
Path canonicalPath (DomItem &self) const override=0
 
bool iterateDirectSubpaths (DomItem &self, DirectVisitor) override
 
std::shared_ptr< OwningItemmakeCopy (DomItem &self) const
 
Path pathFromOwner () const
 
Path pathFromOwner (DomItem &) const override final
 
DomItem containingObject (DomItem &self) const override
 
int derivedFrom () const
 
virtual int revision () const
 
QDateTime createdAt () const
 
virtual QDateTime lastDataUpdateAt () const
 
virtual void refreshedDataAt (QDateTime tNew)
 
virtual bool frozen () const
 
virtual bool freeze ()
 
QDateTime frozenAt () const
 
virtual void addError (DomItem &self, ErrorMessage msg)
 
void addErrorLocal (ErrorMessage msg)
 
void clearErrors (ErrorGroups groups=ErrorGroups({}))
 
bool iterateErrors (DomItem &self, function_ref< bool(DomItem source, ErrorMessage msg)> visitor, Path inPath=Path())
 
QMultiMap< Path, ErrorMessagelocalErrors () const
 
virtual bool iterateSubOwners (DomItem &self, function_ref< bool(DomItem &owner)> visitor)
 
QBasicMutexmutex () const
 
- Public Member Functions inherited from QQmlJS::Dom::DomBase
virtual ~DomBase ()=default
 
DomBasedomBase ()
 
virtual DomType kind () const =0
 
virtual DomKind domKind () const
 
virtual Path pathFromOwner (DomItem &self) const =0
 
virtual Path canonicalPath (DomItem &self) const =0
 
virtual bool iterateDirectSubpaths (DomItem &self, DirectVisitor visitor)=0
 
bool iterateDirectSubpathsConst (DomItem &self, DirectVisitor) const
 
virtual DomItem containingObject (DomItem &self) const
 
virtual void dump (DomItem &, Sink sink, int indent, FilterT filter) const
 
virtual quintptr id () const
 
QString typeName () const
 
virtual QList< QStringfields (DomItem &self) const
 
virtual DomItem field (DomItem &self, QStringView name) const
 
virtual index_type indexes (DomItem &self) const
 
virtual DomItem index (DomItem &self, index_type index) const
 
virtual QSet< QString > const keys (DomItem &self) const
 
virtual DomItem key (DomItem &self, QString name) const
 
virtual QString canonicalFilePath (DomItem &self) const
 
virtual void writeOut (DomItem &self, OutWriter &lw) const
 
virtual QCborValue value () const
 

Static Public Member Functions

static ErrorGroups myErrors ()
 
static std::shared_ptr< DomUniverseguaranteeUniverse (std::shared_ptr< DomUniverse > univ)
 
static DomItem create (QString universeName, Options options=Option::SingleThreaded)
 
- Static Public Member Functions inherited from QQmlJS::Dom::OwningItem
static int nextRevision ()
 

Static Public Attributes

static constexpr DomType kindValue = DomType::DomUniverse
 

Protected Member Functions

std::shared_ptr< OwningItemdoCopy (DomItem &self) const override
 
virtual std::shared_ptr< OwningItemdoCopy (DomItem &self) const =0
 

Detailed Description

Represents a set of parsed/loaded modules libraries and a plugins.

This can be used to share parsing and updates between several Dom models, and kickstart a model without reparsing everything.

The universe is peculiar, because stepping into it from an environment looses the connection with the environment.

This implementation is a placeholder, a later patch will introduce it.

Definition at line 196 of file qqmldomtop_p.h.

Member Enumeration Documentation

◆ Option

Enumerator
Default 
SingleThreaded 

Definition at line 204 of file qqmldomtop_p.h.

Constructor & Destructor Documentation

◆ DomUniverse() [1/2]

QQmlJS::Dom::DomUniverse::DomUniverse ( QString  universeName,
Options  options = Option::SingleThreaded 
)

Definition at line 124 of file qqmldomtop.cpp.

◆ DomUniverse() [2/2]

QQmlJS::Dom::DomUniverse::DomUniverse ( const DomUniverse )
delete

Member Function Documentation

◆ canonicalPath() [1/3]

Path QQmlJS::Dom::DomUniverse::canonicalPath ( ) const
overridevirtual

Implements QQmlJS::Dom::DomTop.

Definition at line 147 of file qqmldomtop.cpp.

References QQmlJS::Dom::Path::Root().

Referenced by execQueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canonicalPath() [2/3]

virtual Path QQmlJS::Dom::DomTop::canonicalPath ( ) const
virtual

Implements QQmlJS::Dom::DomTop.

◆ canonicalPath() [3/3]

Path QQmlJS::Dom::DomTop::canonicalPath ( DomItem ) const
overridevirtual

QQml::Dom::DomTop::loadFile.

Parameters
filePaththe file path to load
logicalPaththe path from the
callbacka callback called with an canonical path, the old value, and the current value.
loadOptionsare if force is true the file is always read

Reimplemented from QQmlJS::Dom::DomTop.

Definition at line 176 of file qqmldomtop.cpp.

References QQmlJS::Dom::Path::Field(), map, qmlFilePaths(), and qmlFileWithPath().

+ Here is the call graph for this function:

◆ create()

DomItem QQmlJS::Dom::DomUniverse::create ( QString  universeName,
Options  options = Option::SingleThreaded 
)
static

Definition at line 141 of file qqmldomtop.cpp.

References options().

+ Here is the call graph for this function:

◆ doCopy()

std::shared_ptr< OwningItem > QQmlJS::Dom::DomUniverse::doCopy ( DomItem self) const
overrideprotectedvirtual

Implements QQmlJS::Dom::OwningItem.

Definition at line 211 of file qqmldomtop.cpp.

References QRegularExpression::anchoredPattern(), and QStringLiteral.

+ Here is the call graph for this function:

◆ ensureGlobalScopeWithName()

std::shared_ptr< ExternalItemPair< GlobalScope > > QQmlJS::Dom::DomUniverse::ensureGlobalScopeWithName ( QString  name)
inline

Definition at line 240 of file qqmldomtop_p.h.

References mutex.

◆ execQueue()

void QQmlJS::Dom::DomUniverse::execQueue ( )

Definition at line 318 of file qqmldomtop.cpp.

References QQmlJS::Dom::DomItem::addError(), QList< T >::append(), arg, canonicalPath(), QFileDevice::close(), QQmlJS::Dom::DomItem::copy(), QQmlJS::Dom::createDom(), QDateTime::currentDateTimeUtc(), QString::data(), QDateTime::date(), QDir::entryList(), QFileDevice::error(), error, QQmlJS::Dom::ErrorGroups::error(), QIODevice::errorString(), file, QDir::Files, QQmlJS::Dom::ForceLoad, QDateTime::fromMSecsSinceEpoch(), QQmlJS::Dom::QmldirFile::fromPathAndCode(), QString::fromUtf8(), QQmlJS::Dom::ErrorMessage::handle(), QString::isEmpty(), QString::isNull(), QQmlJS::Dom::DomItem::iterateErrors(), QQmlJS::Dom::OwningItem::mutex(), myErrors(), QDir::Name, QQmlJS::Dom::DomEnvironment::NoDependencies, QDir::NoDotAndDotDot, now, QString::number(), QFile::open(), ptr(), Q_ASSERT, qCWarning, QQmlJS::Dom::QmlDirectory, QQmlJS::Dom::Paths::qmlDirectoryInfoPath(), QQmlJS::Dom::QmldirFile, QQmlJS::Dom::Paths::qmldirFileInfoPath(), QQmlJS::Dom::QmlFile, QQmlJS::Dom::Paths::qmlFileInfoPath(), QQmlJS::Dom::QmltypesFile, QQmlJS::Dom::Paths::qmltypesFileInfoPath(), QStringLiteral, QIODevice::readAll(), QIODeviceBase::ReadOnly, QString::split(), tr, and QTimeZone::UTC.

Referenced by loadFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ globalScopeNames()

QSet< QString > QQmlJS::Dom::DomUniverse::globalScopeNames ( ) const
inline

Definition at line 254 of file qqmldomtop_p.h.

References QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.

Referenced by iterateDirectSubpaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ globalScopeWithName()

std::shared_ptr< ExternalItemPair< GlobalScope > > QQmlJS::Dom::DomUniverse::globalScopeWithName ( QString  name) const
inline

Definition at line 234 of file qqmldomtop_p.h.

References mutex.

Referenced by iterateDirectSubpaths().

+ Here is the caller graph for this function:

◆ guaranteeUniverse()

std::shared_ptr< DomUniverse > QQmlJS::Dom::DomUniverse::guaranteeUniverse ( std::shared_ptr< DomUniverse univ)
static

Definition at line 128 of file qqmldomtop.cpp.

References next, and QString::number().

+ Here is the call graph for this function:

◆ iterateDirectSubpaths()

bool QQmlJS::Dom::DomUniverse::iterateDirectSubpaths ( DomItem self,
DirectVisitor  visitor 
)
overridevirtual

Reimplemented from QQmlJS::Dom::DomTop.

Definition at line 152 of file qqmldomtop.cpp.

References QQmlJS::Dom::Path::Field(), globalScopeNames(), globalScopeWithName(), QQmlJS::Dom::DomTop::iterateDirectSubpaths(), map, name(), options(), qmlDirectoryPaths(), qmlDirectoryWithPath(), qmldirFilePaths(), and qmldirFileWithPath().

+ Here is the call graph for this function:

◆ jsFilePaths()

QSet< QString > QQmlJS::Dom::DomUniverse::jsFilePaths ( ) const
inline

Definition at line 314 of file qqmldomtop_p.h.

References QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.

+ Here is the call graph for this function:

◆ jsFileWithPath()

std::shared_ptr< ExternalItemPair< JsFile > > QQmlJS::Dom::DomUniverse::jsFileWithPath ( QString  path) const
inline

Definition at line 309 of file qqmldomtop_p.h.

References mutex.

◆ kind()

DomType QQmlJS::Dom::DomUniverse::kind ( ) const
inlineoverridevirtual

Implements QQmlJS::Dom::DomBase.

Definition at line 211 of file qqmldomtop_p.h.

◆ loadFile()

void QQmlJS::Dom::DomUniverse::loadFile ( DomItem self,
const FileToLoad file,
Callback  callback,
LoadOptions  loadOptions,
std::optional< DomType fileType = std::optional<DomType>() 
)

◆ makeCopy()

std::shared_ptr< DomUniverse > QQmlJS::Dom::DomUniverse::makeCopy ( DomItem self) const
inline

Definition at line 223 of file qqmldomtop_p.h.

◆ myErrors()

ErrorGroups QQmlJS::Dom::DomUniverse::myErrors ( )
static

Definition at line 118 of file qqmldomtop.cpp.

References NewErrorGroup.

Referenced by execQueue(), QQmlJS::Dom::fileTypeForPath(), and loadFile().

+ Here is the caller graph for this function:

◆ name()

QString QQmlJS::Dom::DomUniverse::name ( ) const
inline

Definition at line 339 of file qqmldomtop_p.h.

Referenced by iterateDirectSubpaths().

+ Here is the caller graph for this function:

◆ options()

Options QQmlJS::Dom::DomUniverse::options ( ) const
inline

Definition at line 342 of file qqmldomtop_p.h.

References m_options.

Referenced by create(), and iterateDirectSubpaths().

+ Here is the caller graph for this function:

◆ Q_DECLARE_FLAGS()

QQmlJS::Dom::DomUniverse::Q_DECLARE_FLAGS ( Options  ,
Option   
)

◆ qmlDirectoryPaths()

QSet< QString > QQmlJS::Dom::DomUniverse::qmlDirectoryPaths ( ) const
inline

Definition at line 269 of file qqmldomtop_p.h.

References QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.

Referenced by iterateDirectSubpaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlDirectoryWithPath()

std::shared_ptr< ExternalItemPair< QmlDirectory > > QQmlJS::Dom::DomUniverse::qmlDirectoryWithPath ( QString  path) const
inline

Definition at line 264 of file qqmldomtop_p.h.

References mutex.

Referenced by iterateDirectSubpaths().

+ Here is the caller graph for this function:

◆ qmldirFilePaths()

QSet< QString > QQmlJS::Dom::DomUniverse::qmldirFilePaths ( ) const
inline

Definition at line 284 of file qqmldomtop_p.h.

References QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.

Referenced by iterateDirectSubpaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmldirFileWithPath()

std::shared_ptr< ExternalItemPair< QmldirFile > > QQmlJS::Dom::DomUniverse::qmldirFileWithPath ( QString  path) const
inline

Definition at line 279 of file qqmldomtop_p.h.

References mutex.

Referenced by iterateDirectSubpaths().

+ Here is the caller graph for this function:

◆ qmlFilePaths()

QSet< QString > QQmlJS::Dom::DomUniverse::qmlFilePaths ( ) const
inline

Definition at line 299 of file qqmldomtop_p.h.

References QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.

Referenced by canonicalPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlFileWithPath()

std::shared_ptr< ExternalItemPair< QmlFile > > QQmlJS::Dom::DomUniverse::qmlFileWithPath ( QString  path) const
inline

Definition at line 294 of file qqmldomtop_p.h.

References mutex.

Referenced by canonicalPath().

+ Here is the caller graph for this function:

◆ qmltypesFilePaths()

QSet< QString > QQmlJS::Dom::DomUniverse::qmltypesFilePaths ( ) const
inline

Definition at line 329 of file qqmldomtop_p.h.

References QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.

+ Here is the call graph for this function:

◆ qmltypesFileWithPath()

std::shared_ptr< ExternalItemPair< QmltypesFile > > QQmlJS::Dom::DomUniverse::qmltypesFileWithPath ( QString  path) const
inline

Definition at line 324 of file qqmldomtop_p.h.

References mutex.

◆ queue()

QQueue< ParsingTask > QQmlJS::Dom::DomUniverse::queue ( ) const
inline

Definition at line 345 of file qqmldomtop_p.h.

References mutex.

◆ removePath()

void QQmlJS::Dom::DomUniverse::removePath ( const QString dir)

Definition at line 491 of file qqmldomtop.cpp.

References it, and QQmlJS::Dom::OwningItem::mutex().

+ Here is the call graph for this function:

Member Data Documentation

◆ kindValue

constexpr DomType QQmlJS::Dom::DomUniverse::kindValue = DomType::DomUniverse
staticconstexpr

Definition at line 210 of file qqmldomtop_p.h.


The documentation for this class was generated from the following files: