# HG changeset patch # User Santeri Piippo # Date 1376836713 -10800 # Node ID 51cca3ce540dbd52e1ea64f67971881c2b1f6e36 # Parent cb360f4d89791cd70410ef13ff440f5da8d623e9 Use QFlags for the inlining flags, type-safety++ diff -r cb360f4d8979 -r 51cca3ce540d src/file.cpp --- a/src/file.cpp Sun Aug 18 17:30:58 2013 +0300 +++ b/src/file.cpp Sun Aug 18 17:38:33 2013 +0300 @@ -975,7 +975,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -List LDFile::inlineContents (int flags) { +List LDFile::inlineContents (LDSubfileObject::InlineFlags flags) { // Possibly substitute with logoed studs: // stud.dat -> stud-logo.dat // stud2.dat -> stud-logo2.dat diff -r cb360f4d8979 -r 51cca3ce540d src/file.h --- a/src/file.h Sun Aug 18 17:30:58 2013 +0300 +++ b/src/file.h Sun Aug 18 17:38:33 2013 +0300 @@ -130,7 +130,7 @@ static void closeInitialFile(); static int countExplicitFiles(); str getShortName(); - List inlineContents (int flags); + List inlineContents (LDSubfileObject::InlineFlags flags); private: static LDFile* m_curfile; diff -r cb360f4d8979 -r 51cca3ce540d src/ldtypes.cpp --- a/src/ldtypes.cpp Sun Aug 18 17:30:58 2013 +0300 +++ b/src/ldtypes.cpp Sun Aug 18 17:38:33 2013 +0300 @@ -298,7 +298,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -List LDSubfileObject::inlineContents (int flags) { +List LDSubfileObject::inlineContents (InlineFlags flags) { List objs = fileInfo()->inlineContents (flags); // Transform the objects diff -r cb360f4d8979 -r 51cca3ce540d src/ldtypes.h --- a/src/ldtypes.h Sun Aug 18 17:30:58 2013 +0300 +++ b/src/ldtypes.h Sun Aug 18 17:38:33 2013 +0300 @@ -281,11 +281,7 @@ PROPERTY (LDFile*, fileInfo, setFileInfo) public: - LDSubfileObject() { - setLinkPointer (this); - } - - enum InlineFlags { + enum InlineFlag { DeepInline = (1 << 0), CacheInline = (1 << 1), RendererInline = (1 << 2), @@ -293,11 +289,19 @@ DeepCacheInline = DeepInline | CacheInline, }; + Q_DECLARE_FLAGS (InlineFlags, InlineFlag) + + LDSubfileObject() { + setLinkPointer (this); + } + // Inlines this subfile. Note that return type is an array of heap-allocated // LDObject-clones, they must be deleted one way or another. - List inlineContents (int flags); + List inlineContents (InlineFlags flags); }; +Q_DECLARE_OPERATORS_FOR_FLAGS (LDSubfileObject::InlineFlags) + // ============================================================================= // LDLineObject //