/* * addBuff - add current working buffer to line data structures */ static void addBuff( LPWDATA w ) { LPLDATA ld; ld = createNewEntry( w ); ld->has_cr = TRUE; _DisplayLineInWindow( w, w->LastLineNumber - w->TopLineNumber + 1, ld->data ); } /* addBuff */
ContainerChangeEntry *ChangeList::getNewCreatedEntry(void) { ContainerChangeEntry *returnValue = createNewEntry(); returnValue->clear(this); _createdStore.push_back(returnValue); return returnValue; }
/* Board::MoveChangeEntry &Board::MoveChangeEntry::operator =(const MoveChangeEntry &entry) { m_putPos = entry.m_putPos; m_putColor = entry.m_putColor; m_isFirst = entry.m_isFirst; m_isNewPosition = entry.m_isNewPosition; m_kouPos = entry.m_kouPos; m_kouColor = entry.m_kouColor; block_replaced_by(&m_addedBlock, &entry.m_addedBlock); for (int i=0; i<4; i++) { m_addedLiberties[i] = entry.m_addedLiberties[i]; block_replaced_by(&m_mergedBlocks[i], &entry.m_mergedBlocks[i]); block_replaced_by(&m_killedBlocks[i], &entry.m_killedBlocks[i]); } return *this; } Board::MoveChangeEntry::MoveChangeEntry(const MoveChangeEntry &entry) : m_putPos(PASS) , m_putColor(FREE) , m_isFirst(true) , m_isNewPosition(true) , m_kouPos(PASS) , m_kouColor(FREE) , m_addedBlock(NULL) { for(int i=0; i<4; i++) { m_mergedBlocks[i] = NULL;; m_killedBlocks[i] = NULL; m_addedLiberties[i] = PASS; } this->operator=(entry); } */ void Board::MoveChangeEntry::copyVector(vector<MoveChangeEntry *> ©_to, vector<MoveChangeEntry *> ©_from, Board::BoardState::BlocksMapping &mapping) { if (copy_to.size() < copy_from.size()) { for (size_t i=copy_to.size(); i<copy_from.size(); i++) copy_to.push_back(createNewEntry()); } else { for (int i=(signed)copy_to.size()-1; i>=(signed)copy_from.size(); i--) { releaseEntry(copy_to[i]); } copy_to.resize(copy_from.size()); } for (size_t i=0; i<copy_from.size(); i++) { copy_to[i]->copyFromWithMapping(*copy_from[i], mapping); } }
bool TreeView::add(const std::string& name, const osg::ref_ptr<osg::Node> node, const bool& enableNode, const bool& showNode, const bool& replace, d3DisplayItem* myParent) { static const std::string splitIndicator("::"); // get the name split point size_t nameSplit( name.find(splitIndicator) ); // see if we have children if ( std::string::npos != nameSplit ) { // the first part is the parent's name std::string pre( name.substr(0, nameSplit) ); // the second part is the children std::string post( name.substr(nameSplit + splitIndicator.size(), name.size()) ); // call the add parent return addParent(pre, post, node, enableNode, showNode, replace, myParent); } // this must be a leaf node... do we already have this child? d3DisplayItem* entry(findChild(myParent, name)); // see if we need to create a new entry if ( nullptr == entry ) { return createNewEntry(name, node, enableNode, showNode, myParent); } else { return addToEntry(entry, node, enableNode, replace, myParent); } return false; };
// Parameters: clc the list control we're adding to // iStartingRow the listitem before-which we should insert a new entry // if this is -1, then the item is created at the end of the list // Called by: CWListView::OnUpdateEditInsertEntry // iKind will be zero usually; will be 1 for STAMPFlag rules. Ignored if pInsertEntry non-null. // pInsertEntry is used for copy-paste. otherwise, it will be null // returns the row in which the new item is, or -1 if nothing was inserted int CWList::insertNewItem(CListCtrl &clc, int iStartingRow, int iKind, CWListEntry* pInsertEntry) { int iBeforeEntry, iInsertAtRow; // 1) First, create the item CWListEntry* pEntry; if(pInsertEntry) pEntry = pInsertEntry; // entry being pasted // JDH 5/25/99 3:43:58 PM Added List Comment Capability (\co) else if(iKind == kCommentEntryKind) pEntry = new CListEntryComment; #ifndef hab17a1 else if(iKind == kTestDataEntryKind) pEntry = new CListEntryTestData; #endif //hab17a1 else pEntry = createNewEntry(iKind); pEntry->setOwningList(this); // To DO: should be moved to the constructor if(m_pEntries.GetSize() == 0) // if the list is currently empty { iBeforeEntry = iInsertAtRow = 0; } else if(iStartingRow >=0) { iBeforeEntry = rowToEntryIndex(clc, iStartingRow); ASSERTX(iBeforeEntry >= 0); iInsertAtRow = entryIndexToRowIndex(clc, iBeforeEntry); ASSERTX(iInsertAtRow >= 0); } else // iStartingRow=-1, make this the last member of the list { iBeforeEntry=-1; iInsertAtRow = iStartingRow = clc.GetItemCount(); } // 2) Let the user fill in its dialog #ifndef hab211 if(!pInsertEntry // don't do the dialog if we're pasting &&( (m_dwFlags & ITEMS_HAVE_DIALOG) || // or for simple types (CMonad) that don't have dialog boxes (iKind == kCommentEntryKind) || // unless its a comment or (iKind == kTestDataEntryKind))) // test data #else //hab211 if(!pInsertEntry // don't do the dialog if we're pasting &&(m_dwFlags & ITEMS_HAVE_DIALOG)) // or for simple types (CMonad) that don't have dialog boxes #endif //hab211 { #ifndef mr270 pEntry->setTypeOfTest(getTypeOfTest()); pEntry->setCommentChar(m_cCommentChar); pEntry->setTestEditModel(m_pTestEditModel); #endif // mr270 if (!pEntry->doEditDialog(clc, TRUE) ) return -1; } // 3) if they ok'd the dialog, add it to our list int iNewEntryIndex ; if(iBeforeEntry >= 0) { iNewEntryIndex = iBeforeEntry; m_pEntries.InsertAt(iBeforeEntry, pEntry); } else { iInsertAtRow = clc.GetItemCount(); // at the end iNewEntryIndex = m_pEntries.Add(pEntry); // stick it at the end } // 4) Add the item to the list control //ASSERTX(iStartingRow >= 0); if( addItemToListControl(clc, iNewEntryIndex, iInsertAtRow)) return iInsertAtRow; else return -1; }