summaryrefslogtreecommitdiffstats
path: root/src/entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entry.cpp')
-rw-r--r--src/entry.cpp230
1 files changed, 93 insertions, 137 deletions
diff --git a/src/entry.cpp b/src/entry.cpp
index e2a21c6..cc8cd1f 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -15,6 +15,7 @@
*
*/
+#include <algorithm>
#include <stdlib.h>
#include <qfile.h>
#include "entry.h"
@@ -37,21 +38,9 @@ Entry::Entry()
num++;
m_parent=0;
section = EMPTY_SEC;
- m_sublist = new QList<Entry>;
- m_sublist->setAutoDelete(TRUE);
- extends = new QList<BaseInfo>;
- extends->setAutoDelete(TRUE);
- groups = new QList<Grouping>;
- groups->setAutoDelete(TRUE);
- anchors = new QList<SectionInfo>; // Doxygen::sectionDict takes ownership of the items!
- argList = new ArgumentList;
- argList->setAutoDelete(TRUE);
//printf("Entry::Entry() tArgList=0\n");
- tArgLists = 0;
- typeConstr = 0;
mGrpId = -1;
- tagInfo = 0;
- sli = 0;
+ hasTagInfo = FALSE;
relatesType = Simple;
hidden = FALSE;
groupDocType = GROUPDOC_NORMAL;
@@ -65,7 +54,8 @@ Entry::Entry(const Entry &e)
section = e.section;
type = e.type;
name = e.name;
- tagInfo = e.tagInfo;
+ hasTagInfo = e.hasTagInfo;
+ tagInfoData = e.tagInfoData;
protection = e.protection;
mtype = e.mtype;
spec = e.spec;
@@ -82,8 +72,8 @@ Entry::Entry(const Entry &e)
virt = e.virt;
args = e.args;
bitfields = e.bitfields;
- argList = e.argList->deepCopy();
- tArgLists = 0;
+ argList = e.argList;
+ tArgLists = e.tArgLists;
program = e.program;
initializer = e.initializer;
includeFile = e.includeFile;
@@ -103,88 +93,31 @@ Entry::Entry(const Entry &e)
write = e.write;
inside = e.inside;
exception = e.exception;
- typeConstr = 0;
+ typeConstr = e.typeConstr;
bodyLine = e.bodyLine;
endBodyLine = e.endBodyLine;
mGrpId = e.mGrpId;
- extends = new QList<BaseInfo>;
- extends->setAutoDelete(TRUE);
- groups = new QList<Grouping>;
- groups->setAutoDelete(TRUE);
- anchors = new QList<SectionInfo>;
+ anchors = e.anchors;
fileName = e.fileName;
startLine = e.startLine;
startColumn = e.startColumn;
- if (e.sli)
- {
- sli = new QList<ListItemInfo>;
- sli->setAutoDelete(TRUE);
- QListIterator<ListItemInfo> slii(*e.sli);
- ListItemInfo *ili;
- for (slii.toFirst();(ili=slii.current());++slii)
- {
- sli->append(new ListItemInfo(*ili));
- }
- }
- else
- {
- sli=0;
- }
+ sli = e.sli;
lang = e.lang;
hidden = e.hidden;
artificial = e.artificial;
groupDocType = e.groupDocType;
id = e.id;
+ extends = e.extends;
+ groups = e.groups;
+ m_fileDef = e.m_fileDef;
m_parent = e.m_parent;
- m_sublist = new QList<Entry>;
- m_sublist->setAutoDelete(TRUE);
-
- // deep copy of the child entry list
- QListIterator<Entry> eli(*e.m_sublist);
- Entry *cur;
- for (;(cur=eli.current());++eli)
- {
- m_sublist->append(new Entry(*cur));
- }
-
- // deep copy base class list
- QListIterator<BaseInfo> bli(*e.extends);
- BaseInfo *bi;
- for (;(bi=bli.current());++bli)
+ // deep copy child entries
+ m_sublist.reserve(e.m_sublist.size());
+ for (const auto &cur : e.m_sublist)
{
- extends->append(new BaseInfo(*bi));
+ m_sublist.push_back(std::make_shared<Entry>(*cur));
}
-
- // deep copy group list
- QListIterator<Grouping> gli(*e.groups);
- Grouping *g;
- for (;(g=gli.current());++gli)
- {
- groups->append(new Grouping(*g));
- }
-
- QListIterator<SectionInfo> sli2(*e.anchors);
- SectionInfo *s;
- for (;(s=sli2.current());++sli2)
- {
- anchors->append(s); // shallow copy, object are owned by Doxygen::sectionDict
- }
-
- // deep copy type constraint list
- if (e.typeConstr)
- {
- typeConstr = e.typeConstr->deepCopy();
- }
-
- // deep copy template argument lists
- if (e.tArgLists)
- {
- tArgLists = copyArgumentLists(e.tArgLists);
- }
-
- m_fileDef = e.m_fileDef;
-
}
Entry::~Entry()
@@ -192,31 +125,76 @@ Entry::~Entry()
//printf("Entry::~Entry(%p) num=%d\n",this,num);
//printf("Deleting entry %d name %s type %x children %d\n",
// num,name.data(),section,sublist->count());
-
- delete m_sublist; // each element is now own by a EntryNav so we do no longer own
- // our children.
- delete extends;
- delete groups;
- delete anchors;
- delete argList;
- delete tArgLists;
- delete tagInfo;
- delete typeConstr;
- delete sli;
+
num--;
}
-void Entry::addSubEntry(Entry *current)
+void Entry::moveToSubEntryAndRefresh(Entry *&current)
{
- //printf("Entry %d with name %s type 0x%x added to %s type 0x%x\n",
- // current->num,current->name.data(),current->section,
- // name.data(),section);
- //printf("Entry::addSubEntry(%s:%p) to %s\n",current->name.data(),
- // current,name.data());
current->m_parent=this;
- m_sublist->append(current);
+ m_sublist.emplace_back(current);
+ current = new Entry;
}
+void Entry::moveToSubEntryAndRefresh(std::shared_ptr<Entry> &current)
+{
+ current->m_parent=this;
+ m_sublist.push_back(current);
+ current = std::make_shared<Entry>();
+}
+
+void Entry::moveToSubEntryAndKeep(Entry *current)
+{
+ current->m_parent=this;
+ m_sublist.emplace_back(current);
+}
+
+void Entry::moveToSubEntryAndKeep(std::shared_ptr<Entry> &current)
+{
+ current->m_parent=this;
+ m_sublist.push_back(current);
+}
+
+void Entry::copyToSubEntry(Entry *current)
+{
+ Entry *copy = new Entry(*current);
+ copy->m_parent=this;
+ m_sublist.emplace_back(copy);
+}
+
+void Entry::copyToSubEntry(const std::shared_ptr<Entry> &current)
+{
+ std::shared_ptr<Entry> copy = std::make_shared<Entry>(*current);
+ copy->m_parent=this;
+ m_sublist.push_back(copy);
+}
+
+void Entry::moveFromSubEntry(const Entry *child,std::shared_ptr<Entry> &moveTo)
+{
+ auto it = std::find_if(m_sublist.begin(),m_sublist.end(),
+ [child](const std::shared_ptr<Entry>&elem) { return elem.get()==child; });
+ if (it!=m_sublist.end())
+ {
+ moveTo = *it;
+ m_sublist.erase(it);
+ }
+ else
+ {
+ moveTo.reset();
+ }
+}
+
+void Entry::removeSubEntry(const Entry *e)
+{
+ auto it = std::find_if(m_sublist.begin(),m_sublist.end(),
+ [e](const std::shared_ptr<Entry>&elem) { return elem.get()==e; });
+ if (it!=m_sublist.end())
+ {
+ m_sublist.erase(it);
+ }
+}
+
+
void Entry::reset()
{
static bool entryCallGraph = Config_getBool(CALL_GRAPH);
@@ -271,56 +249,34 @@ void Entry::reset()
groupDocType = GROUPDOC_NORMAL;
id.resize(0);
metaData.resize(0);
- m_sublist->clear();
- extends->clear();
- groups->clear();
- anchors->clear();
- argList->clear();
- if (tagInfo) { delete tagInfo; tagInfo=0; }
- if (tArgLists) { delete tArgLists; tArgLists=0; }
- if (sli) { delete sli; sli=0; }
- if (typeConstr) { delete typeConstr; typeConstr=0; }
- //if (mtArgList) { delete mtArgList; mtArgList=0; }
+ m_sublist.clear();
+ extends.clear();
+ groups.clear();
+ anchors.clear();
+ argList.clear();
+ tArgLists.clear();
+ argList.reset();
+ typeConstr.reset();
+ sli.clear();
m_fileDef = 0;
}
-
-int Entry::getSize()
-{
- return sizeof(Entry);
-}
-
void Entry::setFileDef(FileDef *fd)
{
m_fileDef = fd;
- if (m_sublist)
+ for (const auto &childNode : m_sublist)
{
- QListIterator<Entry> eli(*m_sublist);
- Entry *childNode;
- for (eli.toFirst();(childNode=eli.current());++eli)
- {
childNode->setFileDef(fd);
- }
}
}
void Entry::addSpecialListItem(const char *listName,int itemId)
{
- if (sli==0)
- {
- sli = new QList<ListItemInfo>;
- sli->setAutoDelete(TRUE);
- }
- ListItemInfo *ili=new ListItemInfo;
- ili->type = listName;
- ili->itemId = itemId;
- sli->append(ili);
+ ListItemInfo ili;
+ ili.type = listName;
+ ili.itemId = itemId;
+ sli.push_back(ili);
}
-Entry *Entry::removeSubEntry(Entry *e)
-{
- int i = m_sublist->find(e);
- return i!=-1 ? m_sublist->take(i) : 0;
-}
//------------------------------------------------------------------