OpenMW
|
00001 #ifndef MWGUI_JOURNALVIEWMODEL_HPP 00002 #define MWGUI_JOURNALVIEWMODEL_HPP 00003 00004 #include <string> 00005 #include <memory> 00006 #include <functional> 00007 #include <platform/stdint.h> 00008 #include <boost/function.hpp> 00009 #include <boost/shared_ptr.hpp> 00010 00011 namespace MWGui 00012 { 00019 struct JournalViewModel 00020 { 00021 typedef boost::shared_ptr <JournalViewModel> Ptr; 00022 00023 typedef intptr_t QuestId; 00024 typedef intptr_t TopicId; 00025 typedef uint8_t const * Utf8Point; 00026 typedef std::pair <Utf8Point, Utf8Point> Utf8Span; 00027 00029 struct Entry 00030 { 00036 virtual Utf8Span body () const = 0; 00037 00041 virtual void visitSpans (boost::function <void (TopicId, size_t, size_t)> visitor) const = 0; 00042 }; 00043 00045 struct TopicEntry : Entry 00046 { 00049 virtual Utf8Span source () const = 0; 00050 }; 00051 00053 struct JournalEntry : Entry 00054 { 00057 virtual Utf8Span timestamp () const = 0; 00058 }; 00059 00060 00062 virtual void load () = 0; 00063 00065 virtual void unload () = 0; 00066 00068 virtual bool isEmpty () const = 0; 00069 00071 virtual void visitQuestName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const = 0; 00072 00074 virtual void visitQuestNames (bool active_only, boost::function <void (QuestId, Utf8Span)> visitor) const = 0; 00075 00077 virtual void visitJournalEntries (QuestId questId, boost::function <void (JournalEntry const &)> visitor) const = 0; 00078 00080 virtual void visitTopicName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const = 0; 00081 00083 virtual void visitTopicNamesStartingWith (char character, boost::function < void (TopicId , Utf8Span) > visitor) const = 0; 00084 00086 virtual void visitTopicEntries (TopicId topicId, boost::function <void (TopicEntry const &)> visitor) const = 0; 00087 00088 // create an instance of the default journal view model implementation 00089 static Ptr create (); 00090 }; 00091 } 00092 00093 #endif // MWGUI_JOURNALVIEWMODEL_HPP