#include "console_store.h" #include #include namespace Code { ConsoleStore::ConsoleStore() : m_history{0} { } void ConsoleStore::clear() { assert(k_historySize > 0); m_history[0] = 0; } ConsoleLine ConsoleStore::lineAtIndex(int i) const { assert(i >= 0 && i < numberOfLines()); int currentLineIndex = 0; for (int j=0; j k_historySize - 1) { deleteFirstLine(); i = indexOfNullMarker(); } m_history[i] = marker; strlcpy(&m_history[i+1], text, length+1); m_history[i+1+length+1] = 0; } ConsoleLine::Type ConsoleStore::lineTypeForMarker(char marker) const { assert(marker == 0x01 || marker == 0x02); return static_cast(marker-1); } int ConsoleStore::indexOfNullMarker() const { if (m_history[0] == 0) { return 0; } for (int i=0; i