forked from qt-creator/qt-creator
QmlDesigner: Move PropertyDeclarationTraits
Because it is shared between different namespaces it is moved to the parent namespace. Change-Id: I43186bfa3b1b1d6bf95158aaf13b06e0c6bd64b5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -1498,7 +1498,7 @@ private:
|
|||||||
json.append(parameter.name);
|
json.append(parameter.name);
|
||||||
json.append("\",\"tn\":\"");
|
json.append("\",\"tn\":\"");
|
||||||
json.append(parameter.typeName);
|
json.append(parameter.typeName);
|
||||||
if (parameter.traits == Storage::Synchronization::PropertyDeclarationTraits::None) {
|
if (parameter.traits == Storage::PropertyDeclarationTraits::None) {
|
||||||
json.append("\"}");
|
json.append("\"}");
|
||||||
} else {
|
} else {
|
||||||
json.append("\",\"tr\":");
|
json.append("\",\"tr\":");
|
||||||
|
@@ -43,30 +43,15 @@ constexpr std::underlying_type_t<Enumeration> to_underlying(Enumeration enumerat
|
|||||||
return static_cast<std::underlying_type_t<Enumeration>>(enumeration);
|
return static_cast<std::underlying_type_t<Enumeration>>(enumeration);
|
||||||
}
|
}
|
||||||
|
|
||||||
using TypeNameString = Utils::BasicSmallString<63>;
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
namespace QmlDesigner::Storage::Synchronization {
|
namespace QmlDesigner::Storage {
|
||||||
|
|
||||||
enum class TypeAccessSemantics : int { None, Reference, Value, Sequence, IsEnum = 1 << 8 };
|
|
||||||
|
|
||||||
constexpr TypeAccessSemantics operator|(TypeAccessSemantics first, TypeAccessSemantics second)
|
|
||||||
{
|
|
||||||
return static_cast<TypeAccessSemantics>(static_cast<int>(first) | static_cast<int>(second));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class PropertyDeclarationTraits : int {
|
enum class PropertyDeclarationTraits : int {
|
||||||
None = 0,
|
None = 0,
|
||||||
IsReadOnly = 1 << 0,
|
IsReadOnly = 1 << 0,
|
||||||
IsPointer = 1 << 1,
|
IsPointer = 1 << 1,
|
||||||
IsList = 1 << 2
|
IsList = 1 << 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TypeNameKind { Exported = 1, QualifiedExported = 2 };
|
|
||||||
|
|
||||||
enum class FileType : char { QmlTypes, QmlDocument };
|
|
||||||
|
|
||||||
constexpr PropertyDeclarationTraits operator|(PropertyDeclarationTraits first,
|
constexpr PropertyDeclarationTraits operator|(PropertyDeclarationTraits first,
|
||||||
PropertyDeclarationTraits second)
|
PropertyDeclarationTraits second)
|
||||||
{
|
{
|
||||||
@@ -78,6 +63,23 @@ constexpr bool operator&(PropertyDeclarationTraits first, PropertyDeclarationTra
|
|||||||
return static_cast<int>(first) & static_cast<int>(second);
|
return static_cast<int>(first) & static_cast<int>(second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using TypeNameString = Utils::BasicSmallString<63>;
|
||||||
|
|
||||||
|
} // namespace QmlDesigner::Storage
|
||||||
|
|
||||||
|
namespace QmlDesigner::Storage::Synchronization {
|
||||||
|
|
||||||
|
enum class TypeAccessSemantics : int { None, Reference, Value, Sequence, IsEnum = 1 << 8 };
|
||||||
|
|
||||||
|
constexpr TypeAccessSemantics operator|(TypeAccessSemantics first, TypeAccessSemantics second)
|
||||||
|
{
|
||||||
|
return static_cast<TypeAccessSemantics>(static_cast<int>(first) | static_cast<int>(second));
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class TypeNameKind { Exported = 1, QualifiedExported = 2 };
|
||||||
|
|
||||||
|
enum class FileType : char { QmlTypes, QmlDocument };
|
||||||
|
|
||||||
class VersionNumber
|
class VersionNumber
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -170,22 +170,22 @@ bool isListProperty(const QStringView rawtypeName)
|
|||||||
struct TypeNameViewAndTraits
|
struct TypeNameViewAndTraits
|
||||||
{
|
{
|
||||||
QStringView typeName;
|
QStringView typeName;
|
||||||
Storage::Synchronization::PropertyDeclarationTraits traits;
|
Storage::PropertyDeclarationTraits traits;
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeNameViewAndTraits filteredListTypeName(const QStringView rawtypeName)
|
TypeNameViewAndTraits filteredListTypeName(const QStringView rawtypeName)
|
||||||
{
|
{
|
||||||
if (!isListProperty(rawtypeName))
|
if (!isListProperty(rawtypeName))
|
||||||
return {rawtypeName, Storage::Synchronization::PropertyDeclarationTraits::None};
|
return {rawtypeName, Storage::PropertyDeclarationTraits::None};
|
||||||
|
|
||||||
return {rawtypeName.mid(5, rawtypeName.size() - 6),
|
return {rawtypeName.mid(5, rawtypeName.size() - 6),
|
||||||
Storage::Synchronization::PropertyDeclarationTraits::IsList};
|
Storage::PropertyDeclarationTraits::IsList};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypeNameAndTraits
|
struct TypeNameAndTraits
|
||||||
{
|
{
|
||||||
Storage::Synchronization::ImportedTypeName importedTypeName;
|
Storage::Synchronization::ImportedTypeName importedTypeName;
|
||||||
Storage::Synchronization::PropertyDeclarationTraits traits;
|
Storage::PropertyDeclarationTraits traits;
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeNameAndTraits createImportedTypeNameAndTypeTraits(const QStringView rawtypeName,
|
TypeNameAndTraits createImportedTypeNameAndTypeTraits(const QStringView rawtypeName,
|
||||||
|
@@ -174,19 +174,19 @@ Storage::Synchronization::ExportedTypes createCppEnumerationExports(
|
|||||||
return exportedTypes;
|
return exportedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::PropertyDeclarationTraits createPropertyDeclarationTraits(
|
Storage::PropertyDeclarationTraits createPropertyDeclarationTraits(
|
||||||
const QQmlJSMetaProperty &qmlProperty)
|
const QQmlJSMetaProperty &qmlProperty)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::PropertyDeclarationTraits traits{};
|
Storage::PropertyDeclarationTraits traits{};
|
||||||
|
|
||||||
if (qmlProperty.isList())
|
if (qmlProperty.isList())
|
||||||
traits = traits | Storage::Synchronization::PropertyDeclarationTraits::IsList;
|
traits = traits | Storage::PropertyDeclarationTraits::IsList;
|
||||||
|
|
||||||
if (qmlProperty.isPointer())
|
if (qmlProperty.isPointer())
|
||||||
traits = traits | Storage::Synchronization::PropertyDeclarationTraits::IsPointer;
|
traits = traits | Storage::PropertyDeclarationTraits::IsPointer;
|
||||||
|
|
||||||
if (!qmlProperty.isWritable())
|
if (!qmlProperty.isWritable())
|
||||||
traits = traits | Storage::Synchronization::PropertyDeclarationTraits::IsReadOnly;
|
traits = traits | Storage::PropertyDeclarationTraits::IsReadOnly;
|
||||||
|
|
||||||
return traits;
|
return traits;
|
||||||
}
|
}
|
||||||
|
@@ -525,6 +525,29 @@ std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext)
|
|||||||
}
|
}
|
||||||
} // namespace Cache
|
} // namespace Cache
|
||||||
|
|
||||||
|
namespace Storage {
|
||||||
|
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits)
|
||||||
|
{
|
||||||
|
const char *padding = "";
|
||||||
|
|
||||||
|
out << "(";
|
||||||
|
if (traits & PropertyDeclarationTraits::IsReadOnly) {
|
||||||
|
out << "readonly";
|
||||||
|
padding = ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (traits & PropertyDeclarationTraits::IsPointer) {
|
||||||
|
out << padding << "pointer";
|
||||||
|
padding = ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (traits & PropertyDeclarationTraits::IsList)
|
||||||
|
out << padding << "list";
|
||||||
|
|
||||||
|
return out << ")";
|
||||||
|
}
|
||||||
|
} // namespace Storage
|
||||||
|
|
||||||
namespace Storage::Synchronization {
|
namespace Storage::Synchronization {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -714,27 +737,6 @@ std::ostream &operator<<(std::ostream &out, const PropertyDeclaration &propertyD
|
|||||||
<< propertyDeclaration.aliasPropertyName << "\")";
|
<< propertyDeclaration.aliasPropertyName << "\")";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits)
|
|
||||||
{
|
|
||||||
const char *padding = "";
|
|
||||||
|
|
||||||
out << "(";
|
|
||||||
if (traits & PropertyDeclarationTraits::IsReadOnly) {
|
|
||||||
out << "readonly";
|
|
||||||
padding = ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (traits & PropertyDeclarationTraits::IsPointer) {
|
|
||||||
out << padding << "pointer";
|
|
||||||
padding = ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (traits & PropertyDeclarationTraits::IsList)
|
|
||||||
out << padding << "list";
|
|
||||||
|
|
||||||
return out << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const FunctionDeclaration &functionDeclaration)
|
std::ostream &operator<<(std::ostream &out, const FunctionDeclaration &functionDeclaration)
|
||||||
{
|
{
|
||||||
return out << "(\"" << functionDeclaration.name << "\", \"" << functionDeclaration.returnTypeName
|
return out << "(\"" << functionDeclaration.name << "\", \"" << functionDeclaration.returnTypeName
|
||||||
|
@@ -153,6 +153,12 @@ class SourceContext;
|
|||||||
std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext);
|
std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext);
|
||||||
} // namespace Cache
|
} // namespace Cache
|
||||||
|
|
||||||
|
namespace Storage {
|
||||||
|
enum class PropertyDeclarationTraits : int;
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits);
|
||||||
|
} // namespace Storage
|
||||||
|
|
||||||
namespace Storage::Synchronization {
|
namespace Storage::Synchronization {
|
||||||
class Type;
|
class Type;
|
||||||
class ExportedType;
|
class ExportedType;
|
||||||
@@ -161,7 +167,6 @@ class QualifiedImportedType;
|
|||||||
class Version;
|
class Version;
|
||||||
class VersionNumber;
|
class VersionNumber;
|
||||||
enum class TypeAccessSemantics : int;
|
enum class TypeAccessSemantics : int;
|
||||||
enum class PropertyDeclarationTraits : int;
|
|
||||||
class PropertyDeclaration;
|
class PropertyDeclaration;
|
||||||
class FunctionDeclaration;
|
class FunctionDeclaration;
|
||||||
class ParameterDeclaration;
|
class ParameterDeclaration;
|
||||||
@@ -186,7 +191,6 @@ std::ostream &operator<<(std::ostream &out, const ExportedType &exportedType);
|
|||||||
std::ostream &operator<<(std::ostream &out, const ImportedType &importedType);
|
std::ostream &operator<<(std::ostream &out, const ImportedType &importedType);
|
||||||
std::ostream &operator<<(std::ostream &out, const QualifiedImportedType &importedType);
|
std::ostream &operator<<(std::ostream &out, const QualifiedImportedType &importedType);
|
||||||
std::ostream &operator<<(std::ostream &out, const PropertyDeclaration &propertyDeclaration);
|
std::ostream &operator<<(std::ostream &out, const PropertyDeclaration &propertyDeclaration);
|
||||||
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits);
|
|
||||||
std::ostream &operator<<(std::ostream &out, const FunctionDeclaration &functionDeclaration);
|
std::ostream &operator<<(std::ostream &out, const FunctionDeclaration &functionDeclaration);
|
||||||
std::ostream &operator<<(std::ostream &out, const ParameterDeclaration ¶meter);
|
std::ostream &operator<<(std::ostream &out, const ParameterDeclaration ¶meter);
|
||||||
std::ostream &operator<<(std::ostream &out, const SignalDeclaration &signalDeclaration);
|
std::ostream &operator<<(std::ostream &out, const SignalDeclaration &signalDeclaration);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user