Sun, 18 Aug 2013 17:38:33 +0300
Use QFlags for the inlining flags, type-safety++
src/file.cpp | file | annotate | diff | comparison | revisions | |
src/file.h | file | annotate | diff | comparison | revisions | |
src/ldtypes.cpp | file | annotate | diff | comparison | revisions | |
src/ldtypes.h | file | annotate | diff | comparison | revisions |
--- 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<LDObject*> LDFile::inlineContents (int flags) { +List<LDObject*> LDFile::inlineContents (LDSubfileObject::InlineFlags flags) { // Possibly substitute with logoed studs: // stud.dat -> stud-logo.dat // stud2.dat -> stud-logo2.dat
--- 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<LDObject*> inlineContents (int flags); + List<LDObject*> inlineContents (LDSubfileObject::InlineFlags flags); private: static LDFile* m_curfile;
--- 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<LDObject*> LDSubfileObject::inlineContents (int flags) { +List<LDObject*> LDSubfileObject::inlineContents (InlineFlags flags) { List<LDObject*> objs = fileInfo()->inlineContents (flags); // Transform the objects
--- 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<LDObject*> inlineContents (int flags); + List<LDObject*> inlineContents (InlineFlags flags); }; +Q_DECLARE_OPERATORS_FOR_FLAGS (LDSubfileObject::InlineFlags) + // ============================================================================= // LDLineObject //