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

Makefile section definition. More...

#include <makefile.h>

Public Member Functions

void Clear (void)
 Resets the makefile section to the initial state. More...
 
void Show (void)
 Prints contents of the makefile section to the standard output. More...
 
CStringListHeader (void)
 Section header, describes makefile section contents. More...
 
std::vector< CMakefileVariable * > & Macros (void)
 A list of macro variables in the section. More...
 
std::vector< CMakefileVariable * > & EnvVars (void)
 A list of environment variables in the section. More...
 
CMakefileVariableAddMacro (const CString &Name, const CString &Value)
 Creates a new macro variable and adds it to the section. More...
 
CMakefileVariableAddEnvVar (const CString &Name, const CString &Value)
 Creates a new environment variable and adds it to the section. More...
 
size_t RulesCount (void) const
 Counts makefile rules in the section. More...
 
CMakefileRuleGetRule (const size_t Index)
 Returns makefile rule by the Index number. More...
 
CMakefileRuleAddRule (const CString &TargetName)
 Creates a new makefile rule and adds it to the section. More...
 
 CMakefileSection (void)
 Creates makefile section. More...
 
 ~CMakefileSection (void)
 Destroys makefile section. More...
 

Protected Member Functions

CMakefileVariableFindMacro (const CString &Name)
 Searches macro variables by name. More...
 
CMakefileVariableFindEnvVar (const CString &Name)
 Searches environment variables by name. More...
 

Private Attributes

CStringList m_Header
 Section header, describes makefile section contents. More...
 
std::vector< CMakefileVariable * > m_Macros
 A list of macro variables in the section. More...
 
std::vector< CMakefileVariable * > m_EnvVars
 A list of environment variables in the section. More...
 
std::vector< CMakefileRule * > m_Rules
 A list of makefile rules in the section. More...
 
CMakefileVariable m_NullVariable
 A substitute variable, it is returned when no variable satisfies search conditions. More...
 
CMakefileRule m_NullRule
 A substitute rule, it is returned when no rule satisfies search conditions. More...
 

Detailed Description

Makefile section definition.

Manages makefile section data. A makefile section is a logical block of text with common structure: header, macros, environment variables, rules. A makefile may consist of one or more sections to maintain strict logical structure of the makefile text.

Constructor & Destructor Documentation

◆ CMakefileSection()

CMakefileSection::CMakefileSection ( void  )

Creates makefile section.

◆ ~CMakefileSection()

CMakefileSection::~CMakefileSection ( void  )

Destroys makefile section.

Member Function Documentation

◆ AddEnvVar()

CMakefileVariable & CMakefileSection::AddEnvVar ( const CString Name,
const CString Value 
)

Creates a new environment variable and adds it to the section.

Parameters
Namename of an environment variable.
Valuedefault value of an environment variable.
Returns
reference to the new variable.

If an environment variable with name Name already exists, a new variable will not be created.

◆ AddMacro()

CMakefileVariable & CMakefileSection::AddMacro ( const CString Name,
const CString Value 
)

Creates a new macro variable and adds it to the section.

Parameters
Namename of a macro variable.
Valuedefault value of a macro variable.
Returns
reference to the new variable.

If a macro variable with name Name already exists, a new variable will not be created.

◆ AddRule()

CMakefileRule & CMakefileSection::AddRule ( const CString TargetName)

Creates a new makefile rule and adds it to the section.

Parameters
TargetNamename of makefile target for the rule.
Returns
reference to the new rule.

If a makefile rule with target name TargetName already exists, a new rule will not be created.

◆ Clear()

void CMakefileSection::Clear ( void  )

Resets the makefile section to the initial state.

◆ EnvVars()

std::vector< CMakefileVariable * > & CMakefileSection::EnvVars ( void  )

A list of environment variables in the section.

Returns
reference to CMakefileSection::m_Macros.

◆ FindEnvVar()

CMakefileVariable * CMakefileSection::FindEnvVar ( const CString Name)
protected

Searches environment variables by name.

Parameters
Namean environment variable name.
Returns
reference to an environment variable or CMakefileSection::m_NullVariable if no variable has the Name name.

◆ FindMacro()

CMakefileVariable * CMakefileSection::FindMacro ( const CString Name)
protected

Searches macro variables by name.

Parameters
Namea macro variable name.
Returns
reference to a macro variable or CMakefileSection::m_NullVariable if no variable has the Name name.

◆ GetRule()

CMakefileRule & CMakefileSection::GetRule ( const size_t  Index)

Returns makefile rule by the Index number.

Parameters
Indexnumber of a rule.
Returns
reference to a makefile rule.

◆ Header()

CStringList & CMakefileSection::Header ( void  )

Section header, describes makefile section contents.

Returns
reference to CMakefileSection::m_Header.

◆ Macros()

std::vector< CMakefileVariable * > & CMakefileSection::Macros ( void  )

A list of macro variables in the section.

Returns
reference to CMakefileSection::m_Macros.

◆ RulesCount()

size_t CMakefileSection::RulesCount ( void  ) const

Counts makefile rules in the section.

Returns
section rules count.

◆ Show()

void CMakefileSection::Show ( void  )

Prints contents of the makefile section to the standard output.

Member Data Documentation

◆ m_EnvVars

CMakefileSection::m_EnvVars
private

A list of environment variables in the section.

Enviroment variable definitions follow macro variables and precide rules.

◆ m_Header

CMakefileSection::m_Header
private

Section header, describes makefile section contents.

Contains lines of text that precide other parts of the section.

◆ m_Macros

CMakefileSection::m_Macros
private

A list of macro variables in the section.

Macro variable definitions follow the section header and precide enviroment variables.

◆ m_NullRule

CMakefileSection::m_NullRule
private

A substitute rule, it is returned when no rule satisfies search conditions.

◆ m_NullVariable

CMakefileSection::m_NullVariable
private

A substitute variable, it is returned when no variable satisfies search conditions.

◆ m_Rules

CMakefileSection::m_Rules
private

A list of makefile rules in the section.

Rule definitions follow environment variables and finish the section.


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