libglom-1.32 1.31.6

- Main Page
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GlomBakery::Document Class Reference

The Document is like the 'Model' in the Model-View-Controller framework. More...

Inheritance diagram for GlomBakery::Document:
[legend]
Collaboration diagram for GlomBakery::Document:
[legend]

## Public Types
enum | LoadFailureCodes { LoadFailureCodes::NONE = 0, LoadFailureCodes::NOT_FOUND = 1, LoadFailureCodes::LAST = 20 }
typedef sigc::signal< void(bool)> | type_signal_modified
| For instance, void on_document_modified(bool modified);. More...

## Public Member Functions
| Document ()
virtual | ~Document ()
bool | save ()
bool | load (int& failure_code)
bool | load_from_data (const guchar* data, std::size_t length, int& failure_code)
bool | get_modified () const
virtual void | set_modified (bool value=true)
bool | get_is_new () const
| Whether this just a default document. More...
void | set_is_new (bool value)
| Called by AppWindow_WithDoc::init_create_document(). More...
Glib::ustring | get_contents () const
Glib::ustring | get_file_uri_with_extension (const Glib::ustring& uri)
Glib::ustring | get_file_uri () const
virtual void | set_file_uri (const Glib::ustring& file_uri, bool bEnforceFileExtension=false)
virtual Glib::ustring | get_name () const
| Gets filename part of file_uri, or 'untitled'. More...
bool | get_read_only () const
void | set_read_only (bool value)
void | set_view (ViewBase* pView)
| If you don't want to use a View, then don't use set_view(). More...
ViewBase* | get_view ()
void | set_file_extension (const Glib::ustring& strVal)
Glib::ustring | get_file_extension () const
type_signal_modified& | signal_modified ()
| This signal is emitted when the document has been modified. More...

## Static Public Member Functions
static Glib::ustring | util_file_uri_get_name (const Glib::ustring& file_uri, const Glib::ustring& file_extension)

## Protected Member Functions
virtual bool | load_after (int& failure_code)
| Allow app to update icons/title bar. More...
virtual bool | save_before ()
| overrideable. More...
bool | read_from_disk (int& failure_code)
bool | write_to_disk ()

## Protected Attributes
Glib::ustring | m_strContents
Glib::ustring | m_file_uri
Glib::ustring | m_file_extension
ViewBase* | m_view
type_signal_modified | signal_modified_
bool | m_modified
bool | m_is_new
bool | m_read_only

## Detailed Description

The Document is like the 'Model' in the Model-View-Controller framework.

Each App should have a Document. Each View gets and sets data in its document.

## Member Typedef Documentation

typedef sigc::signal<void(bool)> GlomBakery::Document::type_signal_modified

For instance, void on_document_modified(bool modified);.

## Member Enumeration Documentation

enum GlomBakery::Document::LoadFailureCodes
| strong

Enumerator
NONE |
NOT_FOUND |
LAST |

## Constructor & Destructor Documentation

GlomBakery::Document::Document | ( |  | ) |

virtual GlomBakery::Document::~Document | ( |  | ) |
| virtual

## Member Function Documentation

Glib::ustring GlomBakery::Document::get_contents | ( |  | ) | const

Glib::ustring GlomBakery::Document::get_file_extension | ( |  | ) | const

Glib::ustring GlomBakery::Document::get_file_uri | ( |  | ) | const

Glib::ustring GlomBakery::Document::get_file_uri_with_extension | ( | const Glib::ustring & | uri | ) |

bool GlomBakery::Document::get_is_new | ( |  | ) | const

Whether this just a default document.

bool GlomBakery::Document::get_modified | ( |  | ) | const

virtual Glib::ustring GlomBakery::Document::get_name | ( |  | ) | const
| virtual

Gets filename part of file_uri, or 'untitled'.

Reimplemented in Glom::Document.

bool GlomBakery::Document::get_read_only | ( |  | ) | const

ViewBase* GlomBakery::Document::get_view | ( |  | ) |

bool GlomBakery::Document::load | ( | int & | failure_code | ) |

virtual bool GlomBakery::Document::load_after | ( | int & | failure_code | ) |
| protected virtual

Allow app to update icons/title bar.

overrideable. Does anything which should be done after the data has been loaded from disk, but before updating the View.

Parameters

  failure_code | Used to return a custom error code that is understood by your application. This must be greater than zero.

Reimplemented in GlomBakery::Document_XML.

bool GlomBakery::Document::load_from_data | ( | const guchar * | data,
|  | std::size_t | length,
|  | int & | failure_code
| ) |  |

bool GlomBakery::Document::read_from_disk | ( | int & | failure_code | ) |
| protected

bool GlomBakery::Document::save | ( |  | ) |

virtual bool GlomBakery::Document::save_before | ( |  | ) |
| protected virtual

overrideable.

Does anything which should be done before the view has saved its data, before writing to disk..

Reimplemented in GlomBakery::Document_XML.

void GlomBakery::Document::set_file_extension | ( | const Glib::ustring & | strVal | ) |

virtual void GlomBakery::Document::set_file_uri | ( | const Glib::ustring & | file_uri,
|  | bool | bEnforceFileExtension = `false`
| ) |  |
| virtual

Reimplemented in Glom::Document.

void GlomBakery::Document::set_is_new | ( | bool | value | ) |

Called by AppWindow_WithDoc::init_create_document().

virtual void GlomBakery::Document::set_modified | ( | bool | value = `true` | ) |
| virtual

Reimplemented in Glom::Document.

void GlomBakery::Document::set_read_only | ( | bool | value | ) |

void GlomBakery::Document::set_view | ( | ViewBase* | pView | ) |

If you don't want to use a View, then don't use set_view().

type_signal_modified& GlomBakery::Document::signal_modified | ( |  | ) |

This signal is emitted when the document has been modified.

It allows the view to update itself to show the new information.

static Glib::ustring GlomBakery::Document::util_file_uri_get_name | ( | const Glib::ustring & | file_uri,
|  | const Glib::ustring & | file_extension
| ) |  |
| static

bool GlomBakery::Document::write_to_disk | ( |  | ) |
| protected

## Member Data Documentation

Glib::ustring GlomBakery::Document::m_file_extension
| protected

Glib::ustring GlomBakery::Document::m_file_uri
| protected

bool GlomBakery::Document::m_is_new
| protected

bool GlomBakery::Document::m_modified
| protected

bool GlomBakery::Document::m_read_only
| protected

Glib::ustring GlomBakery::Document::m_strContents
| protected

ViewBase* GlomBakery::Document::m_view
| protected

type_signal_modified GlomBakery::Document::signal_modified_
| protected

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

- libglom/document/bakery/document.h