OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
journalviewmodel.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_JOURNALVIEWMODEL_HPP
2 #define MWGUI_JOURNALVIEWMODEL_HPP
3 
4 #include <string>
5 #include <memory>
6 #include <functional>
7 #include <stdint.h>
8 #include <boost/function.hpp>
9 #include <boost/shared_ptr.hpp>
10 
11 namespace MWGui
12 {
20  {
21  typedef boost::shared_ptr <JournalViewModel> Ptr;
22 
23  typedef intptr_t QuestId;
24  typedef intptr_t TopicId;
25  typedef uint8_t const * Utf8Point;
26  typedef std::pair <Utf8Point, Utf8Point> Utf8Span;
27 
29  struct Entry
30  {
36  virtual Utf8Span body () const = 0;
37 
41  virtual void visitSpans (boost::function <void (TopicId, size_t, size_t)> visitor) const = 0;
42  };
43 
45  struct TopicEntry : Entry
46  {
49  virtual Utf8Span source () const = 0;
50  };
51 
54  {
57  virtual Utf8Span timestamp () const = 0;
58  };
59 
60 
62  virtual void load () = 0;
63 
65  virtual void unload () = 0;
66 
68  virtual bool isEmpty () const = 0;
69 
71  virtual void visitQuestNames (bool active_only, boost::function <void (const std::string&, bool)> visitor) const = 0;
72 
75  virtual void visitJournalEntries (const std::string& questName, boost::function <void (JournalEntry const &)> visitor) const = 0;
76 
78  virtual void visitTopicName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const = 0;
79 
81  virtual void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const = 0;
82 
84  virtual void visitTopicEntries (TopicId topicId, boost::function <void (TopicEntry const &)> visitor) const = 0;
85 
86  // create an instance of the default journal view model implementation
87  static Ptr create ();
88  };
89 }
90 
91 #endif // MWGUI_JOURNALVIEWMODEL_HPP
virtual void visitQuestNames(bool active_only, boost::function< void(const std::string &, bool)> visitor) const =0
walks the active and optionally completed, quests providing the name and completed status ...
virtual Utf8Span timestamp() const =0
intptr_t QuestId
Definition: journalviewmodel.hpp:23
An interface to topic data.
Definition: journalviewmodel.hpp:45
virtual void visitSpans(boost::function< void(TopicId, size_t, size_t)> visitor) const =0
static Ptr create()
Definition: journalviewmodel.cpp:357
The base interface for both journal entries and topics.
Definition: journalviewmodel.hpp:29
uint8_t const * Utf8Point
Definition: journalviewmodel.hpp:25
virtual void load()=0
called prior to journal opening
virtual bool isEmpty() const =0
returns true if their are no journal entries to display
virtual Utf8Span source() const =0
virtual Utf8Span body() const =0
virtual void unload()=0
called prior to journal closing
Definition: journalviewmodel.hpp:19
boost::shared_ptr< JournalViewModel > Ptr
Definition: journalviewmodel.hpp:21
std::pair< Utf8Point, Utf8Point > Utf8Span
Definition: journalviewmodel.hpp:26
intptr_t TopicId
Definition: journalviewmodel.hpp:24
virtual void visitTopicEntries(TopicId topicId, boost::function< void(TopicEntry const &)> visitor) const =0
walks over the topic entries for the topic specified by its identifier
An interface to journal data.
Definition: journalviewmodel.hpp:53
virtual void visitJournalEntries(const std::string &questName, boost::function< void(JournalEntry const &)> visitor) const =0
virtual void visitTopicNamesStartingWith(char character, boost::function< void(const std::string &) > visitor) const =0
walks over the topics whose names start with the specified character providing the topics name ...
virtual void visitTopicName(TopicId topicId, boost::function< void(Utf8Span)> visitor) const =0
provides the name of the topic specified by its id