qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ChatLineStorage Class Reference

#include <chatlinestorage.h>

Collaboration diagram for ChatLineStorage:
Collaboration graph

Classes

struct  IdxInfo
 

Public Types

using size_type = Lines_t::size_type
 
using reference = Lines_t::reference
 
using const_reference = Lines_t::const_reference
 
using const_iterator = Lines_t::const_iterator
 
using iterator = Lines_t::iterator
 

Public Member Functions

iterator insertChatMessage (ChatLogIdx idx, QDateTime timestamp, ChatLine::Ptr line)
 
iterator insertDateLine (QDateTime timestamp, ChatLine::Ptr line)
 
ChatLogIdx firstIdx () const
 
ChatLogIdx lastIdx () const
 
bool contains (ChatLogIdx idx) const
 
bool contains (QDateTime timestamp) const
 
iterator find (ChatLogIdx idx)
 
iterator find (ChatLine::Ptr line)
 
const_reference operator[] (size_type idx) const
 
const_reference operator[] (ChatLogIdx idx) const
 
size_type size () const
 
iterator begin ()
 
iterator end ()
 
bool empty () const
 
bool hasIndexedMessage () const
 
void clear ()
 
reference front ()
 
reference back ()
 
void erase (ChatLogIdx idx)
 
iterator erase (iterator it)
 

Private Types

using Lines_t = std::vector< ChatLine::Ptr >
 
using DateLineMap_t = std::map< ChatLine::Ptr, QDateTime >
 
using IdxInfoMap_t = std::map< ChatLogIdx, IdxInfo >
 

Private Member Functions

iterator equivalentLineIterator (IdxInfoMap_t::iterator it)
 
IdxInfoMap_t::iterator equivalentInfoIterator (iterator it)
 
IdxInfoMap_t::iterator infoIteratorForIdx (ChatLogIdx idx)
 
iterator adjustItForDate (iterator it, QDateTime timestamp)
 
void incrementLinePosAfter (IdxInfoMap_t::iterator it)
 
void decrementLinePosAfter (IdxInfoMap_t::iterator it)
 
bool shouldRemovePreviousLine (iterator prevIt, iterator it)
 

Private Attributes

std::vector< ChatLine::Ptrlines
 
std::map< ChatLine::Ptr, QDateTime > dateMap
 
IdxInfoMap_t idxInfoMap
 

Detailed Description

Helper class to keep track of what we're currently rendering and in what order Some constraints that may not be obvious

The class is designed to be used like a vector over the currently rendered items, but with some tweaks for ensuring items tied to the current view are moved correctly (selection indexes, removal of associated date lines, mappings of ChatLogIdx -> ChatLine::Ptr, etc.)

Definition at line 53 of file chatlinestorage.h.

Member Typedef Documentation

◆ const_iterator

using ChatLineStorage::const_iterator = Lines_t::const_iterator

Definition at line 70 of file chatlinestorage.h.

◆ const_reference

using ChatLineStorage::const_reference = Lines_t::const_reference

Definition at line 69 of file chatlinestorage.h.

◆ DateLineMap_t

using ChatLineStorage::DateLineMap_t = std::map<ChatLine::Ptr, QDateTime>
private

Definition at line 62 of file chatlinestorage.h.

◆ IdxInfoMap_t

using ChatLineStorage::IdxInfoMap_t = std::map<ChatLogIdx, IdxInfo>
private

Definition at line 63 of file chatlinestorage.h.

◆ iterator

using ChatLineStorage::iterator = Lines_t::iterator

Definition at line 71 of file chatlinestorage.h.

◆ Lines_t

using ChatLineStorage::Lines_t = std::vector<ChatLine::Ptr>
private

Definition at line 61 of file chatlinestorage.h.

◆ reference

using ChatLineStorage::reference = Lines_t::reference

Definition at line 68 of file chatlinestorage.h.

◆ size_type

using ChatLineStorage::size_type = Lines_t::size_type

Definition at line 67 of file chatlinestorage.h.

Member Function Documentation

◆ adjustItForDate()

ChatLineStorage::iterator ChatLineStorage::adjustItForDate ( iterator  it,
QDateTime  timestamp 
)
private

Definition at line 177 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ back()

reference ChatLineStorage::back ( )
inline

Definition at line 110 of file chatlinestorage.h.

◆ begin()

iterator ChatLineStorage::begin ( )
inline

Definition at line 95 of file chatlinestorage.h.

◆ clear()

void ChatLineStorage::clear ( )
inline

Definition at line 102 of file chatlinestorage.h.

◆ contains() [1/2]

bool ChatLineStorage::contains ( ChatLogIdx  idx) const
inline

Definition at line 82 of file chatlinestorage.h.

◆ contains() [2/2]

bool ChatLineStorage::contains ( QDateTime  timestamp) const

Definition at line 79 of file chatlinestorage.cpp.

◆ decrementLinePosAfter()

void ChatLineStorage::decrementLinePosAfter ( IdxInfoMap_t::iterator  it)
private

Definition at line 206 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ empty()

bool ChatLineStorage::empty ( ) const
inline

Definition at line 98 of file chatlinestorage.h.

◆ end()

iterator ChatLineStorage::end ( )
inline

Definition at line 96 of file chatlinestorage.h.

◆ equivalentInfoIterator()

ChatLineStorage::IdxInfoMap_t::iterator ChatLineStorage::equivalentInfoIterator ( iterator  it)
private

Definition at line 152 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ equivalentLineIterator()

ChatLineStorage::iterator ChatLineStorage::equivalentLineIterator ( IdxInfoMap_t::iterator  it)
private

Definition at line 143 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ erase() [1/2]

void ChatLineStorage::erase ( ChatLogIdx  idx)

Definition at line 104 of file chatlinestorage.cpp.

Here is the call graph for this function:

◆ erase() [2/2]

ChatLineStorage::iterator ChatLineStorage::erase ( iterator  it)

Definition at line 112 of file chatlinestorage.cpp.

Here is the call graph for this function:

◆ find() [1/2]

ChatLineStorage::iterator ChatLineStorage::find ( ChatLine::Ptr  line)

Definition at line 99 of file chatlinestorage.cpp.

◆ find() [2/2]

ChatLineStorage::iterator ChatLineStorage::find ( ChatLogIdx  idx)

Definition at line 88 of file chatlinestorage.cpp.

Here is the call graph for this function:

◆ firstIdx()

ChatLogIdx ChatLineStorage::firstIdx ( ) const
inline

Definition at line 78 of file chatlinestorage.h.

◆ front()

reference ChatLineStorage::front ( )
inline

Definition at line 109 of file chatlinestorage.h.

◆ hasIndexedMessage()

bool ChatLineStorage::hasIndexedMessage ( ) const
inline

Definition at line 100 of file chatlinestorage.h.

◆ incrementLinePosAfter()

void ChatLineStorage::incrementLinePosAfter ( IdxInfoMap_t::iterator  it)
private

Definition at line 199 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ infoIteratorForIdx()

ChatLineStorage::IdxInfoMap_t::iterator ChatLineStorage::infoIteratorForIdx ( ChatLogIdx  idx)
private

Definition at line 162 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ insertChatMessage()

ChatLineStorage::iterator ChatLineStorage::insertChatMessage ( ChatLogIdx  idx,
QDateTime  timestamp,
ChatLine::Ptr  line 
)

Definition at line 24 of file chatlinestorage.cpp.

Here is the call graph for this function:

◆ insertDateLine()

ChatLineStorage::iterator ChatLineStorage::insertDateLine ( QDateTime  timestamp,
ChatLine::Ptr  line 
)

Definition at line 50 of file chatlinestorage.cpp.

Here is the call graph for this function:

◆ lastIdx()

ChatLogIdx ChatLineStorage::lastIdx ( ) const
inline

Definition at line 80 of file chatlinestorage.h.

◆ operator[]() [1/2]

const_reference ChatLineStorage::operator[] ( ChatLogIdx  idx) const
inline

Definition at line 91 of file chatlinestorage.h.

◆ operator[]() [2/2]

const_reference ChatLineStorage::operator[] ( size_type  idx) const
inline

Definition at line 89 of file chatlinestorage.h.

◆ shouldRemovePreviousLine()

bool ChatLineStorage::shouldRemovePreviousLine ( iterator  prevIt,
iterator  it 
)
private

Definition at line 214 of file chatlinestorage.cpp.

Here is the caller graph for this function:

◆ size()

size_type ChatLineStorage::size ( ) const
inline

Definition at line 93 of file chatlinestorage.h.

Member Data Documentation

◆ dateMap

std::map<ChatLine::Ptr, QDateTime> ChatLineStorage::dateMap
private

Definition at line 129 of file chatlinestorage.h.

◆ idxInfoMap

IdxInfoMap_t ChatLineStorage::idxInfoMap
private

Definition at line 130 of file chatlinestorage.h.

◆ lines

std::vector<ChatLine::Ptr> ChatLineStorage::lines
private

Definition at line 128 of file chatlinestorage.h.


The documentation for this class was generated from the following files: