Tue, 30 Jul 2013 07:38:08 +0300
Renamed vector to List, changed it to wrap around std::deque.
--- 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<str> matrixstrvals = container_cast<QStringList, vector<str>> (str (dlg.le_matrix->text ()).split (" ")); + List<str> matrixstrvals = container_cast<QStringList, List<str>> (str (dlg.le_matrix->text ()).split (" ")); if (matrixstrvals.size () == 9) { double matrixvals[9];
--- 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 <stdio.h> #include <stdlib.h> #include <assert.h> -#include <vector> #include <stdint.h> #include <stdarg.h> #include <QString>
--- 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<QListWidgetItem*>& haystack) { +int ConfigDialog::getItemRow (QListWidgetItem* item, List<QListWidgetItem*>& haystack) { int i = 0; for (QListWidgetItem* it : haystack) {
--- 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<LDQuickColor> quickColors; + List<LDQuickColor> quickColors; QDoubleSpinBox* dsb_gridData[3][4]; private: Ui_ConfigUI* ui; QLabel* lb_gridLabels[3]; QLabel* lb_gridIcons[3]; - vector<QListWidgetItem*> quickColorItems; + List<QListWidgetItem*> 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<QListWidgetItem*>& haystack ); + int getItemRow( QListWidgetItem* item, List<QListWidgetItem*>& haystack ); str quickColorString(); QListWidgetItem* getSelectedQuickColor(); QList<ShortcutListItem*> getShortcutSelection();
--- 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<pair<QRadioButton*, int>> m_cameraArgs; + List<pair<QRadioButton*, int>> m_cameraArgs; private slots: void slot_fpath();
--- 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<LDObject*>& objects, File& f) { +void writeObjects (List<LDObject*>& objects, File& f) { for (LDObject* obj : objects) { if (obj->getType() == LDObject::Subfile) { - vector<LDObject*> objs = static_cast<LDSubfileObject*> (obj)->inlineContents (true, false); + List<LDObject*> objs = static_cast<LDSubfileObject*> (obj)->inlineContents (true, false); writeObjects (objs, f); @@ -144,7 +144,7 @@ } } -void writeObjects (vector<LDObject*>& objects, str fname) { +void writeObjects (List<LDObject*>& objects, str fname) { // Write the input file File f (fname, File::Write); @@ -164,7 +164,7 @@ // ============================================================================= void writeColorGroup (const short colnum, str fname) { - vector<LDObject*> objects; + List<LDObject*> 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<short> colorsToReplace) { +static void insertOutput (str fname, bool replace, List<short> colorsToReplace) { #ifndef RELEASE QFile::copy (fname, "./debug_lastOutput"); #endif // RELEASE @@ -245,7 +245,7 @@ return; } - vector<LDObject*> objs = loadFileContents (&f, null); + List<LDObject*> objs = loadFileContents (&f, null); // If we replace the objects, delete the selection now. if (replace)
--- 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<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok) { - vector<str> lines; - vector<LDObject*> objs; +List<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok) { + List<str> lines; + List<LDObject*> objs; if (numWarnings) *numWarnings = 0; @@ -362,7 +362,7 @@ ulong numWarnings; bool ok; - vector<LDObject*> objs = loadFileContents (f, &numWarnings, &ok); + List<LDObject*> 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<LDOpenFile*> files = g_loadedFiles; + List<LDOpenFile*> files = g_loadedFiles; for( LDOpenFile* file : files ) delete file; } @@ -867,8 +867,8 @@ m_objs[idx] = obj; } -static vector<LDOpenFile*> getFilesUsed (LDOpenFile* node) { - vector<LDOpenFile*> filesUsed; +static List<LDOpenFile*> getFilesUsed (LDOpenFile* node) { + List<LDOpenFile*> 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<LDOpenFile*> filesUsed = getFilesUsed (LDOpenFile::current()); + List<LDOpenFile*> 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<LDObject*> objs) { +LDOpenFile& LDOpenFile::operator<< (List<LDObject*> objs) { for (LDObject* obj : objs) addObject (obj);
--- 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<LDObject*>, objs, setObjects) + READ_PROPERTY (List<LDObject*>, objs, setObjects) READ_PROPERTY (History, history, setHistory) - READ_PROPERTY (vector<LDObject*>, vertices, setVertices) + READ_PROPERTY (List<LDObject*>, vertices, setVertices) PROPERTY (str, name, setName) PROPERTY (bool, implicit, setImplicit) - PROPERTY (vector<LDObject*>, cache, setCache) + PROPERTY (List<LDObject*>, cache, setCache) PROPERTY (long, savePos, setSavePos) DECLARE_PROPERTY (QListWidgetItem*, listItem, setListItem) public: - typedef vector<LDObject*>::it it; - typedef vector<LDObject*>::c_it c_it; + typedef List<LDObject*>::it it; + typedef List<LDObject*>::c_it c_it; LDOpenFile(); ~LDOpenFile(); @@ -82,7 +82,7 @@ return *this; } - LDOpenFile& operator<< (vector<LDObject*> objs); + LDOpenFile& operator<< (List<LDObject*> objs); it begin() { return PROP_NAME (objs).begin(); @@ -164,15 +164,15 @@ // Is it safe to close all files? bool safeToCloseAll(); -vector<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok = null); +List<LDObject*> loadFileContents (File* f, ulong* numWarnings, bool* ok = null); -extern vector<LDOpenFile*> g_loadedFiles; +extern List<LDOpenFile*> g_loadedFiles; void addRecentFile (str path); str basename (str path); str dirname (str path); -extern vector<LDOpenFile*> g_loadedFiles; // Vector of all currently opened files. +extern List<LDOpenFile*> g_loadedFiles; // Vector of all currently opened files. // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -184,11 +184,11 @@ // ============================================================================= class FileLoader : public QObject { Q_OBJECT - READ_PROPERTY (vector<LDObject*>, objs, setObjects) + READ_PROPERTY (List<LDObject*>, objs, setObjects) READ_PROPERTY (bool, done, setDone) READ_PROPERTY (ulong, progress, setProgress) READ_PROPERTY (bool, aborted, setAborted) - PROPERTY (vector<str>, lines, setLines) + PROPERTY (List<str>, lines, setLines) PROPERTY (ulong*, warningsPointer, setWarningsPointer) PROPERTY (bool, concurrent, setConcurrent)
--- 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<short> g_warnedColors; +static List<short> g_warnedColors; void GLRenderer::setObjectColor (LDObject* obj, const ListType list) { QColor qcol; @@ -762,7 +762,7 @@ case LDObject::Subfile: { LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); - vector<LDObject*> objs = ref->inlineContents (true, true); + List<LDObject*> 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<LDObject*> oldsel = g_win->sel(); + List<LDObject*> 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<vertex>& verts = m_drawedVerts; + List<vertex>& verts = m_drawedVerts; LDObject* obj = null; if (m_rectdraw) { @@ -1299,14 +1299,14 @@ m_rectdraw = false; } -static vector<vertex> getVertices (LDObject* obj) { - vector<vertex> verts; +static List<vertex> getVertices (LDObject* obj) { + List<vertex> verts; if (obj->vertices() >= 2) { for (int i = 0; i < obj->vertices(); ++i) verts << obj->getVertex (i); } elif (obj->getType() == LDObject::Subfile) { - vector<LDObject*> objs = static_cast<LDSubfileObject*> (obj)->inlineContents (true, true); + List<LDObject*> objs = static_cast<LDSubfileObject*> (obj)->inlineContents (true, true); for(LDObject* obj : objs) { verts << getVertices (obj); @@ -1337,7 +1337,7 @@ } // Mark in known vertices of this object - vector<vertex> verts = getVertices (obj); + List<vertex> verts = getVertices (obj); m_knownVerts << verts; m_knownVerts.makeUnique();
--- 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<vertex> m_drawedVerts; + List<vertex> m_drawedVerts; bool m_rectdraw; vertex m_rectverts[4]; QColor m_bgcolor; double m_depthValues[6]; overlayMeta m_overlays[6]; - vector<vertex> m_knownVerts; + List<vertex> m_knownVerts; bool m_panning; void addDrawnVertex (vertex m_hoverpos);
--- 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<str> files = container_cast<QStringList, vector<str>> (io_recentfiles.value.split ("@")); + List<str> files = container_cast<QStringList, List<str>> (io_recentfiles.value.split ("@")); for (str file : c_rev<str> (files)) { QAction* recent = new QAction (getIcon ("open-recent"), file, this); @@ -164,8 +164,8 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector<LDQuickColor> quickColorsFromConfig() { - vector<LDQuickColor> colors; +List<LDQuickColor> quickColorsFromConfig() { + List<LDQuickColor> colors; for (str colorname : gui_colortoolbar.value.split (":")) { if (colorname == "|") { @@ -253,7 +253,7 @@ if( m_sel.size() == 0 ) return 0; - vector<LDObject*> selCopy = m_sel; + List<LDObject*> selCopy = m_sel; int num = 0; // Delete the objects that were being selected @@ -406,7 +406,7 @@ if (m_renderer->picking()) return; - vector<LDObject*> priorSelection = m_sel; + List<LDObject*> priorSelection = m_sel; // Get the objects from the object list selection m_sel.clear(); @@ -622,7 +622,7 @@ } // ============================================================================= -void ForgeWindow::deleteObjVector (vector<LDObject*> objs) { +void ForgeWindow::deleteObjVector (List<LDObject*> objs) { for (LDObject* obj : objs) { LDOpenFile::current()->forgetObject (obj); delete obj; @@ -631,7 +631,7 @@ // ============================================================================= void ForgeWindow::deleteByColor (const short colnum) { - vector<LDObject*> objs; + List<LDObject*> objs; for (LDObject* obj : LDOpenFile::current()->objs()) { if (!obj->isColored() || obj->color() != colnum) continue;
--- 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<LDObject*>& sel() { return m_sel; } - void setQuickColors (vector<LDQuickColor>& colors) { m_quickColors = colors; } + List<LDObject*>& sel() { return m_sel; } + void setQuickColors (List<LDQuickColor>& 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<LDObject*> m_sel; - vector<LDQuickColor> m_quickColors; - vector<QToolButton*> m_colorButtons; - vector<QAction*> m_recentFiles; + List<LDObject*> m_sel; + List<LDQuickColor> m_quickColors; + List<QToolButton*> m_colorButtons; + List<QAction*> 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<LDQuickColor> quickColorsFromConfig(); // Make a list of quick colors based on config +List<LDQuickColor> 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<class T> T radioSwitch (const T& defval, vector<pair<QRadioButton*, T>> haystack) { +template<class T> T radioSwitch (const T& defval, List<pair<QRadioButton*, T>> haystack) { for (pair<QRadioButton*, const T&> 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<class T> void radioDefault (const T& expr, vector<pair<QRadioButton*, T>> haystack) { +template<class T> void radioDefault (const T& expr, List<pair<QRadioButton*, T>> haystack) { for (pair<QRadioButton*, const T&> i : haystack) { if (i.second == expr) { i.first->setChecked (true);
--- 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<LDObject*> objs = loadFileContents (&f, null); + List<LDObject*> objs = loadFileContents (&f, null); g_win->sel().clear();
--- 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<LDObject*> objs = g_win->sel(); + List<LDObject*> objs = g_win->sel(); int num = 0; // Clear the clipboard first. @@ -112,7 +112,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doInline (bool deep) { - vector<LDObject*> sel = g_win->sel(); + List<LDObject*> 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<LDObject*> objs; + List<LDObject*> objs; if (obj->getType() == LDObject::Subfile) objs = static_cast<LDSubfileObject*> (obj)->inlineContents (deep, true); @@ -159,7 +159,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // =============================================================================================== DEFINE_ACTION (SplitQuads, 0) { - vector<LDObject*> objs = g_win->sel(); + List<LDObject*> objs = g_win->sel(); int num = 0; for (LDObject* obj : objs) { @@ -172,7 +172,7 @@ if (index == -1) return; - vector<LDTriangleObject*> triangles = static_cast<LDQuadObject*> (obj)->splitToTriangles(); + List<LDTriangleObject*> triangles = static_cast<LDQuadObject*> (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<LDObject*> objs = g_win->sel(); + List<LDObject*> 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<LDObject*> objs = g_win->sel(); + List<LDObject*> objs = g_win->sel(); int num = 0; for (LDObject* obj : objs) { @@ -331,7 +331,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doMoveSelection (const bool up) { - vector<LDObject*> objs = g_win->sel(); + List<LDObject*> objs = g_win->sel(); LDObject::moveObjects (objs, up); g_win->buildObjList(); } @@ -398,7 +398,7 @@ // ============================================================================= DEFINE_ACTION (Invert, CTRL_SHIFT (W)) { - vector<LDObject*> sel = g_win->sel(); + List<LDObject*> 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<LDObject*> sel = g_win->sel(); - vector<vertex*> queue; + List<LDObject*> sel = g_win->sel(); + List<vertex*> 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<Axis> sel; + List<Axis> sel; int num = 0; if (ui.x->isChecked()) sel << X; @@ -579,7 +579,7 @@ if (!dlg->exec()) return; - vector<Axis> sel; + List<Axis> 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<LDObject*> sel = g_win->sel(); + List<LDObject*> sel = g_win->sel(); int num = 0; for (LDObject* obj : sel) {
--- 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<AbstractHistoryEntry*> set : m_changesets) + for (List<AbstractHistoryEntry*> set : m_changesets) for (AbstractHistoryEntry * change : set) delete change;
--- 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<AbstractHistoryEntry*> list; + typedef List<AbstractHistoryEntry*> list; enum Type { Del, @@ -69,7 +69,7 @@ private: list m_currentArchive; - vector<list> m_changesets; + List<list> m_changesets; }; // ============================================================================= @@ -149,10 +149,10 @@ public: IMPLEMENT_HISTORY_TYPE (Move) - vector<ulong> indices; + List<ulong> indices; vertex dest; - MoveHistory (vector<ulong> indices, vertex dest) : + MoveHistory (List<ulong> indices, vertex dest) : indices (indices), dest (dest) {} };
--- 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<LDObject*> g_LDObjects; +List<LDObject*> g_LDObjects; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -168,7 +168,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector<LDTriangleObject*> LDQuadObject::splitToTriangles() { +List<LDTriangleObject*> 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<LDTriangleObject*> triangles; + List<LDTriangleObject*> triangles; triangles << tri1; triangles << tri2; return triangles; @@ -277,8 +277,8 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -vector<LDObject*> LDSubfileObject::inlineContents (bool deep, bool cache) { - vector<LDObject*> objs, objcache; +List<LDObject*> LDSubfileObject::inlineContents (bool deep, bool cache) { + List<LDObject*> 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<LDSubfileObject*> (obj); - vector<LDObject*> otherobjs = ref->inlineContents (true, false); + List<LDObject*> otherobjs = ref->inlineContents (true, false); for (LDObject* otherobj : otherobjs) { // Cache this object, if desired @@ -348,12 +348,12 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -void LDObject::moveObjects (vector<LDObject*> objs, const bool up) { +void LDObject::moveObjects (List<LDObject*> 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<LDObject*> objsToCompile; + List<LDObject*> objsToCompile; for (long i = start; i != end; i += incr) { LDObject* obj = objs[i]; @@ -393,7 +393,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -str LDObject::objectListContents (const vector<LDObject*>& objs) { +str LDObject::objectListContents (const List<LDObject*>& objs) { bool firstDetails = true; str text = "";
--- 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<LDObject*> objs, const bool up); // TODO: move this to LDOpenFile? - static str objectListContents (const vector<LDObject*>& objs); // Get a description of a list of LDObjects + static void moveObjects (List<LDObject*> objs, const bool up); // TODO: move this to LDOpenFile? + static str objectListContents (const List<LDObject*>& 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<LDObject*> inlineContents (bool deep, bool cache); + List<LDObject*> inlineContents (bool deep, bool cache); }; // ============================================================================= @@ -366,7 +366,7 @@ LDQuadObject() {} // Split this quad into two triangles (note: heap-allocated) - vector<LDTriangleObject*> splitToTriangles(); + List<LDTriangleObject*> splitToTriangles(); }; // =============================================================================
--- 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<LDOpenFile*> g_loadedFiles; +List<LDOpenFile*> g_loadedFiles; ForgeWindow* g_win = null; const QApplication* g_app = null; File g_file_stdout (stdout, File::Write);
--- 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<Line>::it it; - typedef vector<Line>::c_it c_it; + typedef List<Line>::it it; + typedef List<Line>::c_it c_it; explicit MessageManager( QObject* parent = 0 ); void addLine( str line ); @@ -54,7 +54,7 @@ MessageManager& operator<<( str line ); private: - vector<Line> m_lines; + List<Line> m_lines; QTimer* m_ticker; private slots:
--- 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<LDObject*>& objs ) +vertex rotPoint( const List<LDObject*>& objs ) { LDBoundingBox box; @@ -302,7 +302,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= StringParser::StringParser (str inText, char sep) { - m_tokens = container_cast<QStringList, vector<str>> (inText.split (sep, QString::SkipEmptyParts)); + m_tokens = container_cast<QStringList, List<str>> (inText.split (sep, QString::SkipEmptyParts)); m_pos = -1; }
--- 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<LDObject*>& objs); +vertex rotPoint (const List<LDObject*>& objs); void configRotationPoint (); template<class T, class R> R container_cast (const T& a) { @@ -128,7 +128,7 @@ } private: - vector<str> m_tokens; + List<str> m_tokens; short m_pos; };
--- 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<PrimitiveCategory> g_PrimitiveCategories; +List<PrimitiveCategory> g_PrimitiveCategories; static PrimitiveLister* g_activePrimLister = null; static bool g_primListerMutex = false; -vector<Primitive> g_primitives; +List<Primitive> g_primitives; static const str g_Other = QObject::tr ("Other"); @@ -71,7 +71,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -static void recursiveGetFilenames (QDir dir, vector<str>& fnames) { +static void recursiveGetFilenames (QDir dir, List<str>& 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<str> fnames; + List<str> 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<LDObject*> makePrimitive (PrimitiveType type, int segs, int divs, int num) { - vector<LDObject*> objs; - vector<int> condLineSegs; +List<LDObject*> makePrimitive (PrimitiveType type, int segs, int divs, int num) { + List<LDObject*> objs; + List<int> condLineSegs; for (int i = 0; i < segs; ++i) { double x0 = radialPoint (i, divs, cos),
--- 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<RegexEntry>::it it; - typedef vector<RegexEntry>::c_it c_it; + typedef List<RegexEntry>::it it; + typedef List<RegexEntry>::c_it c_it; - vector<RegexEntry> regexes; - vector<Primitive> prims; - static vector<Primitive> uncat; + List<RegexEntry> regexes; + List<Primitive> prims; + static List<Primitive> uncat; }; // ============================================================================= @@ -74,10 +74,10 @@ void update (ulong i); private: - vector<Primitive> m_prims; + List<Primitive> m_prims; }; -extern vector<PrimitiveCategory> g_PrimitiveCategories; +extern List<PrimitiveCategory> g_PrimitiveCategories; void loadPrimitives (); bool primitiveLoaderBusy ();
--- 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<StringFormatArg> args ) +str DoFormat( List<StringFormatArg> args ) { assert( args.size() >= 1 ); str text = args[0].value(); @@ -521,7 +521,7 @@ case LDObject::Subfile: { LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); - vector<LDObject*> objs = ref->inlineContents (true, true); + List<LDObject*> objs = ref->inlineContents (true, true); for (LDObject* obj : objs) { calcObject (obj);
--- 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 <QString> #include <QObject> -#include <vector> +#include <deque> #include "common.h" class LDObject; typedef QChar qchar; typedef QString str; -template<class T> class ConstVectorReverser; -template<class T> using c_rev = ConstVectorReverser<T>; +template<class T> class ConstListReverser; +template<class T> using c_rev = ConstListReverser<T>; 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 T> class vector { +template<class T> class List { public: - typedef typename std::vector<T>::iterator it; - typedef typename std::vector<T>::const_iterator c_it; - typedef typename std::vector<T>::reverse_iterator r_it; - typedef typename std::vector<T>::const_reverse_iterator cr_it; + typedef typename std::deque<T>::iterator it; + typedef typename std::deque<T>::const_iterator c_it; + typedef typename std::deque<T>::reverse_iterator r_it; + typedef typename std::deque<T>::const_reverse_iterator cr_it; - vector () {} - vector (initlist<T> vals) { + List () {} + List (initlist<T> vals) { m_vect = vals; } @@ -192,7 +192,7 @@ return m_vect[m_vect.size () - 1]; } - void push_back (const vector<T>& vals) { + void push_back (const List<T>& vals) { for (const T& val : vals) push_back (val); } @@ -210,7 +210,7 @@ return push_back (value); } - void operator<< (const vector<T>& vals) { + void operator<< (const List<T>& vals) { push_back (vals); } @@ -218,8 +218,8 @@ return pop (value); } - vector<T> reverse () const { - vector<T> rev; + List<T> reverse () const { + List<T> rev; for (const T& val : c_rev<T> (*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<T> m_vect; + std::deque<T> 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 T> class VectorReverser { +template<class T> class ListReverser { public: - typedef typename vector<T>::r_it it; + typedef typename List<T>::r_it it; - VectorReverser (vector<T>& vect) { + ListReverser (List<T>& vect) { m_vect = &vect; } @@ -305,21 +305,21 @@ } private: - vector<T>* m_vect; + List<T>* 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 T> class ConstVectorReverser { +template<class T> class ConstListReverser { public: - typedef typename vector<T>::cr_it it; + typedef typename List<T>::cr_it it; - ConstVectorReverser (const vector<T>& vect) { + ConstListReverser (const List<T>& vect) { m_vect = &vect; } @@ -332,11 +332,11 @@ } private: - const vector<T>* m_vect; + const List<T>* m_vect; }; -template<class T> using rev = VectorReverser<T>; -template<class T> using c_rev = ConstVectorReverser<T>; +template<class T> using rev = ListReverser<T>; +template<class T> using c_rev = ConstListReverser<T>; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -377,7 +377,7 @@ StringFormatArg (const floatconfig& v); StringFormatArg (const void* v); - template<class T> StringFormatArg (const vector<T>& v) { + template<class T> StringFormatArg (const List<T>& v) { m_val = "{ "; uint i = 0; @@ -482,7 +482,7 @@ }; // Formatter function -str DoFormat (vector<StringFormatArg> args); +str DoFormat (List<StringFormatArg> args); // printf replacement void doPrint (File& f, initlist<StringFormatArg> args);
--- 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<QRadioButton*>::it it; + typedef List<QRadioButton*>::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<QRadioButton*> m_objects; - vector<QBoxLayout*> m_layouts; + List<QRadioButton*> m_objects; + List<QBoxLayout*> m_layouts; QBoxLayout* m_coreLayout; QBoxLayout* m_currentLayout; bool m_vert;