XalanDOMString& XalanDOMString::insert( size_type thePosition, const XalanDOMChar* theString, size_type theCount) { invariants(); if (m_data.empty() == true) { assert(thePosition == 0); append(theString, theCount); assert(length() == theCount); } else { m_data.insert(getIteratorForPosition(thePosition), theString, theString + theCount); m_size += theCount; } invariants(); return *this; }
XalanDOMString& XalanDOMString::insert( size_type thePosition, size_type theCount, XalanDOMChar theChar) { invariants(); if (m_data.empty() == true) { assert(thePosition == 0); assign(theCount, theChar); } else { m_data.insert(getIteratorForPosition(thePosition), theCount, theChar); m_size += theCount; } invariants(); return *this; }
void CodeEditorComponent::rebuildLineTokens() { cancelPendingUpdate(); const int numNeeded = linesOnScreen + 1; int minLineToRepaint = numNeeded; int maxLineToRepaint = 0; if (numNeeded != lines.size()) { lines.clear(); for (int i = numNeeded; --i >= 0;) lines.add (new CodeEditorLine()); minLineToRepaint = 0; maxLineToRepaint = numNeeded; } jassert (numNeeded == lines.size()); CodeDocument::Iterator source (&document); getIteratorForPosition (CodeDocument::Position (&document, firstLineOnScreen, 0).getPosition(), source); for (int i = 0; i < numNeeded; ++i) { CodeEditorLine* const line = lines.getUnchecked(i); if (line->update (document, firstLineOnScreen + i, source, codeTokeniser, spacesPerTab, selectionStart, selectionEnd)) { minLineToRepaint = jmin (minLineToRepaint, i); maxLineToRepaint = jmax (maxLineToRepaint, i); } } if (minLineToRepaint <= maxLineToRepaint) { repaint (gutter, lineHeight * minLineToRepaint - 1, verticalScrollBar->getX() - gutter, lineHeight * (1 + maxLineToRepaint - minLineToRepaint) + 2); } }
XalanDOMString& XalanDOMString::erase( size_type theStartPosition, size_type theCount) { invariants(); const size_type theActualCount = theCount == size_type(npos) ? length() - theStartPosition : theCount; assert(theStartPosition + theActualCount <= length()); if (theStartPosition == 0 && theCount >= size()) { m_data.erase(m_data.begin(), m_data.end()); m_size = 0; } else { const iterator i = getIteratorForPosition(theStartPosition); m_data.erase(i, i + (theActualCount)); const size_type theNewSize = size_type(m_data.size()); assert(size_type(m_data.size()) == theNewSize); if (theNewSize < 2) { m_size = 0; } else { m_size = theNewSize - 1; } } invariants(); return *this; }