Scopira  20080306
scopira::core::model_i Class Reference

#include <model.h>

Inheritance diagram for scopira::core::model_i:
scopira::tool::object scopira::core::project_i scopira::core::project_base

Public Member Functions

virtual bool load (scopira::tool::iobjflow_i &in)
 for title, mostly
 
virtual void save (scopira::tool::oobjflow_i &out) const
 for title, mostly
 
virtual void set_title (const std::string &newtitle)
 
virtual bool is_project (void) const
 
const std::string & get_title (void) const
 
void add_view (view_i *ins) const
 
void remove_view (view_i *ins) const
 
void notify_views (view_i *src)
 
void add_rename_reactor (tool::rename_reactor_i *r) const
 
void remove_rename_reactor (tool::rename_reactor_i *r) const
 
virtual void set_project (project_i *newowner)
 
project_iget_project (void) const
 
void set_tagged_model (const std::string &name, model_i *what)
 
template<class W >
bool get_tagged_model (const std::string &name, W &out)
 
- Public Member Functions inherited from scopira::tool::object
virtual ~object ()
 
int add_ref (void) const
 
bool sub_ref (void) const
 
void auto_ref (void) const
 
int current_ref (void) const
 
virtual scopira::tool::oflow_iprint (scopira::tool::oflow_i &o) const
 
bool is_alive_object (void) const
 
bool is_dead_object (void) const
 

Protected Member Functions

 model_i (void)
 Default initing ctor.
 
 model_i (const std::string &title)
 title initing ctor
 
 model_i (const model_i &src)
 copy ctor
 
virtual ~model_i ()
 dtor (mainly, to flush the cache
 
- Protected Member Functions inherited from scopira::tool::object
 object (void)
 
 object (bool neverusecounter)
 

Detailed Description

A model_i. Multiple views can monitor and watch an instance of this.

If your descendant is serializable, YOU must handle the saveing/loading of dm_title, if need be (or just call model_i::save/load())

Author
Aleksander Demko

Member Function Documentation

◆ add_rename_reactor()

void scopira::core::model_i::add_rename_reactor ( tool::rename_reactor_i r) const

Adds a new rename reactor that will listen to rename events.

Author
Aleksander Demko

◆ add_view()

void scopira::core::model_i::add_view ( view_i ins) const

Adds an view to this model_i's watch list. The view's bind_model will be called. This ptr will not be count_ptr'ed here.

Author
Aleksander Demko

◆ get_project()

project_i* scopira::core::model_i::get_project ( void  ) const
inline

Gets the current owner – may be 0 if this record currently does not have an owner.

Author
Aleksander Demko

◆ get_tagged_model()

template<class W >
bool scopira::core::model_i::get_tagged_model ( const std::string &  name,
W &  out 
)
inline

Gets the tagged model attached to this type.

Parameters
namethe model name
outwhere to place the model, this should be a count_ptr or model_ptr of your type
Returns
true on success (and fillsin out).
Author
Aleksander Demko

References scopira::tool::count_ptr< T >::get(), and scopira::tool::count_ptr< T >::is_null().

◆ get_title()

const std::string& scopira::core::model_i::get_title ( void  ) const
inline

Gets the current title

Author
Aleksander Demko

◆ is_project()

virtual bool scopira::core::model_i::is_project ( void  ) const
inlinevirtual

Is this a model project?

Author
Aleksander Demko

Reimplemented in scopira::core::project_i.

◆ notify_views()

void scopira::core::model_i::notify_views ( view_i src)

Calls viewodel() on all the current views that are watching this model_i, with the given src. The src view will NOT have his viewodel method called, however. src may be null (in which case all the views are called)

Author
Aleksander Demko

◆ remove_rename_reactor()

void scopira::core::model_i::remove_rename_reactor ( tool::rename_reactor_i r) const

Removes a rename reactor from the listing list

Author
Aleksander Demko

◆ remove_view()

void scopira::core::model_i::remove_view ( view_i ins) const

Removes an view from this model_i's watch list. The view's bind_model will be called.

Author
Aleksander Demko

◆ set_project()

virtual void scopira::core::model_i::set_project ( project_i newowner)
virtual

Sets the owning project. project do this themselves in their add_record calls. May be 0 to clear the previous owner. Descendants should call this version, which (for now), simply sets dm_owner.

Author
Aleksander Demko

◆ set_tagged_model()

void scopira::core::model_i::set_tagged_model ( const std::string &  name,
model_i what 
)

Sets a tagged (named) model attached to this model.

Author
Aleksander Demko

◆ set_title()

virtual void scopira::core::model_i::set_title ( const std::string &  newtitle)
virtual

Sets the title. Descendants may override this to do addtional actions on a title change request, but they should make sure to call this one evetually.

Author
Aleksander Demko

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