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

Dependency information for build units in a project. More...

#include <depsearch.h>

Public Member Functions

CPlatformPlatform (void)
 Platform/OS type, generally used for creating compatible file paths. More...
 
void Clear (void)
 Resets the unit dependency database to the initial state. More...
 
void Show (void)
 Print dependency information for all of build units to the standard output. More...
 
CString OneLineReport (const size_t Index, const bool Deps, const bool XRefs)
 Returns a short string representation of dependency information. More...
 
size_t RecordsCount (void) const
 Returns the number of dependency records. More...
 
CString Name (const size_t Index) const
 Returns name of a build unit with dependency record number Index. More...
 
size_t DirectDependenciesCount (const size_t Index) const
 Counts direct dependencies of a build unit with dependency record number Index. More...
 
size_t IndirectDependenciesCount (const size_t Index)
 Counts only indirect dependencies of a build unit with number Index. More...
 
size_t AllDependenciesCount (const size_t Index)
 Returns the total count of dependencies of a build unit with dependency record number Index. More...
 
CStringList DirectDependencies (const size_t Index) const
 Returns a list of build unit names that a build unit with dependency record number Index depends on directly. More...
 
CStringList IndirectDependencies (const size_t Index)
 Returns a list of build unit names that a build unit with dependency record number Index depends on indirectly. More...
 
CStringList AllDependencies (const size_t Index)
 Returns a complete list of build unit names that a build unit with dependency record number Index depends on directly or indirectly. More...
 
size_t DirectCrossReferencesCount (const size_t Index) const
 Counts direct cross references to a build unit with dependency record number Index. More...
 
size_t IndirectCrossReferencesCount (const size_t Index)
 Counts indirect cross references to a build unit with dependency record number Index. More...
 
size_t AllCrossReferencesCount (const size_t Index)
 Returns the total count of cross references of a build unit with dependency record number Index. More...
 
CStringList DirectCrossReferences (const size_t Index) const
 Returns a list of build unit names that directly depend on a build unit with dependency record number Index. More...
 
CStringList IndirectCrossReferences (const size_t Index)
 Returns a list of build unit names that indirectly depend on a build unit with dependency record number Index. More...
 
CStringList AllCrossReferences (const size_t Index)
 Returns a complete list of build unit names that depend on a build unit with dependency record number Index either directly or indirectly. More...
 
bool AreDependenciesComplete (const size_t Index)
 Verifies if a dependency list for a build unit with dependency record number Index is marked as complete. More...
 
bool AreCrossReferencesComplete (const size_t Index)
 Verifies if a cross reference list for a build unit with dependency record number Index is marked as complete. More...
 
void SetDependenciesComplete (const size_t Index, const bool State=true)
 Marks a dependency list for a build unit with dependency record number Index as complete. More...
 
void SetCrossReferencesComplete (const size_t Index, const bool State=true)
 Marks a cross reference list for a build unit with number Index as complete. More...
 
int FindRecord (const CString &Name)
 Performs dependency record lookup by a build unit name. More...
 
size_t AddRecord (const CString &Name)
 Adds a new dependency record for the Name build unit. More...
 
bool AddDependency (const size_t Index, const CString &DependencyName)
 Adds the DependencyName build unit to a dependency record with number Index. More...
 
size_t AddDependency (const CString &Name, const CString &DependencyName)
 Adds the DependencyName build unit to a dependency record of the Name build unit. More...
 
void MakeRules (CMakefile &Makefile, const int Section, const bool Multiline)
 Generates makefile rules for build unit dependencies. More...
 
 CDependencyInfo (void)
 Creates build unit dependency database. More...
 
 ~CDependencyInfo (void)
 Destroys build unit dependency database. More...
 

Private Member Functions

void ResetMarkers (void)
 Clears CDependencyRecord::m_Marker for all records in CDependencyInfo::m_Records. More...
 
size_t DependenciesCount (CDependencyRecord *Record)
 Returns the number of dependencies for a build unit pointed by Record. More...
 
CStringList Dependencies (CDependencyRecord *Record)
 Returns the list of file names of build units that a build unit pointed by Record depends on. More...
 
size_t CrossReferencesCount (CDependencyRecord *Record)
 Returns the number of cross references for a build unit pointed by Record. More...
 
CStringList CrossReferences (CDependencyRecord *Record)
 Returns the list of file names of build units that depend on a build unit pointed by Record. More...
 

Private Attributes

CPlatform m_Platform
 Platform/OS type, generally used for creating compatible file paths. More...
 
std::vector< CDependencyRecord * > m_Records
 Database of build unit dependencies. More...
 

Detailed Description

Dependency information for build units in a project.

Stores a database of build unit dependencies and cross references, searches and unwinds dependncies of a particular unit, writes makefile rules for unit dependencies. Generally speaking, CDependencyInfo tracks only dependencies between abstract names (strings), it doesn't really care whether those names are real file names or build units or not. The only exception to that is providing platform information to a dependency search filter like CIncludeSearchFilter and its descendants for building compatible file paths.

Constructor & Destructor Documentation

◆ CDependencyInfo()

CDependencyInfo::CDependencyInfo ( void  )

Creates build unit dependency database.

◆ ~CDependencyInfo()

CDependencyInfo::~CDependencyInfo ( void  )

Destroys build unit dependency database.

Member Function Documentation

◆ AddDependency() [1/2]

CDependencyInfo::AddDependency ( const size_t  Index,
const CString DependencyName 
)

Adds the DependencyName build unit to a dependency record with number Index.

Parameters
Indexnumber of a dependency record of a build unit.
DependencyNamename of another build unit.
Returns
true, if Index is a valid number of a dependency record, false otherwise.

◆ AddDependency() [2/2]

CDependencyInfo::AddDependency ( const CString Name,
const CString DependencyName 
)

Adds the DependencyName build unit to a dependency record of the Name build unit.

Parameters
Namename of a build unit.
DependencyNamename of another build unit.
Returns
number of a dependency record of the Name build unit.

◆ AddRecord()

CDependencyInfo::AddRecord ( const CString Name)

Adds a new dependency record for the Name build unit.

Parameters
Namename of a build unit.
Returns
number (index) of the new dependency record.

◆ AllCrossReferences()

CDependencyInfo::AllCrossReferences ( const size_t  Index)

Returns a complete list of build unit names that depend on a build unit with dependency record number Index either directly or indirectly.

Parameters
Indexnumber of a dependency record.
Returns
list of build unit names.

◆ AllCrossReferencesCount()

CDependencyInfo::AllCrossReferencesCount ( const size_t  Index)

Returns the total count of cross references of a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
cross references count.

◆ AllDependencies()

CDependencyInfo::AllDependencies ( const size_t  Index)

Returns a complete list of build unit names that a build unit with dependency record number Index depends on directly or indirectly.

Parameters
Indexnumber of a dependency record.
Returns
list of build unit names.

◆ AllDependenciesCount()

CDependencyInfo::AllDependenciesCount ( const size_t  Index)

Returns the total count of dependencies of a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
sum of direct and indirect dependencies.

◆ AreCrossReferencesComplete()

CDependencyInfo::AreCrossReferencesComplete ( const size_t  Index)

Verifies if a cross reference list for a build unit with dependency record number Index is marked as complete.

Parameters
Indexnumber of a dependency record.
Returns
true if a cross rference list is complete, false otherwise.

◆ AreDependenciesComplete()

CDependencyInfo::AreDependenciesComplete ( const size_t  Index)

Verifies if a dependency list for a build unit with dependency record number Index is marked as complete.

Parameters
Indexnumber of a dependency record.
Returns
true if a dependency list is complete, false otherwise.

◆ Clear()

CDependencyInfo::Clear ( void  )

Resets the unit dependency database to the initial state.

◆ CrossReferences()

CDependencyInfo::CrossReferences ( CDependencyRecord Record)
private

Returns the list of file names of build units that depend on a build unit pointed by Record.

Parameters
Recorddependency record of a build unit.
Returns
list of file names.

◆ CrossReferencesCount()

CDependencyInfo::CrossReferencesCount ( CDependencyRecord Record)
private

Returns the number of cross references for a build unit pointed by Record.

Parameters
Recorddependency record of a build unit.
Returns
cross references count.

◆ Dependencies()

CDependencyInfo::Dependencies ( CDependencyRecord Record)
private

Returns the list of file names of build units that a build unit pointed by Record depends on.

Parameters
Recorddependency record of a build unit.
Returns
list of file names.

◆ DependenciesCount()

CDependencyInfo::DependenciesCount ( CDependencyRecord Record)
private

Returns the number of dependencies for a build unit pointed by Record.

Parameters
Recorddependency record of a build unit.
Returns
dependencies count.

◆ DirectCrossReferences()

CDependencyInfo::DirectCrossReferences ( const size_t  Index) const

Returns a list of build unit names that directly depend on a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
list of build unit names.

◆ DirectCrossReferencesCount()

CDependencyInfo::DirectCrossReferencesCount ( const size_t  Index) const

Counts direct cross references to a build unit with dependency record number Index.

Parameters
Indexnumber of a build unit.
Returns
cross references count.

◆ DirectDependencies()

CDependencyInfo::DirectDependencies ( const size_t  Index) const

Returns a list of build unit names that a build unit with dependency record number Index depends on directly.

Parameters
Indexnumber of a dependency record.
Returns
list of build unit names.

◆ DirectDependenciesCount()

CDependencyInfo::DirectDependenciesCount ( const size_t  Index) const

Counts direct dependencies of a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
dependencies count.

◆ FindRecord()

CDependencyInfo::FindRecord ( const CString Name)

Performs dependency record lookup by a build unit name.

Parameters
Namename of a build unit.
Returns
number (index) of the corresponding dependency record or -1 if no dependency record for the Name build unit is found.

◆ IndirectCrossReferences()

CDependencyInfo::IndirectCrossReferences ( const size_t  Index)

Returns a list of build unit names that indirectly depend on a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
list of build unit names.

◆ IndirectCrossReferencesCount()

CDependencyInfo::IndirectCrossReferencesCount ( const size_t  Index)

Counts indirect cross references to a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
cross references count.

◆ IndirectDependencies()

CDependencyInfo::IndirectDependencies ( const size_t  Index)

Returns a list of build unit names that a build unit with dependency record number Index depends on indirectly.

Parameters
Indexnumber of a dependency record.
Returns
list of build unit names.

◆ IndirectDependenciesCount()

CDependencyInfo::IndirectDependenciesCount ( const size_t  Index)

Counts only indirect dependencies of a build unit with number Index.

Parameters
Indexnumber of a build unit.
Returns
dependencies count.

Indirect dependencies are dependencies of all build units that selected build unit with number Index depends on excluding these units.

◆ MakeRules()

CDependencyInfo::MakeRules ( CMakefile Makefile,
const int  Section,
const bool  Multiline 
)

Generates makefile rules for build unit dependencies.

Parameters
Makefilea makefile object.
Sectionnumber of makefile section.
Multilineallows multi-line rules.

◆ Name()

CDependencyInfo::Name ( const size_t  Index) const

Returns name of a build unit with dependency record number Index.

Parameters
Indexnumber of a dependency record.
Returns
name of the build unit.

◆ OneLineReport()

CDependencyInfo::OneLineReport ( const size_t  Index,
const bool  Deps,
const bool  XRefs 
)

Returns a short string representation of dependency information.

Parameters
Indexnumber a dependency record.
Depsenables output of dependencies.
XRefsenables output of cross references.
Returns
string representation of dependency information.

◆ Platform()

CDependencyInfo::Platform ( void  )
inline

Platform/OS type, generally used for creating compatible file paths.

Returns
reference to CDependencyInfo::m_Platform.

◆ RecordsCount()

CDependencyInfo::RecordsCount ( void  ) const

Returns the number of dependency records.

Returns
dependency records count.

◆ ResetMarkers()

CDependencyInfo::ResetMarkers ( void  )
private

Clears CDependencyRecord::m_Marker for all records in CDependencyInfo::m_Records.

This function should be called before unwinding a new dependency.

◆ SetCrossReferencesComplete()

CDependencyInfo::SetCrossReferencesComplete ( const size_t  Index,
const bool  State = true 
)

Marks a cross reference list for a build unit with number Index as complete.

Parameters
Indexnumber of a build unit.
Statestate of completeness.

◆ SetDependenciesComplete()

CDependencyInfo::SetDependenciesComplete ( const size_t  Index,
const bool  State = true 
)

Marks a dependency list for a build unit with dependency record number Index as complete.

Parameters
Indexnumber of a dependency record.
Statestate of completeness.

◆ Show()

CDependencyInfo::Show ( void  )

Print dependency information for all of build units to the standard output.

Member Data Documentation

◆ m_Platform

CDependencyInfo::m_Platform
private

Platform/OS type, generally used for creating compatible file paths.

◆ m_Records

CDependencyInfo::m_Records
private

Database of build unit dependencies.


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