Emergency 2017 Dokumentation  v3.0.1
qsf::Project Class Reference

Project class. More...

#include <Project.h>

Classes

struct  PluginData
 

Public Types

typedef std::vector< std::string > ProjectNameList
 
typedef std::vector< AssetPackage * > AssetPackageList
 
typedef std::map< uint32, PluginDataPluginMap
 
- Public Types inherited from qsf::BaseProject
enum  Flags { APPLICATION_CORE_PROJECT, LOCKED }
 
typedef EnumBitmask< uint8, FlagsFlagsSet
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 

Public Member Functions

 Project ()
 Default constructor. More...
 
virtual ~Project ()
 Destructor. More...
 
void clear ()
 Clear the project. More...
 
bool loadByFilename (const std::string &filename)
 Load a project by using a given filename. More...
 
bool saveByFilename (const std::string &filename) const
 Save the project by using a given filename. More...
 
std::string getFilename () const
 Return the local filename of the project, relative to the base directory. More...
 
bool isInsideFilesystemBaseDirectory () const
 Return whether or not the physical base directory of the project is inside the base directory of the file system. More...
 
const std::string & getBaseDirectory () const
 Return the physical base directory of the project. More...
 
void setBaseDirectory (const std::string &baseDirectory)
 Set the physical base directory of the project. More...
 
const ProjectNameListgetProjectDependencies () const
 Return the names of the projects this project depends on. More...
 
void setProjectDependencies (const ProjectNameList &projectDependencies)
 Set the names of the projects this project depends on. More...
 
std::string getAbsoluteDirectory () const
 Return the physical absolute directory of the project. More...
 
const AssetPackageListgetAssetPackageList () const
 Return the asset packages of this project. More...
 
AssetPackagecreateAssetPackageByName (const std::string &name)
 Create and add a new empty asset package to the project. More...
 
AssetPackagecreateIntermediateAssetPackageByName (const std::string &name)
 Create and add a new empty intermediate asset package to the project. More...
 
AssetPackageaddAssetPackageByName (const std::string &name)
 Add an existing asset package to the project. More...
 
AssetPackagegetAssetPackageByName (const std::string &name) const
 Return an asset package by using its name. More...
 
bool destroyAssetPackageByName (const std::string &name, bool destroyContent)
 Destroy an asset package including its files by using its name. More...
 
const PluginMapgetPlugins () const
 Return the map of information about plugins. More...
 
void addPluginByName (const std::string &name, const std::string &applicationList)
 Add information about a plugin to the project. More...
 
void getPluginsByApplicationTags (const std::vector< NamedIdentifier > &applicationTags, std::vector< std::string > &outPluginNames) const
 Retrieve a listing of all plugins that should be loaded for a specific application. More...
 
void startup ()
 Startup the project. More...
 
bool isRunning () const
 Return whether or not the project is up-and-running. More...
 
void shutdown ()
 Shutdown the project. More...
 
const boost::property_tree::ptreegetMetadataPTree () const
 Get the Boost property tree holding additional meta data for the project. More...
 
void setMetadataPTree (const boost::property_tree::ptree &pTree)
 Set a Boost property tree holding additional meta data for the project. More...
 
virtual bool isLocked () const override
 Return whether or not the project is locked. More...
 
- Public Member Functions inherited from qsf::BaseProject
 BaseProject ()
 Default constructor. More...
 
 BaseProject (const BaseProject &source)
 Copy-constructor in case someone wants to have this copyable. More...
 
virtual ~BaseProject ()
 Destructor. More...
 
ProjectId getProjectId () const
 Return the project ID. More...
 
const std::string & getName () const
 Return the name of the project. More...
 
void setName (const std::string &name)
 Set the name of the project. More...
 
const std::string & getDescription () const
 Return the description of the project. More...
 
void setDescription (const std::string &description)
 Set the description of the project. More...
 
const std::string & getAuthor () const
 Return the author of the project. More...
 
void setAuthor (const std::string &author)
 Set the author of the project. More...
 
const std::string & getVersion () const
 Return the version string of the project. More...
 
void setVersion (const std::string &version)
 Set the version of the project. More...
 
bool isApplicationCoreProject () const
 
void setApplicationCoreProject (bool enable)
 
void setLocked (bool locked)
 Set whether or not the project is locked. More...
 
BaseProjectoperator= (const BaseProject &source)
 Assignment operator. More...
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Friends

class ProjectManager
 

Additional Inherited Members

- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Attributes inherited from qsf::BaseProject
std::string mName
 The UTF-8 technical project name, only lower case ASCII and no spaces, will also be the name of the project directory. More...
 
std::string mDescription
 The UTF-8 description of the project. More...
 
std::string mAuthor
 Project author name. More...
 
std::string mVersion
 User-defined project version, should be in format "1.0.0". More...
 
FlagsSet mFlags
 Project flags. More...
 

Detailed Description

Project class.

Definition at line 42 of file Project.h.

Member Typedef Documentation

Definition at line 57 of file Project.h.

Definition at line 64 of file Project.h.

typedef std::vector<std::string> qsf::Project::ProjectNameList

Definition at line 56 of file Project.h.

Constructor & Destructor Documentation

qsf::Project::Project ( )
inline

Default constructor.

Definition at line 14 of file Project-inl.h.

qsf::Project::~Project ( )
inlinevirtual

Destructor.

Definition at line 21 of file Project-inl.h.

Member Function Documentation

AssetPackage* qsf::Project::addAssetPackageByName ( const std::string &  name)

Add an existing asset package to the project.

Parameters
[in]nameUTF-8 name of the asset package to add to the project
Returns
Pointer on the added asset package on success, else null pointer, do not destroy the returned instance
Note
  • There must be an existing "asset_package.json"-file
void qsf::Project::addPluginByName ( const std::string &  name,
const std::string &  applicationList 
)

Add information about a plugin to the project.

Parameters
[in]nameUTF-8 file name of the plugin to add to the project, without file ending (e.g. "my_game_plugin")
[in]applicationListSpace-separated list of application short identifiers; the plugin will be loaded only for these applications (e.g. "sample_game sample_editor")
void qsf::Project::clear ( )

Clear the project.

AssetPackage* qsf::Project::createAssetPackageByName ( const std::string &  name)

Create and add a new empty asset package to the project.

Parameters
[in]nameUTF-8 name of the asset package to add to the project
Returns
Pointer on the added asset package on success, else null pointer, do not destroy the returned instance
AssetPackage* qsf::Project::createIntermediateAssetPackageByName ( const std::string &  name)

Create and add a new empty intermediate asset package to the project.

Parameters
[in]nameUTF-8 name of the asset package to add to the project
Returns
Pointer on the added asset package on success, else null pointer, do not destroy the returned instance
Note
  • An intermediate asset package is technically just like an ordinary asset package, but with the use case of just being used for processing (e.g. asset import inside the editor)
bool qsf::Project::destroyAssetPackageByName ( const std::string &  name,
bool  destroyContent 
)

Destroy an asset package including its files by using its name.

Parameters
[in]nameUTF-8 name of the asset package to destroy
[in]destroyContentDelete the directory the asset package is in?
Returns
"true" if all went fine, else "false"
Note
  • Warning: This method could cause harm (although harm is restricted to files inside mounted directories) because it will also delete the files inside the asset packet (no issue when the assets are managed by the QSF editor server)
std::string qsf::Project::getAbsoluteDirectory ( ) const

Return the physical absolute directory of the project.

Returns
The UTF-8 absolute directory name in platform-independent notation (e.g. on Windows: "C:/MyApplication/my_project")
AssetPackage* qsf::Project::getAssetPackageByName ( const std::string &  name) const

Return an asset package by using its name.

Parameters
[in]nameUTF-8 name of the asset package to return
Returns
The asset package, null pointer on error, do not destroy the instance
const Project::AssetPackageList & qsf::Project::getAssetPackageList ( ) const
inline

Return the asset packages of this project.

Returns
The internal list of asset packages of this project, do not destroy the instance

Definition at line 52 of file Project-inl.h.

const std::string & qsf::Project::getBaseDirectory ( ) const
inline

Return the physical base directory of the project.

Returns
The UTF-8 base directory name in platform-independent notation (e.g. on Windows: "C:/MyApplication")

Definition at line 32 of file Project-inl.h.

std::string qsf::Project::getFilename ( ) const
inline

Return the local filename of the project, relative to the base directory.

Returns
The local UTF-8 filename of the project in platform-independent notation (e.g. on Windows: "data/my_project/project.json")

Definition at line 27 of file Project-inl.h.

const boost::property_tree::ptree * qsf::Project::getMetadataPTree ( ) const
inline

Get the Boost property tree holding additional meta data for the project.

Returns
Boost property tree instance or a null pointer in case there is no meta data available at all

Definition at line 67 of file Project-inl.h.

const Project::PluginMap & qsf::Project::getPlugins ( ) const
inline

Return the map of information about plugins.

Returns
The internal plugin data map, do not destroy the instance

Definition at line 57 of file Project-inl.h.

void qsf::Project::getPluginsByApplicationTags ( const std::vector< NamedIdentifier > &  applicationTags,
std::vector< std::string > &  outPluginNames 
) const

Retrieve a listing of all plugins that should be loaded for a specific application.

Parameters
[in]applicationTagsList of tags associated with the application
[out]outPluginNamesList of UTF-8 file name of the plugins
Note
  • The plugins are located inside an architecture-dependent sub-directory of the project, e.g. "x64"
const Project::ProjectNameList & qsf::Project::getProjectDependencies ( ) const
inline

Return the names of the projects this project depends on.

Returns
The names of the projects this project depends on

Definition at line 42 of file Project-inl.h.

bool qsf::Project::isInsideFilesystemBaseDirectory ( ) const

Return whether or not the physical base directory of the project is inside the base directory of the file system.

Returns
"true" if the physical base directory of the project is inside the base directory of the file system, else "false" (it's probably inside a user directory)
virtual bool qsf::Project::isLocked ( ) const
overridevirtual

Return whether or not the project is locked.

Returns
"true" if the project is locked, else "false"
Note
  • Locked projects are supposed to not be changed inside the editor

Reimplemented from qsf::BaseProject.

bool qsf::Project::isRunning ( ) const
inline

Return whether or not the project is up-and-running.

Returns
"true" if the project is up-and-running ("startup()" was called successfully), else "false"

Definition at line 62 of file Project-inl.h.

bool qsf::Project::loadByFilename ( const std::string &  filename)

Load a project by using a given filename.

Parameters
[in]filenameUTF-8 filename in platform-independent notation of the project to load
Returns
"true" if all went fine, else "false" (file not found?)
Note
  • The current project will get lost, so, you might want to save a manipulated project before loading a new one
  • The local UTF-8 filename in platform-independent notation of the project is set automatically
Todo:
  • TODO(co) For now, we only support JSON
bool qsf::Project::saveByFilename ( const std::string &  filename) const

Save the project by using a given filename.

Parameters
[in]filenameUTF-8 filename in platform-independent notation of the project to save
Returns
"true" if all went fine, else "false"
Note
  • The local UTF-8 filename in platform-independent notation of the project is not changed
Todo:
  • TODO(co) For now, we only support JSON
void qsf::Project::setBaseDirectory ( const std::string &  baseDirectory)
inline

Set the physical base directory of the project.

Parameters
[in]baseDirectoryThe UTF-8 base directory name in platform-independent notation

Definition at line 37 of file Project-inl.h.

void qsf::Project::setMetadataPTree ( const boost::property_tree::ptree pTree)

Set a Boost property tree holding additional meta data for the project.

Parameters
[in]pTreeBoost property tree instance to be copied
void qsf::Project::setProjectDependencies ( const ProjectNameList projectDependencies)
inline

Set the names of the projects this project depends on.

Parameters
[in]projectDependenciesThe names of the projects this project depends on

Definition at line 47 of file Project-inl.h.

void qsf::Project::shutdown ( )

Shutdown the project.

void qsf::Project::startup ( )

Startup the project.

Friends And Related Function Documentation

friend class ProjectManager
friend

Definition at line 49 of file Project.h.


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