# gcu::Document Class Reference

`#include <gcu/document.h>`

Inheritance diagram for gcu::Document:

List of all members.

## Public Member Functions

| Document (Application *App=NULL)
virtual | ~Document ()
std::string & | GetTranslatedId (const char *id)
void | EraseTranslationId (const char *Id)
void | EmptyTranslationTable ()
void | SetTitle (std::string &title)
void | SetTitle (char const *title)
std::string & | GetTitle ()
void | NotifyDirty (Object *pObject)
virtual void | Save () const
virtual Residue * | CreateResidue (char const *name, char const *symbol, Molecule *molecule)
virtual Residue const * | GetResidue (char const *symbol, bool *ambiguous=NULL)
Application * | GetApp (void)
bool | GetEmpty (void)
double | GetScale (void)

## Protected Attributes

std::string | m_Title
std::set< Object * > | m_DirtyObjects
Application * | m_App
bool | m_Empty
double | m_Scale

## Detailed Description

This class is the base document class.

Definition at line 47 of file gcu/document.h.

## Constructor & Destructor Documentation

gcu::Document::Document | ( | Application * | App = `NULL` | ) |

Parameters:

  | App | the Appllcation which owns the new document.

The default constructor. Creates an empty document.

virtual gcu::Document::~Document | ( |  | ) | `[virtual]`

The destructor of Document.

Reimplemented in gcp::Document.

## Member Function Documentation

std::string& gcu::Document::GetTranslatedId | ( | const char * | id | ) | `[inline]`

Parameters:

  | id | the original id to tranlate

When pasting, objects added to the document might have the same Id as objects already existing. In such cases, the document maintains a table to update links using Ids as identifiers. GetTranslatedId returns the translated id corresponding to the parameter id.

Definition at line 72 of file gcu/document.h.

void gcu::Document::EraseTranslationId | ( | const char * | Id | ) | `[inline]`

Parameters:

  | Id | the entry to remove

When pasting, objects added to the document might have the same Id as objects already existing. In such cases, the document maintains a table to update links using Ids as identifiers. The EraseTranslationTable method removes thenentry correspondig to id.

Definition at line 80 of file gcu/document.h.

void gcu::Document::EmptyTranslationTable | ( |  | ) | `[inline]`

When pasting, objects added to the document might have the same Id as objects already existing. In such cases, the document maintains a table to update links using Ids as identifiers. The EmptyTranslationTable method should be called after pasting to reinitialize the table to avoid errors on the next paste event.

Definition at line 87 of file gcu/document.h.

void gcu::Document::SetTitle | ( | std::string & | title | ) | `[inline]`

Parameters:

  | title | the new document title.

Definition at line 92 of file gcu/document.h.

References m_Title.

void gcu::Document::SetTitle | ( | char const * | title | ) | `[inline]`

Parameters:

  | title | the new document title.

Definition at line 96 of file gcu/document.h.

References m_Title.

std::string& gcu::Document::GetTitle | ( |  | ) | `[inline]`

Returns:
  the current document title.

Reimplemented in gcu::Chem3dDoc.

Definition at line 100 of file gcu/document.h.

References m_Title.

void gcu::Document::NotifyDirty | ( | Object * | pObject | ) | `[inline]`

Parameters:

  | pObject | an object needing some update.

The gcu::Document class just stores dirty objects, but don't do anything with them. Derived classes need to implement that, if meaningful.

Definition at line 108 of file gcu/document.h.

References m_DirtyObjects.

virtual void gcu::Document::Save | ( |  | ) | const`[inline, virtual]`

Saves the document. Need to be overloaded by derived class if meaningful. Default implementation doesn't do anything.

Reimplemented in gcp::Document.

Definition at line 113 of file gcu/document.h.

virtual Residue* gcu::Document::CreateResidue | ( | char const * | name,
|  | char const * | symbol,
|  | Molecule * | molecule |
| ) |  |  | `[virtual]`

Parameters:

  | name | the name of the new residue.
  | symbol | the symbol of the new residue.
  | molecule | a molecule with a pseudo atom which describes the structure of the residue.

This methodshould be overloaded by derived classes necessitating it. Default implementation just returns NULL.

Returns:
  the new Residue on success or NULL.

Reimplemented in gcp::Document.

virtual Residue const* gcu::Document::GetResidue | ( | char const * | symbol,
|  | bool * | ambiguous = `NULL` |
| ) |  |  | `[virtual]`

Parameters:

  | symbol | the symbol for which a Residue* is searched.
  | ambiguous | where to store the boolean telling if the symbol is ambiguous or NULL.

Documents might own not global residues with the samesymbol or name but a different meaning from the standard residue.

Returns:
  the Residue* found or NULL.

Reimplemented in gcp::Document.

gcu::Document::GetApp | ( | void |  | ) | `[inline]`

Returns:
  a pointer to the Appication instance owning the ocument or NULL for an orphan document.

Definition at line 170 of file gcu/document.h.

gcu::Document::GetEmpty | ( | void |  | ) | `[inline]`

Returns:
  true if the document does not contain anything, false otherwise.

Reimplemented in gcu::SpectrumDocument.

Definition at line 177 of file gcu/document.h.

gcu::Document::GetScale | ( | void |  | ) | `[inline]`

Returns:
  the current scale factor.

Definition at line 185 of file gcu/document.h.

## Member Data Documentation

std::string gcu::Document::m_Title `[protected]`

The document title.

Definition at line 156 of file gcu/document.h.

Referenced by GetTitle(), and SetTitle().

std::set<Object*> gcu::Document::m_DirtyObjects `[protected]`

The set of dirty objects, see gcu::Document::NotifyDirty.

Definition at line 161 of file gcu/document.h.

Referenced by NotifyDirty().

gcu::Document::m_App `[protected]`

The Application instance owning the document.

Definition at line 170 of file gcu/document.h.

gcu::Document::m_Empty `[protected]`

Tells if the document is empty or not.

Definition at line 177 of file gcu/document.h.

gcu::Document::m_Scale `[protected]`

The scale factor to be used in IO operations. all coordinates should be multiplied by this factor when loading and divided when saving. Default value is 1.

Definition at line 185 of file gcu/document.h.

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

- gcu/document.h