diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/entry.cpp | 35 | ||||
-rw-r--r-- | src/entry.h | 5 | ||||
-rw-r--r-- | src/scanner.l | 4 |
3 files changed, 32 insertions, 12 deletions
diff --git a/src/entry.cpp b/src/entry.cpp index ec3c736..8ec7846 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -240,6 +240,32 @@ void Entry::copyToSubEntry(const std::unique_ptr<Entry> ¤t) m_sublist.push_back(std::move(copy)); } +void Entry::moveFromSubEntry(const Entry *child,std::unique_ptr<Entry> &moveTo) +{ + auto it = std::find_if(m_sublist.begin(),m_sublist.end(), + [child](const std::unique_ptr<Entry>&elem) { return elem.get()==child; }); + if (it!=m_sublist.end()) + { + moveTo = std::move(*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::unique_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); @@ -335,14 +361,5 @@ void Entry::addSpecialListItem(const char *listName,int itemId) sli->append(ili); } -void Entry::removeSubEntry(Entry *e) -{ - auto it = std::find_if(m_sublist.begin(),m_sublist.end(), - [e](const std::unique_ptr<Entry>&elem) { return elem.get()==e; }); - if (it!=m_sublist.end()) - { - m_sublist.erase(it); - } -} //------------------------------------------------------------------ diff --git a/src/entry.h b/src/entry.h index 091e81b..c078936 100644 --- a/src/entry.h +++ b/src/entry.h @@ -223,6 +223,9 @@ class Entry void moveToSubEntryAndRefresh(Entry* &e); void moveToSubEntryAndRefresh(std::unique_ptr<Entry> &e); + /*! take \a child of of to list of children and move it into \a moveTo */ + void moveFromSubEntry(const Entry *child,std::unique_ptr<Entry> &moveTo); + /*! make a copy of \a e and add it as a child to this entry */ void copyToSubEntry (Entry* e); void copyToSubEntry (const std::unique_ptr<Entry> &e); @@ -230,7 +233,7 @@ class Entry /*! Removes entry \a e from the list of children. * The entry will be deleted if found. */ - void removeSubEntry(Entry *e); + void removeSubEntry(const Entry *e); /*! Restore the state of this Entry to the default value it has * at construction time. diff --git a/src/scanner.l b/src/scanner.l index 1a5fd5b..50ebe5e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -5307,9 +5307,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { current->endBodyLine=yyLineNr; - + // take previous out of current_root and move it into current current.swap(tempEntry); // remember current - current.reset(previous); // and temporarily switch to the previous entry + current_root->moveFromSubEntry(previous,current); previous = 0; docBlockContext = SkipCurlyEndDoc; |