奥特QT DDS 插件库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

59 行
2.0KB

  1. #include <QtQml/qqmlprivate.h>
  2. #include <QtCore/qdir.h>
  3. #include <QtCore/qurl.h>
  4. #include <QtCore/qhash.h>
  5. #include <QtCore/qstring.h>
  6. namespace QmlCacheGeneratedCode {
  7. namespace _qt_qml_AuseftDDSPlugTest_Main_qml {
  8. extern const unsigned char qmlData[];
  9. extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[];
  10. const QQmlPrivate::CachedQmlUnit unit = {
  11. reinterpret_cast<const QV4::CompiledData::Unit*>(&qmlData), &aotBuiltFunctions[0], nullptr
  12. };
  13. }
  14. }
  15. namespace {
  16. struct Registry {
  17. Registry();
  18. ~Registry();
  19. QHash<QString, const QQmlPrivate::CachedQmlUnit*> resourcePathToCachedUnit;
  20. static const QQmlPrivate::CachedQmlUnit *lookupCachedUnit(const QUrl &url);
  21. };
  22. Q_GLOBAL_STATIC(Registry, unitRegistry)
  23. Registry::Registry() {
  24. resourcePathToCachedUnit.insert(QStringLiteral("/qt/qml/AuseftDDSPlugTest/Main.qml"), &QmlCacheGeneratedCode::_qt_qml_AuseftDDSPlugTest_Main_qml::unit);
  25. QQmlPrivate::RegisterQmlUnitCacheHook registration;
  26. registration.structVersion = 0;
  27. registration.lookupCachedQmlUnit = &lookupCachedUnit;
  28. QQmlPrivate::qmlregister(QQmlPrivate::QmlUnitCacheHookRegistration, &registration);
  29. }
  30. Registry::~Registry() {
  31. QQmlPrivate::qmlunregister(QQmlPrivate::QmlUnitCacheHookRegistration, quintptr(&lookupCachedUnit));
  32. }
  33. const QQmlPrivate::CachedQmlUnit *Registry::lookupCachedUnit(const QUrl &url) {
  34. if (url.scheme() != QLatin1String("qrc"))
  35. return nullptr;
  36. QString resourcePath = QDir::cleanPath(url.path());
  37. if (resourcePath.isEmpty())
  38. return nullptr;
  39. if (!resourcePath.startsWith(QLatin1Char('/')))
  40. resourcePath.prepend(QLatin1Char('/'));
  41. return unitRegistry()->resourcePathToCachedUnit.value(resourcePath, nullptr);
  42. }
  43. }
  44. int QT_MANGLE_NAMESPACE(qInitResources_qmlcache_AuseftDDSPlugTest)() {
  45. ::unitRegistry();
  46. return 1;
  47. }
  48. Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_qmlcache_AuseftDDSPlugTest))
  49. int QT_MANGLE_NAMESPACE(qCleanupResources_qmlcache_AuseftDDSPlugTest)() {
  50. return 1;
  51. }