NCL Composer  0.1.5
 All Classes Functions Variables Pages
composer::core::model::Project Class Reference

A Project is a data structure that will keep all Entities and all plugin data in a same place. More...

#include <Project.h>

Inheritance diagram for composer::core::model::Project:
Collaboration diagram for composer::core::model::Project:

Signals

void dirtyProject (bool isDirty)
 

Public Member Functions

EntitygetEntityById (QString _id)
 Returns the Entity with the unique id __id. More...
 
QList< Entity * > getEntitiesbyType (QString _type)
 Returns a list of the entities which are of the type __type. More...
 
QString getLocation ()
 Returns the location of the project. More...
 
QString getProjectId ()
 Returns the Identifier of this project. More...
 
LanguageType getProjectType ()
 Returns the type of the project.
 
QByteArray getPluginData (QString pluginId)
 Returns the specific data of a plugin. More...
 
QString generateUniqueNCLId (const QString &tagname)
 Generate a descritor NCLID that are not present in the core.
 
QList< Entity * > getEntityByAttrId (const QString &id)
 
bool isDirty ()
 
QString getAttribute (QString name)
 This method is used to get an specific attribute of the element. More...
 
void getAttributeIterator (QMap< QString, QString >::iterator &begin, QMap< QString, QString >::iterator &end)
 This method is used to get the iterator in the <map> of attributes. More...
 
bool hasAttribute (const QString &name)
 This method is used to verify if this element has certain attribute. More...
 
QString getUniqueId ()
 
QString getType ()
 
EntitygetParent ()
 
QString getParentUniqueId ()
 
void setDeleteChildren (bool mustDelete)
 Tell if the children should be deleted when this entity is deleted through destructor. More...
 
QVector< Entity * > getChildren ()
 
QString toString (int ntabs, bool writeuid=true)
 Convert the current Entity to a XML String. More...
 
EntitycloneEntity ()
 Creates a clone of the current entity. More...
 

Protected Member Functions

 Project (QObject *parent=0)
 Constructor. More...
 
 Project (QMap< QString, QString > &atts, QObject *parent=0)
 Constructor. More...
 
 Project (QString uniqueId, QMap< QString, QString > &atts, QObject *parent=0)
 Constructor. More...
 
 ~Project ()
 Destructor;.
 
void setLocation (QString location)
 Set the location of the project. More...
 
void setProjectType (LanguageType type)
 Set the type of the project.s. More...
 
void setModelString (const QString &model)
 Replaces the current string that represents the model. More...
 
QString getModelString ()
 Returns the current model as a string. More...
 
bool addEntity (Entity *entity, QString parentId) throw (EntityNotFound, ParentNotFound)
 This method is used to add an Entity in the map and as child of the parentId. More...
 
bool setPluginData (QString pluginId, const QByteArray data)
 Sets specific plugin data to project file. More...
 
bool removeEntity (Entity *entity, bool appendChild) throw (EntityNotFound)
 This method is used to remove and delete an Entity from the map. More...
 
QString toString ()
 Transforms the current project to a string. More...
 
void setDirty (bool isDirty)
 This slot must be called when there are some data (on the plugin data or on the model) that are not synchronized with the saved file.
 
void setAttribute (QString name, QString value)
 This method is used to set an specific attribute of the element. More...
 
void setAtrributes (QMap< QString, QString > &newatts)
 Set the attributes of the current entity to the value passed as parameter. More...
 
void setType (QString type)
 Set the entity's type to the value passed as parameter. More...
 
void setUniqueID (QString uniqueId)
 Set the unique identifier of the entity to the value passed as parameter. More...
 
void setParent (Entity *parent)
 Set the parent of the Entity. More...
 
bool addChild (Entity *entity)
 
bool deleteChild (Entity *entity)
 This call deletes the child and his children in a recursive way. More...
 
bool removeChildAppendChildren (Entity *entity)
 This call removes the child and append his children to his parent. More...
 
void print ()
 Prints the Entity and its children.
 

Protected Attributes

QString model
 Keeps the model as an string (this will be useful for serialize the model. More...
 

Friends

class composer::core::PluginControl
 
class composer::core::MessageControl
 
class composer::core::ProjectControl
 
class composer::core::ProjectReader
 
class composer::core::util::EditCommand
 
class composer::core::util::AddCommand
 
class composer::core::util::RemoveCommand
 

Detailed Description

A Project is a data structure that will keep all Entities and all plugin data in a same place.

Definition at line 48 of file Project.h.

Constructor & Destructor Documentation

composer::core::model::Project::Project ( QObject *  parent = 0)
explicitprotected

Constructor.

Parameters
parent

Definition at line 18 of file Project.cpp.

Here is the call graph for this function:

composer::core::model::Project::Project ( QMap< QString, QString > &  atts,
QObject *  parent = 0 
)
protected

Constructor.

Parameters
atts
parent

Definition at line 28 of file Project.cpp.

Here is the call graph for this function:

composer::core::model::Project::Project ( QString  uniqueId,
QMap< QString, QString > &  atts,
QObject *  parent = 0 
)
protected

Constructor.

Parameters
uniqueId
atts
parent

Definition at line 38 of file Project.cpp.

Member Function Documentation

bool composer::core::model::Project::addEntity ( Entity entity,
QString  parentId 
)
throw (EntityNotFound,
ParentNotFound
)
protected

This method is used to add an Entity in the map and as child of the parentId.

Parameters
entity- A Entity to be added
parentId- A QString identifying the parent to be added as a child.
Returns
true if success and false otherwise.
Parameters
entity
parentId

Definition at line 100 of file Project.cpp.

Here is the caller graph for this function:

Entity * composer::core::model::Entity::cloneEntity ( )
inherited

Creates a clone of the current entity.

All the content of the entity will be cloned, including its uniqueId.

Definition at line 246 of file Entity.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool composer::core::model::Entity::deleteChild ( Entity entity)
protectedinherited

This call deletes the child and his children in a recursive way.

Deletes the child and its children in a recursive way.

Parameters
entityThe Entity child to be removed.

Definition at line 113 of file Entity.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString composer::core::model::Entity::getAttribute ( QString  name)
inherited

This method is used to get an specific attribute of the element.

Parameters
name- The name of the attribute been requested
Returns
A string with the requested attribute.

Definition at line 130 of file Entity.cpp.

void composer::core::model::Entity::getAttributeIterator ( QMap< QString, QString >::iterator &  begin,
QMap< QString, QString >::iterator &  end 
)
inherited

This method is used to get the iterator in the <map> of attributes.

Parameters
begin- a reference to be filled with the begin of the map.
end- a reference to be filled with the end of the map.

Definition at line 136 of file Entity.cpp.

QList< Entity * > composer::core::model::Project::getEntitiesbyType ( QString  _type)

Returns a list of the entities which are of the type __type.

Parameters
_typeThe entity type required.

Definition at line 72 of file Project.cpp.

Here is the caller graph for this function:

Entity * composer::core::model::Project::getEntityById ( QString  _id)

Returns the Entity with the unique id __id.

Parameters
_idThe Unique Identifier of the required entity.

Definition at line 66 of file Project.cpp.

Here is the caller graph for this function:

QString composer::core::model::Project::getLocation ( )

Returns the location of the project.

Todo:
This could be a URL.

Definition at line 88 of file Project.cpp.

QString composer::core::model::Project::getModelString ( )
inlineprotected

Returns the current model as a string.

Returns
QString the current model as a string.

Definition at line 176 of file Project.h.

QByteArray composer::core::model::Project::getPluginData ( QString  pluginId)

Returns the specific data of a plugin.

Parameters
pluginId

Definition at line 200 of file Project.cpp.

QString composer::core::model::Project::getProjectId ( )

Returns the Identifier of this project.

A project type says for what language this project is. Currently, there are suport only for NCL projects.

bool composer::core::model::Entity::hasAttribute ( const QString &  name)
inherited

This method is used to verify if this element has certain attribute.

Parameters
name- The name of the attribute to be verified.
Returns
an boolean depending of the existence of the attribute.

Definition at line 144 of file Entity.cpp.

bool composer::core::model::Entity::removeChildAppendChildren ( Entity entity)
protectedinherited

This call removes the child and append his children to his parent.

Removes the child and append his children to his parent.

Parameters
entity

Definition at line 185 of file Entity.cpp.

Here is the call graph for this function:

bool composer::core::model::Project::removeEntity ( Entity entity,
bool  appendChild 
)
throw (EntityNotFound
)
protected

This method is used to remove and delete an Entity from the map.

Parameters
entity- A Entity to be removed
appendChild- If true the children of Entity will be appended in the parentEntity. If false all the children are also deleted.
Returns
an boolean depending on the success
Parameters
entity
appendChild

Definition at line 123 of file Project.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void composer::core::model::Entity::setAtrributes ( QMap< QString, QString > &  newatts)
protectedinherited

Set the attributes of the current entity to the value passed as parameter.

Parameters
newAttsthe new value of entity's attributes.

Definition at line 68 of file Entity.cpp.

Here is the caller graph for this function:

void composer::core::model::Entity::setAttribute ( QString  name,
QString  value 
)
protectedinherited

This method is used to set an specific attribute of the element.

Parameters
name- The name of the attribute to be set
value- The value this attribute is going to be set

Definition at line 62 of file Entity.cpp.

void composer::core::model::Entity::setDeleteChildren ( bool  mustDelete)
inherited

Tell if the children should be deleted when this entity is deleted through destructor.

Parameters
mustDeletetell if the children also must be deleted.

Definition at line 173 of file Entity.cpp.

Here is the caller graph for this function:

void composer::core::model::Project::setLocation ( QString  location)
protected

Set the location of the project.

Todo:
The locations should be an URL.
Parameters
locationthe location of the project.

Definition at line 94 of file Project.cpp.

Here is the caller graph for this function:

void composer::core::model::Project::setModelString ( const QString &  model)
inlineprotected

Replaces the current string that represents the model.

Parameters
modelThe new model as a string.

Definition at line 170 of file Project.h.

void composer::core::model::Entity::setParent ( Entity parent)
protectedinherited

Set the parent of the Entity.

Parameters
parentThe new parent of this Entity.

Definition at line 91 of file Entity.cpp.

Here is the caller graph for this function:

bool composer::core::model::Project::setPluginData ( QString  pluginId,
const QByteArray  data 
)
protected

Sets specific plugin data to project file.

Parameters
pluginIdthe plugin identifier that we want to set
data

Definition at line 192 of file Project.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void composer::core::model::Project::setProjectType ( LanguageType  type)
protected

Set the type of the project.s.

Parameters
typeThe type of the project. Currently, there are support just for NCL projects.

Definition at line 61 of file Project.cpp.

Here is the caller graph for this function:

void composer::core::model::Entity::setType ( QString  type)
protectedinherited

Set the entity's type to the value passed as parameter.

Parameters
typeThe type of the entity.

Definition at line 79 of file Entity.cpp.

Here is the caller graph for this function:

void composer::core::model::Entity::setUniqueID ( QString  uniqueId)
protectedinherited

Set the unique identifier of the entity to the value passed as parameter.

Parameters
_idThe new uniqueId of the entity.

Definition at line 85 of file Entity.cpp.

Here is the caller graph for this function:

QString composer::core::model::Entity::toString ( int  ntabs,
bool  writeuid = true 
)
inherited

Convert the current Entity to a XML String.

Parameters
ntabsthe number of tabs to be inserted before the current entity.

Definition at line 210 of file Entity.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString composer::core::model::Project::toString ( )
protected

Transforms the current project to a string.

This string will contain the internal model and the specific plugins data.

Todo:
Return a string to be saved in hard disk.

Definition at line 172 of file Project.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

QString composer::core::model::Project::model
protected

Keeps the model as an string (this will be useful for serialize the model.

Definition at line 163 of file Project.h.


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