# HG changeset patch # User Santeri Piippo # Date 1375159088 -10800 # Node ID ec95fc95e5f38f3026185cd86e072cdb757ae229 # Parent 89a9235b47d3b273284307b3fd6963c6332d34ba Renamed vector to List, changed it to wrap around std::deque. diff -r 89a9235b47d3 -r ec95fc95e5f3 src/addObjectDialog.cpp --- a/src/addObjectDialog.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/addObjectDialog.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -314,7 +314,7 @@ matrix transform = g_identity; if( type == LDObject::Subfile ) { - vector matrixstrvals = container_cast> (str (dlg.le_matrix->text ()).split (" ")); + List matrixstrvals = container_cast> (str (dlg.le_matrix->text ()).split (" ")); if (matrixstrvals.size () == 9) { double matrixvals[9]; diff -r 89a9235b47d3 -r ec95fc95e5f3 src/common.h --- a/src/common.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/common.h Tue Jul 30 07:38:08 2013 +0300 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff -r 89a9235b47d3 -r ec95fc95e5f3 src/configDialog.cpp --- a/src/configDialog.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/configDialog.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -429,7 +429,7 @@ } // ============================================================================= -int ConfigDialog::getItemRow (QListWidgetItem* item, vector& haystack) { +int ConfigDialog::getItemRow (QListWidgetItem* item, List& haystack) { int i = 0; for (QListWidgetItem* it : haystack) { diff -r 89a9235b47d3 -r ec95fc95e5f3 src/configDialog.h --- a/src/configDialog.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/configDialog.h Tue Jul 30 07:38:08 2013 +0300 @@ -49,14 +49,14 @@ const Ui_ConfigUI* getUI() const; float getGridValue (int i, int j) const; - vector quickColors; + List quickColors; QDoubleSpinBox* dsb_gridData[3][4]; private: Ui_ConfigUI* ui; QLabel* lb_gridLabels[3]; QLabel* lb_gridIcons[3]; - vector quickColorItems; + List quickColorItems; void initMainTab(); void initShortcutsTab(); @@ -68,7 +68,7 @@ void pickColor( strconfig& cfg, QPushButton* button ); void updateQuickColorList( LDQuickColor* sel = null ); void setShortcutText (ShortcutListItem* item); - int getItemRow( QListWidgetItem* item, vector& haystack ); + int getItemRow( QListWidgetItem* item, List& haystack ); str quickColorString(); QListWidgetItem* getSelectedQuickColor(); QList getShortcutSelection(); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/dialogs.h --- a/src/dialogs.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/dialogs.h Tue Jul 30 07:38:08 2013 +0300 @@ -56,7 +56,7 @@ private: Ui_OverlayUI* ui; - vector> m_cameraArgs; + List> m_cameraArgs; private slots: void slot_fpath(); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/extprogs.cpp --- a/src/extprogs.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/extprogs.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -130,10 +130,10 @@ } // ============================================================================= -void writeObjects (vector& objects, File& f) { +void writeObjects (List& objects, File& f) { for (LDObject* obj : objects) { if (obj->getType() == LDObject::Subfile) { - vector objs = static_cast (obj)->inlineContents (true, false); + List objs = static_cast (obj)->inlineContents (true, false); writeObjects (objs, f); @@ -144,7 +144,7 @@ } } -void writeObjects (vector& objects, str fname) { +void writeObjects (List& objects, str fname) { // Write the input file File f (fname, File::Write); @@ -164,7 +164,7 @@ // ============================================================================= void writeColorGroup (const short colnum, str fname) { - vector objects; + List objects; for (LDObject* obj : *LDOpenFile::current()) { if (obj->isColored() == false || obj->color() != colnum) @@ -232,7 +232,7 @@ } // ================================================================================================ -static void insertOutput (str fname, bool replace, vector colorsToReplace) { +static void insertOutput (str fname, bool replace, List colorsToReplace) { #ifndef RELEASE QFile::copy (fname, "./debug_lastOutput"); #endif // RELEASE @@ -245,7 +245,7 @@ return; } - vector objs = loadFileContents (&f, null); + List objs = loadFileContents (&f, null); // If we replace the objects, delete the selection now. if (replace) diff -r 89a9235b47d3 -r ec95fc95e5f3 src/file.cpp --- a/src/file.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/file.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -304,9 +304,9 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector loadFileContents (File* f, ulong* numWarnings, bool* ok) { - vector lines; - vector objs; +List loadFileContents (File* f, ulong* numWarnings, bool* ok) { + List lines; + List objs; if (numWarnings) *numWarnings = 0; @@ -362,7 +362,7 @@ ulong numWarnings; bool ok; - vector objs = loadFileContents (f, &numWarnings, &ok); + List objs = loadFileContents (f, &numWarnings, &ok); if (!ok) return null; @@ -438,7 +438,7 @@ // ============================================================================= void closeAll() { // Remove all loaded files and the objects they contain - vector files = g_loadedFiles; + List files = g_loadedFiles; for( LDOpenFile* file : files ) delete file; } @@ -867,8 +867,8 @@ m_objs[idx] = obj; } -static vector getFilesUsed (LDOpenFile* node) { - vector filesUsed; +static List getFilesUsed (LDOpenFile* node) { + List filesUsed; for (LDObject* obj : *node) { if (obj->getType() != LDObject::Subfile) @@ -885,7 +885,7 @@ // ============================================================================= // Find out which files are unused and close them. void LDOpenFile::closeUnused () { - vector filesUsed = getFilesUsed (LDOpenFile::current()); + List filesUsed = getFilesUsed (LDOpenFile::current()); // Anything that's explicitly opened must not be closed for (LDOpenFile* file : g_loadedFiles) @@ -929,7 +929,7 @@ return m_objs.size(); } -LDOpenFile& LDOpenFile::operator<< (vector objs) { +LDOpenFile& LDOpenFile::operator<< (List objs) { for (LDObject* obj : objs) addObject (obj); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/file.h --- a/src/file.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/file.h Tue Jul 30 07:38:08 2013 +0300 @@ -50,18 +50,18 @@ // ============================================================================= class LDOpenFile : public QObject { Q_OBJECT - READ_PROPERTY (vector, objs, setObjects) + READ_PROPERTY (List, objs, setObjects) READ_PROPERTY (History, history, setHistory) - READ_PROPERTY (vector, vertices, setVertices) + READ_PROPERTY (List, vertices, setVertices) PROPERTY (str, name, setName) PROPERTY (bool, implicit, setImplicit) - PROPERTY (vector, cache, setCache) + PROPERTY (List, cache, setCache) PROPERTY (long, savePos, setSavePos) DECLARE_PROPERTY (QListWidgetItem*, listItem, setListItem) public: - typedef vector::it it; - typedef vector::c_it c_it; + typedef List::it it; + typedef List::c_it c_it; LDOpenFile(); ~LDOpenFile(); @@ -82,7 +82,7 @@ return *this; } - LDOpenFile& operator<< (vector objs); + LDOpenFile& operator<< (List objs); it begin() { return PROP_NAME (objs).begin(); @@ -164,15 +164,15 @@ // Is it safe to close all files? bool safeToCloseAll(); -vector loadFileContents (File* f, ulong* numWarnings, bool* ok = null); +List loadFileContents (File* f, ulong* numWarnings, bool* ok = null); -extern vector g_loadedFiles; +extern List g_loadedFiles; void addRecentFile (str path); str basename (str path); str dirname (str path); -extern vector g_loadedFiles; // Vector of all currently opened files. +extern List g_loadedFiles; // Vector of all currently opened files. // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -184,11 +184,11 @@ // ============================================================================= class FileLoader : public QObject { Q_OBJECT - READ_PROPERTY (vector, objs, setObjects) + READ_PROPERTY (List, objs, setObjects) READ_PROPERTY (bool, done, setDone) READ_PROPERTY (ulong, progress, setProgress) READ_PROPERTY (bool, aborted, setAborted) - PROPERTY (vector, lines, setLines) + PROPERTY (List, lines, setLines) PROPERTY (ulong*, warningsPointer, setWarningsPointer) PROPERTY (bool, concurrent, setConcurrent) diff -r 89a9235b47d3 -r ec95fc95e5f3 src/gldraw.cpp --- a/src/gldraw.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/gldraw.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -222,7 +222,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -static vector g_warnedColors; +static List g_warnedColors; void GLRenderer::setObjectColor (LDObject* obj, const ListType list) { QColor qcol; @@ -762,7 +762,7 @@ case LDObject::Subfile: { LDSubfileObject* ref = static_cast (obj); - vector objs = ref->inlineContents (true, true); + List objs = ref->inlineContents (true, true); bool oldinvert = g_glInvert; @@ -1067,7 +1067,7 @@ // Clear the selection if we do not wish to add to it. if (!m_addpick) { - vector oldsel = g_win->sel(); + List oldsel = g_win->sel(); g_win->sel().clear(); for (LDObject* obj : oldsel) { @@ -1245,7 +1245,7 @@ (void) accept; // Clean the selection and create the object - vector& verts = m_drawedVerts; + List& verts = m_drawedVerts; LDObject* obj = null; if (m_rectdraw) { @@ -1299,14 +1299,14 @@ m_rectdraw = false; } -static vector getVertices (LDObject* obj) { - vector verts; +static List getVertices (LDObject* obj) { + List verts; if (obj->vertices() >= 2) { for (int i = 0; i < obj->vertices(); ++i) verts << obj->getVertex (i); } elif (obj->getType() == LDObject::Subfile) { - vector objs = static_cast (obj)->inlineContents (true, true); + List objs = static_cast (obj)->inlineContents (true, true); for(LDObject* obj : objs) { verts << getVertices (obj); @@ -1337,7 +1337,7 @@ } // Mark in known vertices of this object - vector verts = getVertices (obj); + List verts = getVertices (obj); m_knownVerts << verts; m_knownVerts.makeUnique(); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/gldraw.h --- a/src/gldraw.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/gldraw.h Tue Jul 30 07:38:08 2013 +0300 @@ -133,13 +133,13 @@ Camera m_camera, m_toolTipCamera; uint m_axeslist; ushort m_width, m_height; - vector m_drawedVerts; + List m_drawedVerts; bool m_rectdraw; vertex m_rectverts[4]; QColor m_bgcolor; double m_depthValues[6]; overlayMeta m_overlays[6]; - vector m_knownVerts; + List m_knownVerts; bool m_panning; void addDrawnVertex (vertex m_hoverpos); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/gui.cpp --- a/src/gui.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/gui.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -151,7 +151,7 @@ delete recent; m_recentFiles.clear(); - vector files = container_cast> (io_recentfiles.value.split ("@")); + List files = container_cast> (io_recentfiles.value.split ("@")); for (str file : c_rev (files)) { QAction* recent = new QAction (getIcon ("open-recent"), file, this); @@ -164,8 +164,8 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector quickColorsFromConfig() { - vector colors; +List quickColorsFromConfig() { + List colors; for (str colorname : gui_colortoolbar.value.split (":")) { if (colorname == "|") { @@ -253,7 +253,7 @@ if( m_sel.size() == 0 ) return 0; - vector selCopy = m_sel; + List selCopy = m_sel; int num = 0; // Delete the objects that were being selected @@ -406,7 +406,7 @@ if (m_renderer->picking()) return; - vector priorSelection = m_sel; + List priorSelection = m_sel; // Get the objects from the object list selection m_sel.clear(); @@ -622,7 +622,7 @@ } // ============================================================================= -void ForgeWindow::deleteObjVector (vector objs) { +void ForgeWindow::deleteObjVector (List objs) { for (LDObject* obj : objs) { LDOpenFile::current()->forgetObject (obj); delete obj; @@ -631,7 +631,7 @@ // ============================================================================= void ForgeWindow::deleteByColor (const short colnum) { - vector objs; + List objs; for (LDObject* obj : LDOpenFile::current()->objs()) { if (!obj->isColored() || obj->color() != colnum) continue; diff -r 89a9235b47d3 -r ec95fc95e5f3 src/gui.h --- a/src/gui.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/gui.h Tue Jul 30 07:38:08 2013 +0300 @@ -105,13 +105,13 @@ LDObject::Type uniformSelectedType(); void scrollToSelection(); void spawnContextMenu (const QPoint pos); - void deleteObjVector (vector< LDObject* > objs); + void deleteObjVector (List< LDObject* > objs); int deleteSelection(); void deleteByColor (const short int colnum); void save (LDOpenFile* f, bool saveAs); GLRenderer* R() { return m_renderer; } - vector& sel() { return m_sel; } - void setQuickColors (vector& colors) { m_quickColors = colors; } + List& sel() { return m_sel; } + void setQuickColors (List& colors) { m_quickColors = colors; } void setStatusBarText (str text); void addMessage (str msg); Ui_LDForgeUI* interface() const; @@ -137,10 +137,10 @@ GLRenderer* m_renderer; QProgressBar* m_primLoaderBar; QWidget* m_primLoaderWidget; - vector m_sel; - vector m_quickColors; - vector m_colorButtons; - vector m_recentFiles; + List m_sel; + List m_quickColors; + List m_colorButtons; + List m_recentFiles; MessageManager* m_msglog; Ui_LDForgeUI* ui; @@ -166,7 +166,7 @@ // ----------------------------------------------------------------------------- // Other GUI-related stuff not directly part of ForgeWindow: QPixmap getIcon (str iconName); // Get an icon from the resource dir -vector quickColorsFromConfig(); // Make a list of quick colors based on config +List quickColorsFromConfig(); // Make a list of quick colors based on config bool confirm (str title, str msg); // Generic confirm prompt bool confirm (str msg); // Generic confirm prompt void critical (str msg); // Generic error prompt @@ -179,7 +179,7 @@ // Takes in pairs of radio buttons and respective values and returns the value of // the first found radio button that was checked. // ============================================================================= -template T radioSwitch (const T& defval, vector> haystack) { +template T radioSwitch (const T& defval, List> haystack) { for (pair i : haystack) if (i.first->isChecked()) return i.second; @@ -192,7 +192,7 @@ // Takes in pairs of radio buttons and respective values and checks the first // found radio button to have the given value. // ============================================================================= -template void radioDefault (const T& expr, vector> haystack) { +template void radioDefault (const T& expr, List> haystack) { for (pair i : haystack) { if (i.second == expr) { i.first->setChecked (true); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/gui_actions.cpp --- a/src/gui_actions.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/gui_actions.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -324,7 +324,7 @@ return; } - vector objs = loadFileContents (&f, null); + List objs = loadFileContents (&f, null); g_win->sel().clear(); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/gui_editactions.cpp --- a/src/gui_editactions.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/gui_editactions.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -40,7 +40,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static int copyToClipboard() { - vector objs = g_win->sel(); + List objs = g_win->sel(); int num = 0; // Clear the clipboard first. @@ -112,7 +112,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doInline (bool deep) { - vector sel = g_win->sel(); + List sel = g_win->sel(); for (LDObject* obj : sel) { // Get the index of the subfile so we know where to insert the @@ -122,7 +122,7 @@ if (idx == -1) continue; - vector objs; + List objs; if (obj->getType() == LDObject::Subfile) objs = static_cast (obj)->inlineContents (deep, true); @@ -159,7 +159,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // =============================================================================================== DEFINE_ACTION (SplitQuads, 0) { - vector objs = g_win->sel(); + List objs = g_win->sel(); int num = 0; for (LDObject* obj : objs) { @@ -172,7 +172,7 @@ if (index == -1) return; - vector triangles = static_cast (obj)->splitToTriangles(); + List triangles = static_cast (obj)->splitToTriangles(); // Replace the quad with the first triangle and add the second triangle // after the first one. @@ -234,7 +234,7 @@ short colnum; short defcol = -1; - vector objs = g_win->sel(); + List objs = g_win->sel(); // If all selected objects have the same color, said color is our default // value to the color selection dialog. @@ -258,7 +258,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= DEFINE_ACTION (Borders, CTRL_SHIFT (B)) { - vector objs = g_win->sel(); + List objs = g_win->sel(); int num = 0; for (LDObject* obj : objs) { @@ -331,7 +331,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doMoveSelection (const bool up) { - vector objs = g_win->sel(); + List objs = g_win->sel(); LDObject::moveObjects (objs, up); g_win->buildObjList(); } @@ -398,7 +398,7 @@ // ============================================================================= DEFINE_ACTION (Invert, CTRL_SHIFT (W)) { - vector sel = g_win->sel(); + List sel = g_win->sel(); for (LDObject* obj : sel) { obj->invert(); @@ -416,8 +416,8 @@ } static void doRotate (const short l, const short m, const short n) { - vector sel = g_win->sel(); - vector queue; + List sel = g_win->sel(); + List queue; const vertex rotpoint = rotPoint (sel); const double angle = (pi * currentGrid().confs[Grid::Angle]->value) / 180; @@ -540,7 +540,7 @@ const bool any = ui.any->isChecked(), rel = ui.relative->isChecked(); - vector sel; + List sel; int num = 0; if (ui.x->isChecked()) sel << X; @@ -579,7 +579,7 @@ if (!dlg->exec()) return; - vector sel; + List sel; if (ui.x->isChecked()) sel << X; if (ui.y->isChecked()) sel << Y; if (ui.z->isChecked()) sel << Z; @@ -600,7 +600,7 @@ // ================================================================================================ DEFINE_ACTION (Demote, 0) { - vector sel = g_win->sel(); + List sel = g_win->sel(); int num = 0; for (LDObject* obj : sel) { diff -r 89a9235b47d3 -r ec95fc95e5f3 src/history.cpp --- a/src/history.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/history.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -73,7 +73,7 @@ } void History::clear() { - for (vector set : m_changesets) + for (List set : m_changesets) for (AbstractHistoryEntry * change : set) delete change; diff -r 89a9235b47d3 -r ec95fc95e5f3 src/history.h --- a/src/history.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/history.h Tue Jul 30 07:38:08 2013 +0300 @@ -37,7 +37,7 @@ READ_PROPERTY (bool, opened, setOpened) public: - typedef vector list; + typedef List list; enum Type { Del, @@ -69,7 +69,7 @@ private: list m_currentArchive; - vector m_changesets; + List m_changesets; }; // ============================================================================= @@ -149,10 +149,10 @@ public: IMPLEMENT_HISTORY_TYPE (Move) - vector indices; + List indices; vertex dest; - MoveHistory (vector indices, vertex dest) : + MoveHistory (List indices, vertex dest) : indices (indices), dest (dest) {} }; diff -r 89a9235b47d3 -r ec95fc95e5f3 src/ldtypes.cpp --- a/src/ldtypes.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/ldtypes.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -26,7 +26,7 @@ #include "colors.h" // List of all LDObjects -vector g_LDObjects; +List g_LDObjects; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -168,7 +168,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector LDQuadObject::splitToTriangles() { +List LDQuadObject::splitToTriangles() { // Create the two triangles based on this quadrilateral: // 0---3 0---3 3 // | | | / /| @@ -182,7 +182,7 @@ tri1->setColor (color()); tri2->setColor (color()); - vector triangles; + List triangles; triangles << tri1; triangles << tri2; return triangles; @@ -277,8 +277,8 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector LDSubfileObject::inlineContents (bool deep, bool cache) { - vector objs, objcache; +List LDSubfileObject::inlineContents (bool deep, bool cache) { + List objs, objcache; // If we have this cached, just clone that if (deep && fileInfo()->cache().size()) { @@ -299,7 +299,7 @@ if (deep && obj->getType() == LDObject::Subfile) { LDSubfileObject* ref = static_cast (obj); - vector otherobjs = ref->inlineContents (true, false); + List otherobjs = ref->inlineContents (true, false); for (LDObject* otherobj : otherobjs) { // Cache this object, if desired @@ -348,12 +348,12 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -void LDObject::moveObjects (vector objs, const bool up) { +void LDObject::moveObjects (List objs, const bool up) { // If we move down, we need to iterate the array in reverse order. const long start = up ? 0 : (objs.size() - 1); const long end = up ? objs.size() : -1; const long incr = up ? 1 : -1; - vector objsToCompile; + List objsToCompile; for (long i = start; i != end; i += incr) { LDObject* obj = objs[i]; @@ -393,7 +393,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -str LDObject::objectListContents (const vector& objs) { +str LDObject::objectListContents (const List& objs) { bool firstDetails = true; str text = ""; diff -r 89a9235b47d3 -r ec95fc95e5f3 src/ldtypes.h --- a/src/ldtypes.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/ldtypes.h Tue Jul 30 07:38:08 2013 +0300 @@ -98,7 +98,7 @@ virtual void invert(); // Inverts this object (winding is reversed) virtual bool isColored() const; // Is this object colored? virtual bool isScemantic() const; // Does this object have meaning in the part model? - virtual void move (vertex vect); // Moves this object using the given vertex as a movement vector + virtual void move (vertex vect); // Moves this object using the given vertex as a movement List LDObject* next() const; // Object after this in the current file LDObject* prev() const; // Object prior to this in the current file virtual str raw() { return ""; } // This object as LDraw code @@ -112,8 +112,8 @@ static str typeName (LDObject::Type type); // Get type name by enumerator static LDObject* getDefault (const LDObject::Type type); // Returns a sample object by the given enumerator - static void moveObjects (vector objs, const bool up); // TODO: move this to LDOpenFile? - static str objectListContents (const vector& objs); // Get a description of a list of LDObjects + static void moveObjects (List objs, const bool up); // TODO: move this to LDOpenFile? + static str objectListContents (const List& objs); // Get a description of a list of LDObjects static LDObject* fromID (int id); // TODO: make these private! @@ -282,7 +282,7 @@ // Inlines this subfile. Note that return type is an array of heap-allocated // LDObject-clones, they must be deleted one way or another. - vector inlineContents (bool deep, bool cache); + List inlineContents (bool deep, bool cache); }; // ============================================================================= @@ -366,7 +366,7 @@ LDQuadObject() {} // Split this quad into two triangles (note: heap-allocated) - vector splitToTriangles(); + List splitToTriangles(); }; // ============================================================================= diff -r 89a9235b47d3 -r ec95fc95e5f3 src/main.cpp --- a/src/main.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/main.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -29,7 +29,7 @@ #include "types.h" #include "primitives.h" -vector g_loadedFiles; +List g_loadedFiles; ForgeWindow* g_win = null; const QApplication* g_app = null; File g_file_stdout (stdout, File::Write); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/messagelog.h --- a/src/messagelog.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/messagelog.h Tue Jul 30 07:38:08 2013 +0300 @@ -43,8 +43,8 @@ QDateTime expiry; }; - typedef vector::it it; - typedef vector::c_it c_it; + typedef List::it it; + typedef List::c_it c_it; explicit MessageManager( QObject* parent = 0 ); void addLine( str line ); @@ -54,7 +54,7 @@ MessageManager& operator<<( str line ); private: - vector m_lines; + List m_lines; QTimer* m_ticker; private slots: diff -r 89a9235b47d3 -r ec95fc95e5f3 src/misc.cpp --- a/src/misc.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/misc.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -205,7 +205,7 @@ } // ============================================================================= -vertex rotPoint( const vector& objs ) +vertex rotPoint( const List& objs ) { LDBoundingBox box; @@ -302,7 +302,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= StringParser::StringParser (str inText, char sep) { - m_tokens = container_cast> (inText.split (sep, QString::SkipEmptyParts)); + m_tokens = container_cast> (inText.split (sep, QString::SkipEmptyParts)); m_pos = -1; } diff -r 89a9235b47d3 -r ec95fc95e5f3 src/misc.h --- a/src/misc.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/misc.h Tue Jul 30 07:38:08 2013 +0300 @@ -66,7 +66,7 @@ CustomPoint }; -vertex rotPoint (const vector& objs); +vertex rotPoint (const List& objs); void configRotationPoint (); template R container_cast (const T& a) { @@ -128,7 +128,7 @@ } private: - vector m_tokens; + List m_tokens; short m_pos; }; diff -r 89a9235b47d3 -r ec95fc95e5f3 src/primitives.cpp --- a/src/primitives.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/primitives.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -27,10 +27,10 @@ #include "misc.h" #include "colors.h" -vector g_PrimitiveCategories; +List g_PrimitiveCategories; static PrimitiveLister* g_activePrimLister = null; static bool g_primListerMutex = false; -vector g_primitives; +List g_primitives; static const str g_Other = QObject::tr ("Other"); @@ -71,7 +71,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -static void recursiveGetFilenames (QDir dir, vector& fnames) { +static void recursiveGetFilenames (QDir dir, List& fnames) { QFileInfoList flist = dir.entryInfoList(); for (const QFileInfo & info : flist) { @@ -95,7 +95,7 @@ QDir dir (LDPaths::prims()); ulong baselen = dir.absolutePath().length(); ulong i = 0; - vector fnames; + List fnames; assert (dir.exists()); recursiveGetFilenames (dir, fnames); @@ -183,6 +183,7 @@ for (Primitive& prim : g_primitives) { bool matched = false; + prim.cat = null; // Go over the categories and their regexes, if and when there's a match, // the primitive's category is set to the category the regex beloings to. @@ -291,9 +292,9 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector makePrimitive (PrimitiveType type, int segs, int divs, int num) { - vector objs; - vector condLineSegs; +List makePrimitive (PrimitiveType type, int segs, int divs, int num) { + List objs; + List condLineSegs; for (int i = 0; i < segs; ++i) { double x0 = radialPoint (i, divs, cos), diff -r 89a9235b47d3 -r ec95fc95e5f3 src/primitives.h --- a/src/primitives.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/primitives.h Tue Jul 30 07:38:08 2013 +0300 @@ -43,12 +43,12 @@ Type type; }; - typedef vector::it it; - typedef vector::c_it c_it; + typedef List::it it; + typedef List::c_it c_it; - vector regexes; - vector prims; - static vector uncat; + List regexes; + List prims; + static List uncat; }; // ============================================================================= @@ -74,10 +74,10 @@ void update (ulong i); private: - vector m_prims; + List m_prims; }; -extern vector g_PrimitiveCategories; +extern List g_PrimitiveCategories; void loadPrimitives (); bool primitiveLoaderBusy (); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/types.cpp --- a/src/types.cpp Tue Jul 30 07:16:48 2013 +0300 +++ b/src/types.cpp Tue Jul 30 07:38:08 2013 +0300 @@ -27,7 +27,7 @@ #include "ldtypes.h" #include "file.h" -str DoFormat( vector args ) +str DoFormat( List args ) { assert( args.size() >= 1 ); str text = args[0].value(); @@ -521,7 +521,7 @@ case LDObject::Subfile: { LDSubfileObject* ref = static_cast (obj); - vector objs = ref->inlineContents (true, true); + List objs = ref->inlineContents (true, true); for (LDObject* obj : objs) { calcObject (obj); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/types.h --- a/src/types.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/types.h Tue Jul 30 07:38:08 2013 +0300 @@ -21,15 +21,15 @@ #include #include -#include +#include #include "common.h" class LDObject; typedef QChar qchar; typedef QString str; -template class ConstVectorReverser; -template using c_rev = ConstVectorReverser; +template class ConstListReverser; +template using c_rev = ConstListReverser; class strconfig; class intconfig; class floatconfig; @@ -134,19 +134,19 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -// vector +// List // -// Array class that wraps around std::vector +// Array class that wraps around std::deque // ============================================================================= -template class vector { +template class List { public: - typedef typename std::vector::iterator it; - typedef typename std::vector::const_iterator c_it; - typedef typename std::vector::reverse_iterator r_it; - typedef typename std::vector::const_reverse_iterator cr_it; + typedef typename std::deque::iterator it; + typedef typename std::deque::const_iterator c_it; + typedef typename std::deque::reverse_iterator r_it; + typedef typename std::deque::const_reverse_iterator cr_it; - vector () {} - vector (initlist vals) { + List () {} + List (initlist vals) { m_vect = vals; } @@ -192,7 +192,7 @@ return m_vect[m_vect.size () - 1]; } - void push_back (const vector& vals) { + void push_back (const List& vals) { for (const T& val : vals) push_back (val); } @@ -210,7 +210,7 @@ return push_back (value); } - void operator<< (const vector& vals) { + void operator<< (const List& vals) { push_back (vals); } @@ -218,8 +218,8 @@ return pop (value); } - vector reverse () const { - vector rev; + List reverse () const { + List rev; for (const T& val : c_rev (*this)) rev << val; @@ -236,7 +236,7 @@ } void makeUnique () { - // Remove duplicate entries. For this to be effective, the vector must be + // Remove duplicate entries. For this to be effective, the List must be // sorted first. sort (); it pos = std::unique (begin (), end ()); @@ -278,21 +278,21 @@ } private: - std::vector m_vect; + std::deque m_vect; }; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -// VectorReverser (aka rev) +// ListReverser (aka rev) // -// Helper class used to reverse-iterate vectors in range-for-loops. +// Helper class used to reverse-iterate Lists in range-for-loops. // ============================================================================= -template class VectorReverser { +template class ListReverser { public: - typedef typename vector::r_it it; + typedef typename List::r_it it; - VectorReverser (vector& vect) { + ListReverser (List& vect) { m_vect = &vect; } @@ -305,21 +305,21 @@ } private: - vector* m_vect; + List* m_vect; }; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -// ConstVectorReverser (aka c_rev) +// ConstListReverser (aka c_rev) // -// Like VectorReverser, except works on const vectors. +// Like ListReverser, except works on const Lists. // ============================================================================= -template class ConstVectorReverser { +template class ConstListReverser { public: - typedef typename vector::cr_it it; + typedef typename List::cr_it it; - ConstVectorReverser (const vector& vect) { + ConstListReverser (const List& vect) { m_vect = &vect; } @@ -332,11 +332,11 @@ } private: - const vector* m_vect; + const List* m_vect; }; -template using rev = VectorReverser; -template using c_rev = ConstVectorReverser; +template using rev = ListReverser; +template using c_rev = ConstListReverser; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -377,7 +377,7 @@ StringFormatArg (const floatconfig& v); StringFormatArg (const void* v); - template StringFormatArg (const vector& v) { + template StringFormatArg (const List& v) { m_val = "{ "; uint i = 0; @@ -482,7 +482,7 @@ }; // Formatter function -str DoFormat (vector args); +str DoFormat (List args); // printf replacement void doPrint (File& f, initlist args); diff -r 89a9235b47d3 -r ec95fc95e5f3 src/widgets.h --- a/src/widgets.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/widgets.h Tue Jul 30 07:38:08 2013 +0300 @@ -39,7 +39,7 @@ Q_OBJECT public: - typedef vector::it it; + typedef List::it it; explicit RadioBox (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); } explicit RadioBox () { init (Qt::Vertical); } @@ -68,8 +68,8 @@ void valueChanged (int val); private: - vector m_objects; - vector m_layouts; + List m_objects; + List m_layouts; QBoxLayout* m_coreLayout; QBoxLayout* m_currentLayout; bool m_vert;