cbp2make
Makefile generation tool for Code::Blocks IDE
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
CCodeBlocksWorkspace Class Reference

Workspace description. More...

#include <cbworkspace.h>

Public Member Functions

void Clear (void)
 Resets the workspace to the initial state. More...
 
void Read (const TiXmlElement *WorkspaceRoot)
 Reads the workspace settings from an XML document. More...
 
bool LoadWorkspaceProjects (const CString &WorkspacePath)
 Loads all workspace units (projects) in the workspace. More...
 
bool LoadWorkspace (const CString &FileName)
 Loads a workspace from a file specified by FileName. More...
 
void Show (const bool ShowProjects=false)
 Prints the workspace contents and (optionally) contents of workspace units (projects) to standard output. More...
 
bool GenerateMakefile (const CString &FileName, CCodeBlocksBuildConfig &Config)
 Generates makefile and writes its text representation to a file specified by FileName. More...
 
void GenerateMakefileText (const CString &FileName, CCodeBlocksBuildConfig &Config)
 Generates makefile text and writes it to a file specified by FileName. More...
 
 CCodeBlocksWorkspace (void)
 Create workspace. More...
 
 ~CCodeBlocksWorkspace (void)
 Destroys workspace. More...
 

Protected Member Functions

int CalculateProjectWeight (const size_t Index=0)
 Calculates weight (priority) of a single workspace unit (project) with number Index. More...
 
void ResolveProjectDependencies (void)
 Resolves workspace unit (project) dependencies by calculating project weights. More...
 
void SortProjectsByWeight (void)
 Sorts workspace units (projects) by weight in ascending order. More...
 

Private Attributes

CString m_Title
 Title of the workspace. More...
 
std::vector< CWorkspaceUnit * > m_Units
 List of workspace units (projects) in the workspace. More...
 
CStringList m_TargetNames
 List of build target names of workspace units. More...
 
CStringList m_MakefileNames
 List of makefile names of workspace units. More...
 
CStringList m_MakefilePaths
 List of makefile paths of workspace units. More...
 
CStringList m_TargetDeps
 List of dependencies of workspace units. More...
 
CStringList m_MakefileText
 Contains plain text of makefile for the workspace. More...
 
CMakefile m_Makefile
 Contains object-based makefile for the workspace. More...
 

Detailed Description

Workspace description.

Contains properties of Code::Blocks workspace.

Constructor & Destructor Documentation

◆ CCodeBlocksWorkspace()

CCodeBlocksWorkspace::CCodeBlocksWorkspace ( void  )

Create workspace.

◆ ~CCodeBlocksWorkspace()

CCodeBlocksWorkspace::~CCodeBlocksWorkspace ( void  )

Destroys workspace.

Member Function Documentation

◆ CalculateProjectWeight()

CCodeBlocksWorkspace::CalculateProjectWeight ( const size_t  Index = 0)
protected

Calculates weight (priority) of a single workspace unit (project) with number Index.

Parameters
Indexnumber of a workspace unit (project).
Returns
weight of a project.

This function is a part of the core mechanism for resolving project dependencies.

See also
CCodeBlocksWorkspace::ResolveProjectDependencies(void)

◆ Clear()

CCodeBlocksWorkspace::Clear ( void  )

Resets the workspace to the initial state.

◆ GenerateMakefile()

CCodeBlocksWorkspace::GenerateMakefile ( const CString FileName,
CCodeBlocksBuildConfig Config 
)

Generates makefile and writes its text representation to a file specified by FileName.

Parameters
FileNamea file name for makefile of the workspace.
Configbuild configuration.

This function generates makefile text only for the workspace, makefiles for individual projects in the workspace are generated by CCodeBlocksProject.

◆ GenerateMakefileText()

CCodeBlocksWorkspace::GenerateMakefileText ( const CString FileName,
CCodeBlocksBuildConfig Config 
)

Generates makefile text and writes it to a file specified by FileName.

Parameters
FileNamea file name for makefile of the workspace.
Configbuild configuration.

This function generates makefile text only for the workspace, makefiles for individual projects in the workspace are generated by CCodeBlocksProject.

◆ LoadWorkspace()

CCodeBlocksWorkspace::LoadWorkspace ( const CString FileName)

Loads a workspace from a file specified by FileName.

Parameters
FileNamename of Code::Blocks workspace file.
Returns
true if specified workspace and all of its units (projects) were successfully loaded, false otherwise.

◆ LoadWorkspaceProjects()

CCodeBlocksWorkspace::LoadWorkspaceProjects ( const CString WorkspacePath)

Loads all workspace units (projects) in the workspace.

Returns
true if all of projects were successfully loaded, false otherwise.

◆ Read()

CCodeBlocksWorkspace::Read ( const TiXmlElement *  WorkspaceRoot)

Reads the workspace settings from an XML document.

Parameters
WorkspaceRootan element of XML document.

◆ ResolveProjectDependencies()

CCodeBlocksWorkspace::ResolveProjectDependencies ( void  )
protected

Resolves workspace unit (project) dependencies by calculating project weights.

See also
CCodeBlocksWorkspace::CalculateProjectWeight(const size_t Index = 0)

◆ Show()

CCodeBlocksWorkspace::Show ( const bool  ShowProjects = false)

Prints the workspace contents and (optionally) contents of workspace units (projects) to standard output.

Parameters
ShowProjectstell to display contents of workspace units.

◆ SortProjectsByWeight()

CCodeBlocksWorkspace::SortProjectsByWeight ( void  )
protected

Sorts workspace units (projects) by weight in ascending order.

This function is a part of the core mechanism for resolving project dependencies.

See also
CCodeBlocksWorkspace::ResolveProjectDependencies(void)

Member Data Documentation

◆ m_Makefile

CCodeBlocksWorkspace::m_Makefile
private

Contains object-based makefile for the workspace.

Contents of makefile are generated by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file.

◆ m_MakefileNames

CCodeBlocksWorkspace::m_MakefileNames
private

List of makefile names of workspace units.

This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config).

◆ m_MakefilePaths

CCodeBlocksWorkspace::m_MakefilePaths
private

List of makefile paths of workspace units.

This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config).

◆ m_MakefileText

CCodeBlocksWorkspace::m_MakefileText
private

Contains plain text of makefile for the workspace.

Contents of makefile are generated by CCodeBlocksWorkspace::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file.

◆ m_TargetDeps

CCodeBlocksWorkspace::m_TargetDeps
private

List of dependencies of workspace units.

Each line of the list contains decorated project names separated by space character and represents dependencies of corresponding project contained in the workspace. Decorated names are used as makefile target names. This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config).

◆ m_TargetNames

CCodeBlocksWorkspace::m_TargetNames
private

List of build target names of workspace units.

This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config).

◆ m_Title

CCodeBlocksWorkspace::m_Title
private

Title of the workspace.

◆ m_Units

CCodeBlocksWorkspace::m_Units
private

List of workspace units (projects) in the workspace.

See also
CWorkspaceUnit.

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