forked from qt-creator/qt-creator
QmlDesigner: Add ProjectStorage::propertyDeclaration
Returns for a property declaration id the property declaration infos. If there are no infos a null optional is returned. Task-number: QDS-7278 Change-Id: I4faa158008130f00f31062bab94baa7f88d70edf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -176,6 +176,14 @@ public:
|
||||
.template valueWithTransaction<PropertyDeclarationId>(&typeId, propertyName);
|
||||
}
|
||||
|
||||
Utils::optional<Storage::Info::PropertyDeclaration> propertyDeclaration(
|
||||
PropertyDeclarationId propertyDeclarationId) const
|
||||
{
|
||||
return selectPropertyDeclarationForPropertyDeclarationIdStatement
|
||||
.template optionalValueWithTransaction<Storage::Info::PropertyDeclaration>(
|
||||
&propertyDeclarationId);
|
||||
}
|
||||
|
||||
Utils::optional<Utils::SmallString> propertyName(PropertyDeclarationId propertyDeclarationId) const
|
||||
{
|
||||
return selectPropertyNameStatement.template optionalValueWithTransaction<Utils::SmallString>(
|
||||
@@ -2926,6 +2934,11 @@ public:
|
||||
"FROM propertyDeclarations "
|
||||
"WHERE typeId=?1 AND name=?2 LIMIT 1",
|
||||
database};
|
||||
mutable ReadStatement<4, 1> selectPropertyDeclarationForPropertyDeclarationIdStatement{
|
||||
"SELECT typeId, name, propertyTraits, propertyTypeId "
|
||||
"FROM propertyDeclarations "
|
||||
"WHERE propertyDeclarationId=?1 LIMIT 1",
|
||||
database};
|
||||
};
|
||||
extern template class ProjectStorage<Sqlite::Database>;
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -926,3 +926,36 @@ public:
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner::Storage::Synchronization
|
||||
|
||||
namespace QmlDesigner::Storage::Info {
|
||||
|
||||
class PropertyDeclaration
|
||||
{
|
||||
public:
|
||||
PropertyDeclaration(long long typeId,
|
||||
Utils::SmallStringView name,
|
||||
long long traits,
|
||||
long long propertyTypeId)
|
||||
: typeId{typeId}
|
||||
, name{name}
|
||||
, traits{static_cast<PropertyDeclarationTraits>(traits)}
|
||||
, propertyTypeId{propertyTypeId}
|
||||
{}
|
||||
|
||||
PropertyDeclaration(TypeId typeId,
|
||||
Utils::SmallStringView name,
|
||||
PropertyDeclarationTraits traits,
|
||||
TypeId propertyTypeId)
|
||||
: typeId{typeId}
|
||||
, name{name}
|
||||
, traits{traits}
|
||||
, propertyTypeId{propertyTypeId}
|
||||
{}
|
||||
|
||||
TypeId typeId;
|
||||
Utils::SmallString name;
|
||||
PropertyDeclarationTraits traits;
|
||||
TypeId propertyTypeId;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner::Storage::Info
|
||||
|
||||
Reference in New Issue
Block a user