LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProjectMetadata Class Referencefinal

The ProjectMetadata class. More...

#include <projectmetadata.h>

+ Inheritance diagram for ProjectMetadata:
+ Collaboration diagram for ProjectMetadata:

Signals

void attributesChanged ()
 

Public Member Functions

 ProjectMetadata ()=delete
 
 ProjectMetadata (const ProjectMetadata &other)=delete
 
 ProjectMetadata (Project &project, bool restore, bool readOnly, bool create)
 
 ~ProjectMetadata () noexcept
 
ProjectgetProject () const noexcept
 
const UuidgetUuid () const noexcept
 
const ElementNamegetName () const noexcept
 Get the name of the project. More...
 
const QString & getAuthor () const noexcept
 Get the author of the project. More...
 
const QString & getVersion () const noexcept
 Get the version of the project. More...
 
const QDateTime & getCreated () const noexcept
 Get the date and time when the project was created. More...
 
const QDateTime & getLastModified () const noexcept
 Get the date and time when the project was last modified. More...
 
const AttributeListgetAttributes () const noexcept
 Get the list of attributes. More...
 
void setName (const ElementName &newName) noexcept
 Set the name of the project. More...
 
void setAuthor (const QString &newAuthor) noexcept
 Set the author of the project. More...
 
void setVersion (const QString &newVersion) noexcept
 Set the version of the project. More...
 
void setAttributes (const AttributeList &newAttributes) noexcept
 Set all project attributes. More...
 
void updateLastModified () noexcept
 Update the last modified datetime. More...
 
bool save (bool toOriginal, QStringList &errors) noexcept
 
ProjectMetadataoperator= (const ProjectMetadata &rhs)=delete
 
- Public Member Functions inherited from SerializableObject
 SerializableObject () noexcept
 
virtual ~SerializableObject () noexcept
 
SExpression serializeToDomElement (const QString &name) const
 Serialize the object to a new S-Expression node. More...
 

Private Member Functions

void serialize (SExpression &root) const override
 Serialize the object into an existing S-Expression node. More...
 

Private Attributes

ProjectmProject
 a reference to the Project object (from the ctor) More...
 
FilePath mFilepath
 
QScopedPointer< SmartSExprFilemFile
 
Uuid mUuid
 the UUID of the project More...
 
ElementName mName
 the name of the project More...
 
QString mAuthor
 the author of the project More...
 
QString mVersion
 the version of the project (arbitrary string) More...
 
QDateTime mCreated
 the datetime of the project creation More...
 
QDateTime mLastModified
 the datetime of the last project modification More...
 
AttributeList mAttributes
 all attributes in a specific order More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SerializableObject
template<typename T >
static void serializeObjectContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainerUuidSorted (SExpression &root, const T &container, const QString &itemName)
 

Detailed Description

The ProjectMetadata class.

Author
ubruhin
Date
2017-09-25

Constructor & Destructor Documentation

ProjectMetadata ( )
delete
ProjectMetadata ( const ProjectMetadata other)
delete
ProjectMetadata ( Project project,
bool  restore,
bool  readOnly,
bool  create 
)

+ Here is the call graph for this function:

~ProjectMetadata ( )
noexcept

Member Function Documentation

Project& getProject ( ) const
inlinenoexcept
const Uuid& getUuid ( ) const
inlinenoexcept
const ElementName& getName ( ) const
inlinenoexcept

Get the name of the project.

Returns
The name of the project

+ Here is the caller graph for this function:

const QString& getAuthor ( ) const
inlinenoexcept

Get the author of the project.

Returns
The author of the project
const QString& getVersion ( ) const
inlinenoexcept

Get the version of the project.

Returns
The version of the project (arbitrary string)

+ Here is the caller graph for this function:

const QDateTime& getCreated ( ) const
inlinenoexcept

Get the date and time when the project was created.

Returns
The local date and time of creation
const QDateTime& getLastModified ( ) const
inlinenoexcept

Get the date and time when the project was last modified.

Returns
The local date and time of last modification
Todo:
Dynamically determine the datetime of the last modification from version control system, file attributes or something like that.
const AttributeList& getAttributes ( ) const
inlinenoexcept

Get the list of attributes.

Returns
All attributes in a specific order
void setName ( const ElementName newName)
noexcept

Set the name of the project.

Parameters
newNameThe new name
Note
This method must be called only from inside an #UndoCommand! Undo Commands for this method: librepcb::project::CmdProjectMetadataEdit

+ Here is the caller graph for this function:

void setAuthor ( const QString &  newAuthor)
noexcept

Set the author of the project.

Parameters
newAuthorThe new author
Note
This method must be called only from inside an #UndoCommand! Undo Commands for this method: librepcb::project::CmdProjectMetadataEdit

+ Here is the caller graph for this function:

void setVersion ( const QString &  newVersion)
noexcept

Set the version of the project.

Parameters
newVersionThe new version (can be an arbitrary string)
Note
This method must be called only from inside an #UndoCommand! Undo Commands for this method: librepcb::project::CmdProjectMetadataEdit

+ Here is the caller graph for this function:

void setAttributes ( const AttributeList newAttributes)
noexcept

Set all project attributes.

Parameters
newAttributesThe new list of attributes
Note
This method must be called only from inside an #UndoCommand! Undo Commands for this method: librepcb::project::CmdProjectMetadataEdit

+ Here is the caller graph for this function:

void updateLastModified ( )
noexcept

Update the last modified datetime.

bool save ( bool  toOriginal,
QStringList &  errors 
)
noexcept

+ Here is the call graph for this function:

ProjectMetadata& operator= ( const ProjectMetadata rhs)
delete
void attributesChanged ( )
signal

+ Here is the caller graph for this function:

void serialize ( SExpression root) const
overrideprivatevirtual

Serialize the object into an existing S-Expression node.

This method inserts/appends all attributes and childs of the object to an existing S-Expression node. The content which already exists in the given S-Expression node will not be removed.

Note
The generated S-Expression node has always the format of the application's major version (it's not possible to generate DOMs of older versions).
Parameters
rootThe target DOM root node
Exceptions
ExceptionThis method throws an exception if an error occurs.

Implements SerializableObject.

+ Here is the call graph for this function:

Member Data Documentation

Project& mProject
private

a reference to the Project object (from the ctor)

FilePath mFilepath
private
QScopedPointer<SmartSExprFile> mFile
private
Uuid mUuid
private

the UUID of the project

ElementName mName
private

the name of the project

QString mAuthor
private

the author of the project

QString mVersion
private

the version of the project (arbitrary string)

QDateTime mCreated
private

the datetime of the project creation

QDateTime mLastModified
private

the datetime of the last project modification

AttributeList mAttributes
private

all attributes in a specific order


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