1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 20:45:33 +00:00

dropped the I infront of the journal view model interfaces

This commit is contained in:
Nathan Jeffords 2013-03-06 20:02:00 -08:00
parent 36a6806faf
commit 7db6447a00
7 changed files with 42 additions and 42 deletions

View file

@ -56,7 +56,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::IEntry const & Entry) void operator () (JournalViewModel::Entry const & Entry)
{ {
typesetter->add_content (Entry.body ()); typesetter->add_content (Entry.body ());
@ -77,7 +77,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::IJournalEntry const & Entry) void operator () (JournalViewModel::JournalEntry const & Entry)
{ {
if (add_header) if (add_header)
{ {
@ -102,7 +102,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::ITopicEntry const & Entry) void operator () (JournalViewModel::TopicEntry const & Entry)
{ {
typesetter->write (body_style, Entry.source ()); typesetter->write (body_style, Entry.source ());
typesetter->write (body_style, 0, 3);// begin typesetter->write (body_style, 0, 3);// begin
@ -123,7 +123,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::utf8_span topicName) void operator () (JournalViewModel::utf8_span topicName)
{ {
typesetter->write (body_style, topicName); typesetter->write (body_style, topicName);
typesetter->sectionBreak (10); typesetter->sectionBreak (10);
@ -137,7 +137,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::utf8_span topicName) void operator () (JournalViewModel::utf8_span topicName)
{ {
typesetter->write (body_style, topicName); typesetter->write (body_style, topicName);
typesetter->sectionBreak (10); typesetter->sectionBreak (10);
@ -151,7 +151,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::topic_id topicId, IJournalViewModel::utf8_span name) void operator () (JournalViewModel::topic_id topicId, JournalViewModel::utf8_span name)
{ {
BookTypesetter::Style* link = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, topicId); BookTypesetter::Style* link = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, topicId);
@ -167,7 +167,7 @@ namespace
{ {
} }
void operator () (IJournalViewModel::quest_id id, IJournalViewModel::utf8_span name) void operator () (JournalViewModel::quest_id id, JournalViewModel::utf8_span name)
{ {
BookTypesetter::Style* style = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, id); BookTypesetter::Style* style = typesetter->createHotStyle (body_style, MyGUI::Colour::Black, linkHot, linkActive, id);
@ -179,7 +179,7 @@ namespace
typedef TypesetBook::ptr book; typedef TypesetBook::ptr book;
JournalBooks::JournalBooks (IJournalViewModel::ptr Model) : JournalBooks::JournalBooks (JournalViewModel::ptr Model) :
Model (Model) Model (Model)
{ {
} }

View file

@ -9,9 +9,9 @@ namespace MWGui
struct JournalBooks struct JournalBooks
{ {
typedef TypesetBook::ptr book; typedef TypesetBook::ptr book;
IJournalViewModel::ptr Model; JournalViewModel::ptr Model;
JournalBooks (IJournalViewModel::ptr Model); JournalBooks (JournalViewModel::ptr Model);
book createEmptyJournalBook (); book createEmptyJournalBook ();
book createJournalBook (); book createJournalBook ();

View file

@ -15,7 +15,7 @@
using namespace MWGui; using namespace MWGui;
namespace MWGui { struct JournalViewModel; } namespace MWGui { struct JournalViewModelImpl; }
static void injectMonthName (std::ostream & os, int month); static void injectMonthName (std::ostream & os, int month);
@ -148,7 +148,7 @@ private:
std::locale mLocale; std::locale mLocale;
}; };
struct MWGui::JournalViewModel : IJournalViewModel struct MWGui::JournalViewModelImpl : JournalViewModel
{ {
typedef KeywordSearch <std::string, intptr_t> keyword_search_t; typedef KeywordSearch <std::string, intptr_t> keyword_search_t;
@ -157,12 +157,12 @@ struct MWGui::JournalViewModel : IJournalViewModel
std::locale mLocale; std::locale mLocale;
JournalViewModel () JournalViewModelImpl ()
{ {
mKeywordSearchLoaded = false; mKeywordSearchLoaded = false;
} }
virtual ~JournalViewModel () virtual ~JournalViewModelImpl ()
{ {
} }
@ -215,9 +215,9 @@ struct MWGui::JournalViewModel : IJournalViewModel
typedef t_iterator iterator_t; typedef t_iterator iterator_t;
iterator_t itr; iterator_t itr;
JournalViewModel const * Model; JournalViewModelImpl const * Model;
BaseEntry (JournalViewModel const * Model, iterator_t itr) : BaseEntry (JournalViewModelImpl const * Model, iterator_t itr) :
Model (Model), itr (itr), loaded (false) Model (Model), itr (itr), loaded (false)
{} {}
@ -292,14 +292,14 @@ struct MWGui::JournalViewModel : IJournalViewModel
} }
template <typename iterator_t> template <typename iterator_t>
struct JournalEntry : BaseEntry <iterator_t, IJournalEntry> struct JournalEntryImpl : BaseEntry <iterator_t, JournalEntry>
{ {
using BaseEntry <iterator_t, IJournalEntry>::itr; using BaseEntry <iterator_t, JournalEntry>::itr;
mutable std::string timestamp_buffer; mutable std::string timestamp_buffer;
JournalEntry (JournalViewModel const * Model, iterator_t itr) : JournalEntryImpl (JournalViewModelImpl const * Model, iterator_t itr) :
BaseEntry <iterator_t, IJournalEntry> (Model, itr) BaseEntry <iterator_t, JournalEntry> (Model, itr)
{} {}
std::string getText () const std::string getText () const
@ -326,7 +326,7 @@ struct MWGui::JournalViewModel : IJournalViewModel
} }
}; };
void visitJournalEntries (quest_id questId, boost::function <void (IJournalEntry const &)> visitor) const void visitJournalEntries (quest_id questId, boost::function <void (JournalEntry const &)> visitor) const
{ {
MWBase::Journal * journal = MWBase::Environment::get().getJournal(); MWBase::Journal * journal = MWBase::Environment::get().getJournal();
@ -339,14 +339,14 @@ struct MWGui::JournalViewModel : IJournalViewModel
for (MWDialogue::Topic::TEntryIter j = quest->begin (); j != quest->end (); ++j) for (MWDialogue::Topic::TEntryIter j = quest->begin (); j != quest->end (); ++j)
{ {
if (i->mInfoId == *j) if (i->mInfoId == *j)
visitor (JournalEntry <MWBase::Journal::TEntryIter> (this, i)); visitor (JournalEntryImpl <MWBase::Journal::TEntryIter> (this, i));
} }
} }
} }
else else
{ {
for(MWBase::Journal::TEntryIter i = journal->begin(); i != journal->end (); ++i) for(MWBase::Journal::TEntryIter i = journal->begin(); i != journal->end (); ++i)
visitor (JournalEntry <MWBase::Journal::TEntryIter> (this, i)); visitor (JournalEntryImpl <MWBase::Journal::TEntryIter> (this, i));
} }
} }
@ -376,13 +376,13 @@ struct MWGui::JournalViewModel : IJournalViewModel
} }
struct topicEntry : BaseEntry <MWDialogue::Topic::TEntryIter, ITopicEntry> struct TopicEntryImpl : BaseEntry <MWDialogue::Topic::TEntryIter, TopicEntry>
{ {
MWDialogue::Topic const & Topic; MWDialogue::Topic const & Topic;
mutable std::string source_buffer; mutable std::string source_buffer;
topicEntry (JournalViewModel const * Model, MWDialogue::Topic const & Topic, iterator_t itr) : TopicEntryImpl (JournalViewModelImpl const * Model, MWDialogue::Topic const & Topic, iterator_t itr) :
BaseEntry (Model, itr), Topic (Topic) BaseEntry (Model, itr), Topic (Topic)
{} {}
@ -401,14 +401,14 @@ struct MWGui::JournalViewModel : IJournalViewModel
}; };
void visitTopicEntries (topic_id topicId, boost::function <void (ITopicEntry const &)> visitor) const void visitTopicEntries (topic_id topicId, boost::function <void (TopicEntry const &)> visitor) const
{ {
typedef MWDialogue::Topic::TEntryIter iterator_t; typedef MWDialogue::Topic::TEntryIter iterator_t;
MWDialogue::Topic const & Topic = * reinterpret_cast <MWDialogue::Topic const *> (topicId); MWDialogue::Topic const & Topic = * reinterpret_cast <MWDialogue::Topic const *> (topicId);
for (iterator_t i = Topic.begin (); i != Topic.end (); ++i) for (iterator_t i = Topic.begin (); i != Topic.end (); ++i)
visitor (topicEntry (this, Topic, i)); visitor (TopicEntryImpl (this, Topic, i));
} }
}; };
@ -466,7 +466,7 @@ static void injectMonthName (std::ostream & os, int month)
#endif #endif
} }
IJournalViewModel::ptr IJournalViewModel::create () JournalViewModel::ptr JournalViewModel::create ()
{ {
return boost::make_shared <JournalViewModel> (); return boost::make_shared <JournalViewModelImpl> ();
} }

View file

@ -16,9 +16,9 @@ namespace MWGui
// specifically to the needs of the journal GUI. It isolates // specifically to the needs of the journal GUI. It isolates
/// the journal GUI from the implementation details of the /// the journal GUI from the implementation details of the
/// game data store. /// game data store.
struct IJournalViewModel struct JournalViewModel
{ {
typedef boost::shared_ptr <IJournalViewModel> ptr; typedef boost::shared_ptr <JournalViewModel> ptr;
typedef intptr_t quest_id; typedef intptr_t quest_id;
typedef intptr_t topic_id; typedef intptr_t topic_id;
@ -26,7 +26,7 @@ namespace MWGui
typedef std::pair <utf8_point, utf8_point> utf8_span; typedef std::pair <utf8_point, utf8_point> utf8_span;
/// The base interface for both journal entries and topics. /// The base interface for both journal entries and topics.
struct IEntry struct Entry
{ {
/// returns the body text for the journal entry /// returns the body text for the journal entry
/// ///
@ -42,7 +42,7 @@ namespace MWGui
}; };
/// An interface to topic data. /// An interface to topic data.
struct ITopicEntry : IEntry struct TopicEntry : Entry
{ {
/// Returns a pre-formatted span of UTF8 encoded text representing /// Returns a pre-formatted span of UTF8 encoded text representing
/// the name of the NPC this portion of dialog was heard from. /// the name of the NPC this portion of dialog was heard from.
@ -50,7 +50,7 @@ namespace MWGui
}; };
/// An interface to journal data. /// An interface to journal data.
struct IJournalEntry : IEntry struct JournalEntry : Entry
{ {
/// Returns a pre-formatted span of UTF8 encoded text representing /// Returns a pre-formatted span of UTF8 encoded text representing
/// the in-game date this entry was added to the journal. /// the in-game date this entry was added to the journal.
@ -74,7 +74,7 @@ namespace MWGui
virtual void visitQuestNames (bool active_only, boost::function <void (quest_id, utf8_span)> visitor) const = 0; virtual void visitQuestNames (bool active_only, boost::function <void (quest_id, utf8_span)> visitor) const = 0;
/// walks over the journal entries related to the specified quest identified by its id /// walks over the journal entries related to the specified quest identified by its id
virtual void visitJournalEntries (quest_id questId, boost::function <void (IJournalEntry const &)> visitor) const = 0; virtual void visitJournalEntries (quest_id questId, boost::function <void (JournalEntry const &)> visitor) const = 0;
/// provides the name of the topic specified by its id /// provides the name of the topic specified by its id
virtual void visitTopicName (topic_id topicId, boost::function <void (utf8_span)> visitor) const = 0; virtual void visitTopicName (topic_id topicId, boost::function <void (utf8_span)> visitor) const = 0;
@ -83,7 +83,7 @@ namespace MWGui
virtual void visitTopicNamesStartingWith (int character, boost::function < void (topic_id , utf8_span) > visitor) const = 0; virtual void visitTopicNamesStartingWith (int character, boost::function < void (topic_id , utf8_span) > visitor) const = 0;
/// walks over the topic entries for the topic specified by its identifier /// walks over the topic entries for the topic specified by its identifier
virtual void visitTopicEntries (topic_id topicId, boost::function <void (ITopicEntry const &)> visitor) const = 0; virtual void visitTopicEntries (topic_id topicId, boost::function <void (TopicEntry const &)> visitor) const = 0;
// create an instance of the default journal view model implementation // create an instance of the default journal view model implementation
static ptr create (); static ptr create ();

View file

@ -94,7 +94,7 @@ namespace
return getWidget <MWGui::BookPage> (name); return getWidget <MWGui::BookPage> (name);
} }
JournalWindowImpl (IJournalViewModel::ptr Model) JournalWindowImpl (JournalViewModel::ptr Model)
: WindowBase("openmw_journal.layout"), JournalBooks (Model) : WindowBase("openmw_journal.layout"), JournalBooks (Model)
{ {
mMainWidget->setVisible(false); mMainWidget->setVisible(false);
@ -420,7 +420,7 @@ namespace
} }
// glue the implementation to the interface // glue the implementation to the interface
IJournalWindow * MWGui::JournalWindow::create (IJournalViewModel::ptr Model) JournalWindow * MWGui::JournalWindow::create (JournalViewModel::ptr Model)
{ {
return new JournalWindowImpl (Model); return new JournalWindowImpl (Model);
} }

View file

@ -8,12 +8,12 @@ namespace MWBase { class WindowManager; }
namespace MWGui namespace MWGui
{ {
struct IJournalViewModel; struct JournalViewModel;
struct JournalWindow struct JournalWindow
{ {
/// construct a new instance of the one JournalWindow implementation /// construct a new instance of the one JournalWindow implementation
static JournalWindow * create (boost::shared_ptr <IJournalViewModel> Model); static JournalWindow * create (boost::shared_ptr <JournalViewModel> Model);
/// destroy this instance of the JournalWindow implementation /// destroy this instance of the JournalWindow implementation
virtual ~JournalWindow () {}; virtual ~JournalWindow () {};

View file

@ -148,7 +148,7 @@ namespace MWGui
mMap = new MapWindow(cacheDir); mMap = new MapWindow(cacheDir);
mStatsWindow = new StatsWindow(); mStatsWindow = new StatsWindow();
mConsole = new Console(w,h, consoleOnlyScripts); mConsole = new Console(w,h, consoleOnlyScripts);
mJournal = JournalWindow::create(IJournalViewModel::create ()); mJournal = JournalWindow::create(JournalViewModel::create ());
mMessageBoxManager = new MessageBoxManager(); mMessageBoxManager = new MessageBoxManager();
mInventoryWindow = new InventoryWindow(mDragAndDrop); mInventoryWindow = new InventoryWindow(mDragAndDrop);
mTradeWindow = new TradeWindow(); mTradeWindow = new TradeWindow();