MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / Clear

Method Clear

external/zep/src/buffer.cpp:700–724  ·  view source on GitHub ↗

Clear this buffer. If it was previously not clear, it has been updated. Otherwise it is just reset to default state. A new buffer is always initially cleared.

Source from the content-addressed store, hash-verified

698 // Clear this buffer. If it was previously not clear, it has been updated.
699 // Otherwise it is just reset to default state. A new buffer is always initially cleared.
700 void ZepBuffer::Clear() {
701 // A buffer that is empty is brand new; just make it 0 chars and return
702 if (m_workingBuffer.size() <= 1) {
703 m_workingBuffer.clear();
704 m_workingBuffer.push_back(0);
705 m_lineEnds.clear();
706 m_fileFlags = ZSetFlags(m_fileFlags, FileFlags::TerminatedWithZero);
707 m_lineEnds.push_back(End().Index() + 1);
708 return;
709 }
710
711 // Inform clients we are about to change the buffer
712 GetEditor().Broadcast(std::make_shared<BufferMessage>(this, BufferMessageType::PreBufferChange, GlyphIterator(this), End()));
713
714 m_workingBuffer.clear();
715 m_workingBuffer.push_back(0);
716 m_lineEnds.clear();
717 m_fileFlags = ZSetFlags(m_fileFlags, FileFlags::TerminatedWithZero);
718 m_lineEnds.push_back(End().Index() + 1);
719
720 {
721 MarkUpdate();
722 GetEditor().Broadcast(std::make_shared<BufferMessage>(this, BufferMessageType::TextDeleted, GlyphIterator(this), End()));
723 }
724 }
725
726 // Replace the buffer with the text
727 void ZepBuffer::SetText(const std::string& text, bool initFromFile) {

Callers 4

save_usdFunction · 0.45
rebuildFontsMethod · 0.45
BuildTreeMethod · 0.45
RedoMethod · 0.45

Calls 7

ZSetFlagsFunction · 0.85
GlyphIteratorClass · 0.85
IndexMethod · 0.80
BroadcastMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected