typesystem.h | typesystem.h | |||
---|---|---|---|---|
skipping to change at line 85 | skipping to change at line 85 | |||
}; | }; | |||
enum Ownership { | enum Ownership { | |||
InvalidOwnership, | InvalidOwnership, | |||
DefaultOwnership, | DefaultOwnership, | |||
TargetLangOwnership, | TargetLangOwnership, | |||
CppOwnership | CppOwnership | |||
}; | }; | |||
}; | }; | |||
struct ReferenceCount | struct APIEXTRACTOR_API ReferenceCount | |||
{ | { | |||
ReferenceCount() {} | ReferenceCount() {} | |||
enum Action { // 0x01 - 0xff | enum Action { // 0x01 - 0xff | |||
Invalid = 0x00, | Invalid = 0x00, | |||
Add = 0x01, | Add = 0x01, | |||
AddAll = 0x02, | AddAll = 0x02, | |||
Remove = 0x04, | Remove = 0x04, | |||
Set = 0x08, | Set = 0x08, | |||
Ignore = 0x10, | Ignore = 0x10, | |||
ActionsMask = 0xff, | ActionsMask = 0xff, | |||
Padding = 0xffffffff | Padding = 0xffffffff | |||
}; | }; | |||
Action action; | Action action; | |||
QString varName; | QString varName; | |||
}; | }; | |||
struct ArgumentOwner | struct APIEXTRACTOR_API ArgumentOwner | |||
{ | { | |||
enum Action { | enum Action { | |||
Invalid = 0x00, | Invalid = 0x00, | |||
Add = 0x01, | Add = 0x01, | |||
Remove = 0x02 | Remove = 0x02 | |||
}; | }; | |||
enum { | enum { | |||
InvalidIndex = -2, | InvalidIndex = -2, | |||
ThisIndex = -1, | ThisIndex = -1, | |||
ReturnIndex = 0, | ReturnIndex = 0, | |||
skipping to change at line 159 | skipping to change at line 159 | |||
} | } | |||
void addTemplateInstance(TemplateInstance *ti) | void addTemplateInstance(TemplateInstance *ti) | |||
{ | { | |||
codeList.append(CodeSnipFragment(ti)); | codeList.append(CodeSnipFragment(ti)); | |||
} | } | |||
QList<CodeSnipFragment> codeList; | QList<CodeSnipFragment> codeList; | |||
}; | }; | |||
class CustomFunction : public CodeSnipAbstract | class APIEXTRACTOR_API CustomFunction : public CodeSnipAbstract | |||
{ | { | |||
public: | public: | |||
CustomFunction(const QString &n = QString()) : name(n) { } | CustomFunction(const QString &n = QString()) : name(n) { } | |||
QString name; | QString name; | |||
QString paramName; | QString paramName; | |||
}; | }; | |||
class TemplateEntry : public CodeSnipAbstract | class APIEXTRACTOR_API TemplateEntry : public CodeSnipAbstract | |||
{ | { | |||
public: | public: | |||
TemplateEntry(const QString &name, double vr) | TemplateEntry(const QString &name, double vr) | |||
: m_name(name), m_version(vr) | : m_name(name), m_version(vr) | |||
{ | { | |||
}; | }; | |||
QString name() const | QString name() const | |||
{ | { | |||
return m_name; | return m_name; | |||
skipping to change at line 193 | skipping to change at line 193 | |||
return m_version; | return m_version; | |||
} | } | |||
private: | private: | |||
QString m_name; | QString m_name; | |||
double m_version; | double m_version; | |||
}; | }; | |||
typedef QHash<QString, TemplateEntry *> TemplateEntryHash; | typedef QHash<QString, TemplateEntry *> TemplateEntryHash; | |||
class TemplateInstance | class APIEXTRACTOR_API TemplateInstance | |||
{ | { | |||
public: | public: | |||
TemplateInstance(const QString &name, double vr) | TemplateInstance(const QString &name, double vr) | |||
: m_name(name), m_version(vr) {} | : m_name(name), m_version(vr) {} | |||
void addReplaceRule(const QString &name, const QString &value) | void addReplaceRule(const QString &name, const QString &value) | |||
{ | { | |||
replaceRules[name] = value; | replaceRules[name] = value; | |||
} | } | |||
skipping to change at line 247 | skipping to change at line 247 | |||
CodeSnip(double vr) : language(TypeSystem::TargetLangCode), version(vr) { } | CodeSnip(double vr) : language(TypeSystem::TargetLangCode), version(vr) { } | |||
CodeSnip(double vr, TypeSystem::Language lang) : language(lang), versio n(vr) { } | CodeSnip(double vr, TypeSystem::Language lang) : language(lang), versio n(vr) { } | |||
TypeSystem::Language language; | TypeSystem::Language language; | |||
Position position; | Position position; | |||
ArgumentMap argumentMap; | ArgumentMap argumentMap; | |||
double version; | double version; | |||
}; | }; | |||
typedef QList<CodeSnip> CodeSnipList; | typedef QList<CodeSnip> CodeSnipList; | |||
struct ArgumentModification | struct APIEXTRACTOR_API ArgumentModification | |||
{ | { | |||
ArgumentModification(int idx, double vr) | ArgumentModification(int idx, double vr) | |||
: removedDefaultExpression(false), removed(false), | : removedDefaultExpression(false), removed(false), | |||
noNullPointers(false), index(idx), version(vr) {} | noNullPointers(false), index(idx), version(vr) {} | |||
// Should the default expression be removed? | // Should the default expression be removed? | |||
uint removedDefaultExpression : 1; | uint removedDefaultExpression : 1; | |||
uint removed : 1; | uint removed : 1; | |||
uint noNullPointers : 1; | uint noNullPointers : 1; | |||
uint resetAfterUse : 1; | uint resetAfterUse : 1; | |||
skipping to change at line 436 | skipping to change at line 436 | |||
private: | private: | |||
FunctionModification() {} | FunctionModification() {} | |||
bool m_thread; | bool m_thread; | |||
bool m_allowThread; | bool m_allowThread; | |||
double m_version; | double m_version; | |||
}; | }; | |||
typedef QList<FunctionModification> FunctionModificationList; | typedef QList<FunctionModification> FunctionModificationList; | |||
struct FieldModification: public Modification | struct APIEXTRACTOR_API FieldModification: public Modification | |||
{ | { | |||
bool isReadable() const | bool isReadable() const | |||
{ | { | |||
return modifiers & Readable; | return modifiers & Readable; | |||
} | } | |||
bool isWritable() const | bool isWritable() const | |||
{ | { | |||
return modifiers & Writable; | return modifiers & Writable; | |||
} | } | |||
skipping to change at line 547 | skipping to change at line 547 | |||
QString m_name; | QString m_name; | |||
Access m_access; | Access m_access; | |||
QList<TypeInfo> m_arguments; | QList<TypeInfo> m_arguments; | |||
TypeInfo m_returnType; | TypeInfo m_returnType; | |||
bool m_isConst; | bool m_isConst; | |||
bool m_isStatic; | bool m_isStatic; | |||
double m_version; | double m_version; | |||
}; | }; | |||
typedef QList<AddedFunction> AddedFunctionList; | typedef QList<AddedFunction> AddedFunctionList; | |||
struct ExpensePolicy | struct APIEXTRACTOR_API ExpensePolicy | |||
{ | { | |||
ExpensePolicy() : limit(-1) {} | ExpensePolicy() : limit(-1) {} | |||
int limit; | int limit; | |||
QString cost; | QString cost; | |||
bool isValid() const | bool isValid() const | |||
{ | { | |||
return limit >= 0; | return limit >= 0; | |||
} | } | |||
}; | }; | |||
class InterfaceTypeEntry; | class InterfaceTypeEntry; | |||
class ObjectTypeEntry; | class ObjectTypeEntry; | |||
class DocModification | class APIEXTRACTOR_API DocModification | |||
{ | { | |||
public: | public: | |||
enum Mode { | enum Mode { | |||
Append, | Append, | |||
Prepend, | Prepend, | |||
Replace, | Replace, | |||
XPathReplace | XPathReplace | |||
}; | }; | |||
DocModification(const QString& xpath, const QString& signature, double vr) | DocModification(const QString& xpath, const QString& signature, double vr) | |||
skipping to change at line 614 | skipping to change at line 614 | |||
private: | private: | |||
Mode m_mode; | Mode m_mode; | |||
QString m_code; | QString m_code; | |||
QString m_xpath; | QString m_xpath; | |||
QString m_signature; | QString m_signature; | |||
double m_version; | double m_version; | |||
}; | }; | |||
typedef QList<DocModification> DocModificationList; | typedef QList<DocModification> DocModificationList; | |||
class CustomConversion; | ||||
class APIEXTRACTOR_API TypeEntry | class APIEXTRACTOR_API TypeEntry | |||
{ | { | |||
public: | public: | |||
enum Type { | enum Type { | |||
PrimitiveType, | PrimitiveType, | |||
VoidType, | VoidType, | |||
VarargsType, | VarargsType, | |||
FlagsType, | FlagsType, | |||
EnumType, | EnumType, | |||
EnumValue, | EnumValue, | |||
skipping to change at line 662 | skipping to change at line 664 | |||
TypeEntry(const QString &name, Type t, double vr) | TypeEntry(const QString &name, Type t, double vr) | |||
: m_name(name), | : m_name(name), | |||
m_type(t), | m_type(t), | |||
m_codeGeneration(GenerateAll), | m_codeGeneration(GenerateAll), | |||
m_preferredConversion(true), | m_preferredConversion(true), | |||
m_stream(false), | m_stream(false), | |||
m_version(vr) | m_version(vr) | |||
{ | { | |||
}; | }; | |||
virtual ~TypeEntry() { } | virtual ~TypeEntry(); | |||
Type type() const | Type type() const | |||
{ | { | |||
return m_type; | return m_type; | |||
} | } | |||
bool isPrimitive() const | bool isPrimitive() const | |||
{ | { | |||
return m_type == PrimitiveType; | return m_type == PrimitiveType; | |||
} | } | |||
bool isEnum() const | bool isEnum() const | |||
skipping to change at line 949 | skipping to change at line 951 | |||
bool hasConversionRule() const | bool hasConversionRule() const | |||
{ | { | |||
return !m_conversionRule.isEmpty(); | return !m_conversionRule.isEmpty(); | |||
} | } | |||
double version() const | double version() const | |||
{ | { | |||
return m_version; | return m_version; | |||
} | } | |||
/// TODO-CONVERTER: mark as deprecated | ||||
bool hasNativeConversionRule() const | bool hasNativeConversionRule() const | |||
{ | { | |||
return m_conversionRule.startsWith(NATIVE_CONVERSION_RULE_FLAG); | return m_conversionRule.startsWith(NATIVE_CONVERSION_RULE_FLAG); | |||
} | } | |||
/// TODO-CONVERTER: mark as deprecated | ||||
bool hasTargetConversionRule() const | bool hasTargetConversionRule() const | |||
{ | { | |||
return m_conversionRule.startsWith(TARGET_CONVERSION_RULE_FLAG); | return m_conversionRule.startsWith(TARGET_CONVERSION_RULE_FLAG); | |||
} | } | |||
bool isCppPrimitive() const; | bool isCppPrimitive() const; | |||
bool hasCustomConversion() const; | ||||
void setCustomConversion(CustomConversion* customConversion); | ||||
CustomConversion* customConversion() const; | ||||
private: | private: | |||
QString m_name; | QString m_name; | |||
Type m_type; | Type m_type; | |||
uint m_codeGeneration; | uint m_codeGeneration; | |||
CustomFunction m_customConstructor; | CustomFunction m_customConstructor; | |||
CustomFunction m_customDestructor; | CustomFunction m_customDestructor; | |||
bool m_preferredConversion; | bool m_preferredConversion; | |||
CodeSnipList m_codeSnips; | CodeSnipList m_codeSnips; | |||
DocModificationList m_docModifications; | DocModificationList m_docModifications; | |||
IncludeList m_extraIncludes; | IncludeList m_extraIncludes; | |||
skipping to change at line 1153 | skipping to change at line 1161 | |||
QString m_targetLangName; | QString m_targetLangName; | |||
QString m_targetLangApiName; | QString m_targetLangApiName; | |||
QString m_defaultConstructor; | QString m_defaultConstructor; | |||
uint m_preferredConversion : 1; | uint m_preferredConversion : 1; | |||
uint m_preferredTargetLangType : 1; | uint m_preferredTargetLangType : 1; | |||
PrimitiveTypeEntry* m_aliasedTypeEntry; | PrimitiveTypeEntry* m_aliasedTypeEntry; | |||
}; | }; | |||
typedef QList<const PrimitiveTypeEntry*> PrimitiveTypeEntryList; | typedef QList<const PrimitiveTypeEntry*> PrimitiveTypeEntryList; | |||
struct EnumValueRedirection | struct APIEXTRACTOR_API EnumValueRedirection | |||
{ | { | |||
EnumValueRedirection(const QString &rej, const QString &us) | EnumValueRedirection(const QString &rej, const QString &us) | |||
: rejected(rej), | : rejected(rej), | |||
used(us) | used(us) | |||
{ | { | |||
} | } | |||
QString rejected; | QString rejected; | |||
QString used; | QString used; | |||
}; | }; | |||
skipping to change at line 1723 | skipping to change at line 1731 | |||
}; | }; | |||
typedef QList<const ContainerTypeEntry*> ContainerTypeEntryList; | typedef QList<const ContainerTypeEntry*> ContainerTypeEntryList; | |||
class APIEXTRACTOR_API NamespaceTypeEntry : public ComplexTypeEntry | class APIEXTRACTOR_API NamespaceTypeEntry : public ComplexTypeEntry | |||
{ | { | |||
public: | public: | |||
NamespaceTypeEntry(const QString &name, double vr) : ComplexTypeEntry(n ame, NamespaceType, vr) { } | NamespaceTypeEntry(const QString &name, double vr) : ComplexTypeEntry(n ame, NamespaceType, vr) { } | |||
}; | }; | |||
class ValueTypeEntry : public ComplexTypeEntry | class APIEXTRACTOR_API ValueTypeEntry : public ComplexTypeEntry | |||
{ | { | |||
public: | public: | |||
ValueTypeEntry(const QString &name, double vr) : ComplexTypeEntry(name, BasicValueType, vr) { } | ValueTypeEntry(const QString &name, double vr) : ComplexTypeEntry(name, BasicValueType, vr) { } | |||
bool isValue() const | bool isValue() const | |||
{ | { | |||
return true; | return true; | |||
} | } | |||
virtual bool isNativeIdBased() const | virtual bool isNativeIdBased() const | |||
{ | { | |||
return true; | return true; | |||
} | } | |||
protected: | protected: | |||
ValueTypeEntry(const QString &name, Type t, double vr) : ComplexTypeEnt ry(name, t, vr) { } | ValueTypeEntry(const QString &name, Type t, double vr) : ComplexTypeEnt ry(name, t, vr) { } | |||
}; | }; | |||
class StringTypeEntry : public ValueTypeEntry | class APIEXTRACTOR_API StringTypeEntry : public ValueTypeEntry | |||
{ | { | |||
public: | public: | |||
StringTypeEntry(const QString &name, double vr) | StringTypeEntry(const QString &name, double vr) | |||
: ValueTypeEntry(name, StringType, vr) | : ValueTypeEntry(name, StringType, vr) | |||
{ | { | |||
setCodeGeneration(GenerateNothing); | setCodeGeneration(GenerateNothing); | |||
} | } | |||
QString targetLangApiName() const; | QString targetLangApiName() const; | |||
QString targetLangName() const; | QString targetLangName() const; | |||
QString targetLangPackage() const; | QString targetLangPackage() const; | |||
virtual bool isNativeIdBased() const | virtual bool isNativeIdBased() const | |||
{ | { | |||
return false; | return false; | |||
} | } | |||
}; | }; | |||
class CharTypeEntry : public ValueTypeEntry | class APIEXTRACTOR_API CharTypeEntry : public ValueTypeEntry | |||
{ | { | |||
public: | public: | |||
CharTypeEntry(const QString &name, double vr) : ValueTypeEntry(name, Ch arType, vr) | CharTypeEntry(const QString &name, double vr) : ValueTypeEntry(name, Ch arType, vr) | |||
{ | { | |||
setCodeGeneration(GenerateNothing); | setCodeGeneration(GenerateNothing); | |||
} | } | |||
QString targetLangApiName() const; | QString targetLangApiName() const; | |||
QString targetLangName() const; | QString targetLangName() const; | |||
QString targetLangPackage() const | QString targetLangPackage() const | |||
{ | { | |||
return QString(); | return QString(); | |||
} | } | |||
virtual bool isNativeIdBased() const | virtual bool isNativeIdBased() const | |||
{ | { | |||
return false; | return false; | |||
} | } | |||
}; | }; | |||
class VariantTypeEntry: public ValueTypeEntry | class APIEXTRACTOR_API VariantTypeEntry: public ValueTypeEntry | |||
{ | { | |||
public: | public: | |||
VariantTypeEntry(const QString &name, double vr) : ValueTypeEntry(name, VariantType, vr) { } | VariantTypeEntry(const QString &name, double vr) : ValueTypeEntry(name, VariantType, vr) { } | |||
QString targetLangApiName() const; | QString targetLangApiName() const; | |||
QString targetLangName() const; | QString targetLangName() const; | |||
QString targetLangPackage() const; | QString targetLangPackage() const; | |||
virtual bool isNativeIdBased() const | virtual bool isNativeIdBased() const | |||
{ | { | |||
skipping to change at line 1880 | skipping to change at line 1888 | |||
virtual bool isNativeIdBased() const | virtual bool isNativeIdBased() const | |||
{ | { | |||
return true; | return true; | |||
} | } | |||
private: | private: | |||
InterfaceTypeEntry *m_interface; | InterfaceTypeEntry *m_interface; | |||
}; | }; | |||
struct TypeRejection | struct APIEXTRACTOR_API TypeRejection | |||
{ | { | |||
QString class_name; | QString class_name; | |||
QString function_name; | QString function_name; | |||
QString field_name; | QString field_name; | |||
QString enum_name; | QString enum_name; | |||
}; | }; | |||
QString fixCppTypeName(const QString &name); | APIEXTRACTOR_API QString fixCppTypeName(const QString &name); | |||
class APIEXTRACTOR_API CustomConversion | ||||
{ | ||||
public: | ||||
CustomConversion(TypeEntry* ownerType); | ||||
~CustomConversion(); | ||||
const TypeEntry* ownerType() const; | ||||
QString nativeToTargetConversion() const; | ||||
void setNativeToTargetConversion(const QString& nativeToTargetConversio | ||||
n); | ||||
class APIEXTRACTOR_API TargetToNativeConversion | ||||
{ | ||||
public: | ||||
TargetToNativeConversion(const QString& sourceTypeName, | ||||
const QString& sourceTypeCheck, | ||||
const QString& conversion = QString()); | ||||
~TargetToNativeConversion(); | ||||
const TypeEntry* sourceType() const; | ||||
void setSourceType(const TypeEntry* sourceType); | ||||
bool isCustomType() const; | ||||
QString sourceTypeName() const; | ||||
QString sourceTypeCheck() const; | ||||
QString conversion() const; | ||||
void setConversion(const QString& conversion); | ||||
private: | ||||
struct TargetToNativeConversionPrivate; | ||||
TargetToNativeConversionPrivate* m_d; | ||||
}; | ||||
/** | ||||
* Returns true if the target to C++ custom conversions should | ||||
* replace the original existing ones, and false if the custom | ||||
* conversions should be added to the original. | ||||
*/ | ||||
bool replaceOriginalTargetToNativeConversions() const; | ||||
void setReplaceOriginalTargetToNativeConversions(bool replaceOriginalTa | ||||
rgetToNativeConversions); | ||||
typedef QList<TargetToNativeConversion*> TargetToNativeConversions; | ||||
bool hasTargetToNativeConversions() const; | ||||
TargetToNativeConversions& targetToNativeConversions(); | ||||
const TargetToNativeConversions& targetToNativeConversions() const; | ||||
void addTargetToNativeConversion(const QString& sourceTypeName, | ||||
const QString& sourceTypeCheck, | ||||
const QString& conversion = QString()) | ||||
; | ||||
private: | ||||
struct CustomConversionPrivate; | ||||
CustomConversionPrivate* m_d; | ||||
}; | ||||
#endif // TYPESYSTEM_H | #endif // TYPESYSTEM_H | |||
End of changes. 21 change blocks. | ||||
17 lines changed or deleted | 78 lines changed or added | |||