abstractmetalang.h   abstractmetalang.h 
skipping to change at line 276 skipping to change at line 276
bool wasPublic() const bool wasPublic() const
{ {
return m_originalAttributes & Public; return m_originalAttributes & Public;
} }
bool wasFriendly() const bool wasFriendly() const
{ {
return m_originalAttributes & Friendly; return m_originalAttributes & Friendly;
} }
// valid only for global components
// (e.g.: functions, enums, flags)
QString includeFile() const
{
return m_includeFile;
}
void setIncludeFile(const QString& file)
{
m_includeFile = file;
}
void setDocumentation(const Documentation& doc) void setDocumentation(const Documentation& doc)
{ {
m_doc = doc; m_doc = doc;
} }
Documentation documentation() const Documentation documentation() const
{ {
return m_doc; return m_doc;
} }
private: private:
uint m_attributes; uint m_attributes;
uint m_originalAttributes; uint m_originalAttributes;
QString m_includeFile;
Documentation m_doc; Documentation m_doc;
}; };
class APIEXTRACTOR_API AbstractMetaType class APIEXTRACTOR_API AbstractMetaType
{ {
public: public:
enum TypeUsagePattern { enum TypeUsagePattern {
InvalidPattern, InvalidPattern,
PrimitivePattern, PrimitivePattern,
FlagsPattern, FlagsPattern,
skipping to change at line 769 skipping to change at line 756
EqualModifiedName = 0x00000040, EqualModifiedName = 0x00000040,
NameLessThan = 0x00001000, NameLessThan = 0x00001000,
PrettySimilar = EqualName | EqualArguments, PrettySimilar = EqualName | EqualArguments,
Equal = 0x0000001f, Equal = 0x0000001f,
NotEqual = 0x00001000 NotEqual = 0x00001000
}; };
AbstractMetaFunction() AbstractMetaFunction()
: m_functionType(NormalFunction), : m_typeEntry(0),
m_functionType(NormalFunction),
m_type(0), m_type(0),
m_class(0), m_class(0),
m_implementingClass(0), m_implementingClass(0),
m_declaringClass(0), m_declaringClass(0),
m_interfaceClass(0), m_interfaceClass(0),
m_propertySpec(0), m_propertySpec(0),
m_constant(false), m_constant(false),
m_invalid(false), m_invalid(false),
m_reverse(false), m_reverse(false),
m_userAdded(false), m_userAdded(false),
skipping to change at line 1100 skipping to change at line 1088
void setPropertySpec(QPropertySpec *spec) void setPropertySpec(QPropertySpec *spec)
{ {
m_propertySpec = spec; m_propertySpec = spec;
} }
QPropertySpec *propertySpec() const QPropertySpec *propertySpec() const
{ {
return m_propertySpec; return m_propertySpec;
} }
FunctionTypeEntry* typeEntry() const
{
return m_typeEntry;
}
void setTypeEntry(FunctionTypeEntry* typeEntry)
{
m_typeEntry = typeEntry;
}
private: private:
QString m_name; QString m_name;
QString m_originalName; QString m_originalName;
mutable QString m_cachedMinimalSignature; mutable QString m_cachedMinimalSignature;
mutable QString m_cachedModifiedName; mutable QString m_cachedModifiedName;
FunctionTypeEntry* m_typeEntry;
FunctionType m_functionType; FunctionType m_functionType;
AbstractMetaType *m_type; AbstractMetaType *m_type;
const AbstractMetaClass *m_class; const AbstractMetaClass *m_class;
const AbstractMetaClass *m_implementingClass; const AbstractMetaClass *m_implementingClass;
const AbstractMetaClass *m_declaringClass; const AbstractMetaClass *m_declaringClass;
const AbstractMetaClass *m_interfaceClass; const AbstractMetaClass *m_interfaceClass;
QPropertySpec *m_propertySpec; QPropertySpec *m_propertySpec;
AbstractMetaArgumentList m_arguments; AbstractMetaArgumentList m_arguments;
uint m_constant : 1; uint m_constant : 1;
uint m_invalid : 1; uint m_invalid : 1;
skipping to change at line 1359 skipping to change at line 1357
} }
void setFunctions(const AbstractMetaFunctionList &functions); void setFunctions(const AbstractMetaFunctionList &functions);
void addFunction(AbstractMetaFunction *function); void addFunction(AbstractMetaFunction *function);
bool hasFunction(const AbstractMetaFunction *f) const; bool hasFunction(const AbstractMetaFunction *f) const;
bool hasFunction(const QString &str) const; bool hasFunction(const QString &str) const;
const AbstractMetaFunction* findFunction(const QString& functionName) c onst; const AbstractMetaFunction* findFunction(const QString& functionName) c onst;
bool hasSignal(const AbstractMetaFunction *f) const; bool hasSignal(const AbstractMetaFunction *f) const;
bool hasConstructors() const; bool hasConstructors() const;
bool hasCopyConstructor() const;
bool hasPrivateCopyConstructor() const;
void addDefaultConstructor(); void addDefaultConstructor();
void addDefaultCopyConstructor(bool isPrivate = false);
bool hasNonPrivateConstructor() const bool hasNonPrivateConstructor() const
{ {
return m_hasNonPrivateConstructor; return m_hasNonPrivateConstructor;
} }
void setHasNonPrivateConstructor(bool value) void setHasNonPrivateConstructor(bool value)
{ {
m_hasNonPrivateConstructor = value; m_hasNonPrivateConstructor = value;
} }
 End of changes. 7 change blocks. 
14 lines changed or deleted 15 lines changed or added


 typesystem.h   typesystem.h 
skipping to change at line 33 skipping to change at line 33
#ifndef TYPESYSTEM_H #ifndef TYPESYSTEM_H
#define TYPESYSTEM_H #define TYPESYSTEM_H
#include <QtCore/QHash> #include <QtCore/QHash>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include "apiextractormacros.h" #include "apiextractormacros.h"
#include "include.h"
class Indentor; class Indentor;
class AbstractMetaType; class AbstractMetaType;
class QTextStream; class QTextStream;
class EnumTypeEntry; class EnumTypeEntry;
class FlagsTypeEntry; class FlagsTypeEntry;
struct APIEXTRACTOR_API Include
{
enum IncludeType {
IncludePath,
LocalPath,
TargetLangImport
};
Include() : type(IncludePath) {}
Include(IncludeType t, const QString &nam) : type(t), name(nam) {};
bool isValid()
{
return !name.isEmpty();
}
IncludeType type;
QString name;
QString toString() const;
bool operator<(const Include &other) const
{
return name < other.name;
}
};
typedef QList<Include> IncludeList;
typedef QMap<int, QString> ArgumentMap; typedef QMap<int, QString> ArgumentMap;
class TemplateInstance; class TemplateInstance;
namespace TypeSystem namespace TypeSystem
{ {
enum Language { enum Language {
NoLanguage = 0x0000, NoLanguage = 0x0000,
TargetLangCode = 0x0001, TargetLangCode = 0x0001,
NativeCode = 0x0002, NativeCode = 0x0002,
skipping to change at line 598 skipping to change at line 571
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,
TemplateArgumentType, TemplateArgumentType,
ThreadType, ThreadType,
BasicValueType, BasicValueType,
StringType, StringType,
ContainerType, ContainerType,
InterfaceType, InterfaceType,
ObjectType, ObjectType,
NamespaceType, NamespaceType,
VariantType, VariantType,
JObjectWrapperType, JObjectWrapperType,
CharType, CharType,
ArrayType, ArrayType,
TypeSystemType, TypeSystemType,
CustomType, CustomType,
TargetLangType TargetLangType,
FunctionType
}; };
enum CodeGeneration { enum CodeGeneration {
GenerateTargetLang = 0x0001, GenerateTargetLang = 0x0001,
GenerateCpp = 0x0002, GenerateCpp = 0x0002,
GenerateForSubclass = 0x0004, GenerateForSubclass = 0x0004,
GenerateNothing = 0, GenerateNothing = 0,
GenerateAll = 0xffff, GenerateAll = 0xffff,
GenerateCode = GenerateTargetLang | GenerateCpp GenerateCode = GenerateTargetLang | GenerateCpp
skipping to change at line 716 skipping to change at line 691
return m_type == CustomType; return m_type == CustomType;
} }
bool isBasicValue() const bool isBasicValue() const
{ {
return m_type == BasicValueType; return m_type == BasicValueType;
} }
bool isTypeSystem() const bool isTypeSystem() const
{ {
return m_type == TypeSystemType; return m_type == TypeSystemType;
} }
bool isFunction() const
{
return m_type == FunctionType;
}
bool isEnumValue() const
{
return m_type == EnumValue;
}
virtual bool preferredConversion() const virtual bool preferredConversion() const
{ {
return m_preferredConversion; return m_preferredConversion;
} }
virtual void setPreferredConversion(bool b) virtual void setPreferredConversion(bool b)
{ {
m_preferredConversion = b; m_preferredConversion = b;
} }
skipping to change at line 876 skipping to change at line 859
IncludeList extraIncludes() const IncludeList extraIncludes() const
{ {
return m_extraIncludes; return m_extraIncludes;
} }
void setExtraIncludes(const IncludeList &includes) void setExtraIncludes(const IncludeList &includes)
{ {
m_extraIncludes = includes; m_extraIncludes = includes;
} }
void addExtraInclude(const Include &include) void addExtraInclude(const Include &include)
{ {
if (!m_includesUsed.value(include.name, false)) { if (!m_includesUsed.value(include.name(), false)) {
m_extraIncludes << include; m_extraIncludes << include;
m_includesUsed[include.name] = true; m_includesUsed[include.name()] = true;
} }
} }
Include include() const Include include() const
{ {
return m_include; return m_include;
} }
void setInclude(const Include &inc) void setInclude(const Include &inc)
{ {
m_include = inc; m_include = inc;
skipping to change at line 1237 skipping to change at line 1220
QStringList m_rejectedEnums; QStringList m_rejectedEnums;
QList<EnumValueRedirection> m_enumRedirections; QList<EnumValueRedirection> m_enumRedirections;
FlagsTypeEntry *m_flags; FlagsTypeEntry *m_flags;
bool m_extensible; bool m_extensible;
bool m_forceInteger; bool m_forceInteger;
}; };
class APIEXTRACTOR_API EnumValueTypeEntry : public TypeEntry
{
public:
EnumValueTypeEntry(const QString& name, const QString& value, const Enu
mTypeEntry* enclosingEnum)
: TypeEntry(name, TypeEntry::EnumValue), m_value(value), m_enclosin
gEnum(enclosingEnum)
{
}
QString value() const { return m_value; }
const EnumTypeEntry* enclosingEnum() const { return m_enclosingEnum; }
private:
QString m_value;
const EnumTypeEntry* m_enclosingEnum;
};
class APIEXTRACTOR_API FlagsTypeEntry : public TypeEntry class APIEXTRACTOR_API FlagsTypeEntry : public TypeEntry
{ {
public: public:
FlagsTypeEntry(const QString &name) : TypeEntry(name, FlagsType), m_enu m(0) FlagsTypeEntry(const QString &name) : TypeEntry(name, FlagsType), m_enu m(0)
{ {
} }
QString qualifiedTargetLangName() const; QString qualifiedTargetLangName() const;
QString targetLangName() const QString targetLangName() const
{ {
skipping to change at line 1573 skipping to change at line 1571
ContainerTypeEntry(const QString &name, Type type) ContainerTypeEntry(const QString &name, Type type)
: ComplexTypeEntry(name, ContainerType), m_type(type) : ComplexTypeEntry(name, ContainerType), m_type(type)
{ {
setCodeGeneration(GenerateForSubclass); setCodeGeneration(GenerateForSubclass);
} }
Type type() const Type type() const
{ {
return m_type; return m_type;
} }
QString typeName() const;
QString targetLangName() const; QString targetLangName() const;
QString targetLangPackage() const; QString targetLangPackage() const;
QString qualifiedCppName() const; QString qualifiedCppName() const;
static Type containerTypeFromString(QString typeName) static Type containerTypeFromString(QString typeName)
{ {
static QHash<QString, Type> m_stringToContainerType; static QHash<QString, Type> m_stringToContainerType;
if (m_stringToContainerType.isEmpty()) { if (m_stringToContainerType.isEmpty()) {
m_stringToContainerType["list"] = ListContainer; m_stringToContainerType["list"] = ListContainer;
m_stringToContainerType["string-list"] = StringListContainer; m_stringToContainerType["string-list"] = StringListContainer;
skipping to change at line 1716 skipping to change at line 1716
} }
virtual QString qualifiedCppName() const virtual QString qualifiedCppName() const
{ {
return ComplexTypeEntry::qualifiedCppName().left(ComplexTypeEntry:: qualifiedCppName().length() - interfaceName("").length()); return ComplexTypeEntry::qualifiedCppName().left(ComplexTypeEntry:: qualifiedCppName().length() - interfaceName("").length());
} }
private: private:
ObjectTypeEntry *m_origin; ObjectTypeEntry *m_origin;
}; };
class APIEXTRACTOR_API FunctionTypeEntry : public TypeEntry
{
public:
FunctionTypeEntry(const QString& name, const QString& signature)
: TypeEntry(name, FunctionType)
{
addSignature(signature);
}
void addSignature(const QString& signature)
{
m_signatures << signature;
}
QStringList signatures() const
{
return m_signatures;
}
bool hasSignature(const QString& signature) const
{
return m_signatures.contains(signature);
}
private:
QStringList m_signatures;
};
class APIEXTRACTOR_API ObjectTypeEntry : public ComplexTypeEntry class APIEXTRACTOR_API ObjectTypeEntry : public ComplexTypeEntry
{ {
public: public:
ObjectTypeEntry(const QString &name) ObjectTypeEntry(const QString &name)
: ComplexTypeEntry(name, ObjectType), m_interface(0) {} : ComplexTypeEntry(name, ObjectType), m_interface(0) {}
InterfaceTypeEntry *designatedInterface() const InterfaceTypeEntry *designatedInterface() const
{ {
return m_interface; return m_interface;
} }
skipping to change at line 1748 skipping to change at line 1774
}; };
struct TypeRejection struct 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;
}; };
class APIEXTRACTOR_API TypeDatabase
{
TypeDatabase();
TypeDatabase(const TypeDatabase&);
TypeDatabase& operator=(const TypeDatabase&);
public:
/**
* Return the type system instance.
* \param newInstance This parameter is usefull just for unit testing, b
ecause singletons causes
* too many side effects on unit testing.
*/
static TypeDatabase *instance(bool newInstance = false);
static QString normalizedSignature(const char* signature);
QStringList requiredTargetImports()
{
return m_requiredTargetImports;
}
void addRequiredTargetImport(const QString &moduleName)
{
if (!m_requiredTargetImports.contains(moduleName))
m_requiredTargetImports << moduleName;
}
QStringList typesystemPaths()
{
return m_typesystemPaths;
}
void addTypesystemPath(const QString &typesystem_paths)
{
#if defined(Q_OS_WIN32)
char *path_splitter = const_cast<char *>(";");
#else
char *path_splitter = const_cast<char *>(":");
#endif
m_typesystemPaths += typesystem_paths.split(path_splitter);
}
IncludeList extraIncludes(const QString &className);
inline PrimitiveTypeEntry *findPrimitiveType(const QString &name);
inline ComplexTypeEntry *findComplexType(const QString &name);
inline ObjectTypeEntry *findObjectType(const QString &name);
inline NamespaceTypeEntry *findNamespaceType(const QString &name);
ContainerTypeEntry *findContainerType(const QString &name);
TypeEntry *findType(const QString &name) const
{
QList<TypeEntry *> entries = findTypes(name);
foreach (TypeEntry *entry, entries) {
if (entry &&
(!entry->isPrimitive() || static_cast<PrimitiveTypeEntry *>
(entry)->preferredTargetLangType())) {
return entry;
}
}
return 0;
}
QList<TypeEntry *> findTypes(const QString &name) const
{
return m_entries.value(name);
}
TypeEntryHash allEntries()
{
return m_entries;
}
SingleTypeEntryHash entries()
{
TypeEntryHash entries = allEntries();
SingleTypeEntryHash returned;
QList<QString> keys = entries.keys();
foreach (QString key, keys)
returned[key] = findType(key);
return returned;
}
PrimitiveTypeEntry *findTargetLangPrimitiveType(const QString &targetLa
ngName);
QList<const PrimitiveTypeEntry*> primitiveTypes() {
TypeEntryHash entries = allEntries();
QList<const PrimitiveTypeEntry*> returned;
foreach(QString key, entries.keys()) {
foreach(const TypeEntry* typeEntry, entries[key]) {
if (typeEntry->isPrimitive())
returned.append((PrimitiveTypeEntry*) typeEntry);
}
}
return returned;
}
QList<const ContainerTypeEntry*> containerTypes() {
TypeEntryHash entries = allEntries();
QList<const ContainerTypeEntry*> returned;
foreach(QString key, entries.keys()) {
foreach(const TypeEntry* typeEntry, entries[key]) {
if (typeEntry->isContainer())
returned.append((ContainerTypeEntry*) typeEntry);
}
}
return returned;
}
void addRejection(const QString &class_name, const QString &function_na
me,
const QString &field_name, const QString &enum_name);
bool isClassRejected(const QString &class_name);
bool isFunctionRejected(const QString &class_name, const QString &funct
ion_name);
bool isFieldRejected(const QString &class_name, const QString &field_na
me);
bool isEnumRejected(const QString &class_name, const QString &enum_name
);
void addType(TypeEntry *e)
{
m_entries[e->qualifiedCppName()].append(e);
}
SingleTypeEntryHash flagsEntries() const
{
return m_flagsEntries;
}
FlagsTypeEntry *findFlagsType(const QString &name) const;
void addFlagsType(FlagsTypeEntry *fte)
{
m_flagsEntries[fte->originalName()] = fte;
}
TemplateEntry *findTemplate(const QString &name)
{
return m_templates[name];
}
void addTemplate(TemplateEntry *t)
{
m_templates[t->name()] = t;
}
AddedFunctionList globalUserFunctions() const
{
return m_globalUserFunctions;
}
void addGlobalUserFunctions(const AddedFunctionList& functions)
{
m_globalUserFunctions << functions;
}
AddedFunctionList findGlobalUserFunctions(const QString& name) const;
void addGlobalUserFunctionModifications(const FunctionModificationList&
functionModifications)
{
m_functionMods << functionModifications;
}
void addGlobalUserFunctionModification(const FunctionModification& func
tionModification)
{
m_functionMods << functionModification;
}
FunctionModificationList functionModifications(const QString& signature
) const;
void setSuppressWarnings(bool on)
{
m_suppressWarnings = on;
}
void addSuppressedWarning(const QString &s)
{
m_suppressedWarnings.append(s);
}
bool isSuppressedWarning(const QString &s)
{
if (!m_suppressWarnings)
return false;
foreach (const QString &_warning, m_suppressedWarnings) {
QString warning(QString(_warning).replace("\\*", "&place_holder
_for_asterisk;"));
QStringList segs = warning.split("*", QString::SkipEmptyParts);
if (!segs.size())
continue;
int i = 0;
int pos = s.indexOf(QString(segs.at(i++)).replace("&place_holde
r_for_asterisk;", "*"));
//qDebug() << "s == " << s << ", warning == " << segs;
while (pos != -1) {
if (i == segs.size())
return true;
pos = s.indexOf(QString(segs.at(i++)).replace("&place_holde
r_for_asterisk;", "*"), pos);
}
}
return false;
}
void setRebuildClasses(const QStringList &cls)
{
m_rebuildClasses = cls;
}
static QString globalNamespaceClassName(const TypeEntry *te);
QString filename() const
{
return "typesystem.txt";
}
QString modifiedTypesystemFilepath(const QString &ts_file);
bool parseFile(const QString &filename, bool generate = true);
bool parseFile(QIODevice* device, bool generate = true);
private:
bool m_suppressWarnings;
TypeEntryHash m_entries;
SingleTypeEntryHash m_flagsEntries;
TemplateEntryHash m_templates;
QStringList m_suppressedWarnings;
AddedFunctionList m_globalUserFunctions;
FunctionModificationList m_functionMods;
QStringList m_requiredTargetImports;
QStringList m_typesystemPaths;
QHash<QString, bool> m_parsedTypesystemFiles;
QList<TypeRejection> m_rejections;
QStringList m_rebuildClasses;
};
inline PrimitiveTypeEntry *TypeDatabase::findPrimitiveType(const QString &n
ame)
{
QList<TypeEntry *> entries = findTypes(name);
foreach (TypeEntry *entry, entries) {
if (entry && entry->isPrimitive() && static_cast<PrimitiveTypeEntry
*>(entry)->preferredTargetLangType())
return static_cast<PrimitiveTypeEntry *>(entry);
}
return 0;
}
inline ComplexTypeEntry *TypeDatabase::findComplexType(const QString &name)
{
TypeEntry *entry = findType(name);
if (entry && entry->isComplex())
return static_cast<ComplexTypeEntry *>(entry);
else
return 0;
}
inline ObjectTypeEntry *TypeDatabase::findObjectType(const QString &name)
{
TypeEntry *entry = findType(name);
if (entry && entry->isObject())
return static_cast<ObjectTypeEntry *>(entry);
else
return 0;
}
inline NamespaceTypeEntry *TypeDatabase::findNamespaceType(const QString &n
ame)
{
TypeEntry *entry = findType(name);
if (entry && entry->isNamespace())
return static_cast<NamespaceTypeEntry *>(entry);
else
return 0;
}
QString fixCppTypeName(const QString &name); QString fixCppTypeName(const QString &name);
#endif // TYPESYSTEM_H #endif // TYPESYSTEM_H
 End of changes. 11 change blocks. 
312 lines changed or deleted 59 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/