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

Makefile definition. More...

#include <makefile.h>

Public Member Functions

void Clear (void)
 Resets the makefile to the initial state. More...
 
void Show (void)
 Prints contents of the makefile to the standard output. More...
 
size_t SectionCount (void) const
 Counts makefile sections. More...
 
CMakefileSectionGetSection (const size_t Section)
 Returns a makefile section by a number. More...
 
CStringListHeader (const size_t Section=0)
 Header of a makefile section number Section. More...
 
CMakefileSectionAddSection (size_t *Section=0)
 Creates a new makefile section and adds it to the makefile. More...
 
CMakefileVariableAddMacro (const CString &Name, const CString &Value, const size_t Section=0)
 Creates a new macro variable and adds it to a section number Section. More...
 
CMakefileVariableAddEnvVar (const CString &Name, const CString &Value, const size_t Section=0)
 Creates a new environment variable and adds it to a section number Section. More...
 
size_t RulesCount (const size_t Section=0)
 Counts makefile rules in a section number Section. More...
 
CMakefileRuleGetRule (const size_t Index, const size_t Section=0)
 Returns makefile rule by the Index number in a section number Section. More...
 
CMakefileRuleAddRule (const CString &TargetName, const size_t Section=0)
 Creates a new makefile rule and adds it to a section number Section. More...
 
CStringListGetText (void)
 Returns a plain text representation of the makefile. More...
 
CStringListUpdate (void)
 Creates plain text representation of the makefile from objects. More...
 
 CMakefile (void)
 Creates makefile. More...
 
 ~CMakefile (void)
 Destroys makefile. More...
 

Private Attributes

std::vector< CMakefileSection * > m_Sections
 A list of makefile sections. More...
 
CStringList m_Text
 Plain text representation of the makefile. More...
 

Detailed Description

Makefile definition.

Manages structured makefile and generates its text representation.

Constructor & Destructor Documentation

◆ CMakefile()

CMakefile::CMakefile ( void  )

Creates makefile.

◆ ~CMakefile()

CMakefile::~CMakefile ( void  )

Destroys makefile.

Member Function Documentation

◆ AddEnvVar()

CMakefileVariable & CMakefile::AddEnvVar ( const CString Name,
const CString Value,
const size_t  Section = 0 
)

Creates a new environment variable and adds it to a section number Section.

Parameters
Namename of an environment variable.
Valuedefault value of an environment variable.
Sectionnumber of a makefile section.
Returns
reference to the new variable.

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

◆ AddMacro()

CMakefileVariable & CMakefile::AddMacro ( const CString Name,
const CString Value,
const size_t  Section = 0 
)

Creates a new macro variable and adds it to a section number Section.

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

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

◆ AddRule()

CMakefileRule & CMakefile::AddRule ( const CString TargetName,
const size_t  Section = 0 
)

Creates a new makefile rule and adds it to a section number Section.

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

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

◆ AddSection()

CMakefileSection & CMakefile::AddSection ( size_t *  Section = 0)

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

Parameters
Sectiondesired number for a makefile section.
Returns
reference to the new makefile section.

This function creates all sections through from the last existing section to a desired number Section.

◆ Clear()

void CMakefile::Clear ( void  )

Resets the makefile to the initial state.

◆ GetRule()

CMakefileRule & CMakefile::GetRule ( const size_t  Index,
const size_t  Section = 0 
)

Returns makefile rule by the Index number in a section number Section.

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

◆ GetSection()

CMakefileSection & CMakefile::GetSection ( const size_t  Section)

Returns a makefile section by a number.

Parameters
Sectionnumber of a makefile section.
Returns
reference to a makefile section.

◆ GetText()

CStringList & CMakefile::GetText ( void  )

Returns a plain text representation of the makefile.

Returns
reference to CMakefile::m_Text.

Make a call to CMakefile::Update(void) before using this function to convert object representation of the makefile to plain text.

◆ Header()

CStringList & CMakefile::Header ( const size_t  Section = 0)

Header of a makefile section number Section.

Parameters
Sectionnumber of a makefile section.
Returns
reference to a list of strings.

◆ RulesCount()

size_t CMakefile::RulesCount ( const size_t  Section = 0)

Counts makefile rules in a section number Section.

Parameters
Sectionnumber of a makefile section.
Returns
section rules count.

◆ SectionCount()

size_t CMakefile::SectionCount ( void  ) const

Counts makefile sections.

Returns
number of makefile sections.

◆ Show()

void CMakefile::Show ( void  )

Prints contents of the makefile to the standard output.

◆ Update()

CStringList & CMakefile::Update ( void  )

Creates plain text representation of the makefile from objects.

Returns
makefile text (reference to CMakefile::m_Text).

Member Data Documentation

◆ m_Sections

CMakefile::m_Sections
private

A list of makefile sections.

A section is similar in structure to an elementary and complete makefile, so a minimal makefile consists of one regular makefile section. In order to maintain a good style of makefile text, leading sections of makefile should contain headers and variable definitions and trailing sections should contain headers and rules while middle one may contain all of section parts. Any part of any section is optional and may be omitted.

See also
CMakefileSection.

◆ m_Text

CMakefile::m_Text
private

Plain text representation of the makefile.


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