makefile::Variable Class Reference

Holds name and value of a makefile variable. More...

#include <Variable.h>

Inheritance diagram for makefile::Variable:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Variable (string name_, string value_, Makefile::QuoteMode quotemode_=Makefile::SHELL)
 Takes a string value.
 Variable (string name_, double value_, Makefile::QuoteMode quotemode_=Makefile::NONE)
 Takes a numeric value.
 Variable (string name_, std::vector< string >::iterator start, std::vector< string >::iterator end, Makefile::QuoteMode quotemode_=Makefile::SHELL, string separator_=" ")
 Takes values and appends them using seperator.
virtual ~Variable ()
virtual const string getName ()
virtual const string getValue ()
virtual const string getquotedValue ()
virtual const std::vector<
string > & 
getValues ()
virtual VariableDefgetDef ()
virtual VariableRefgetRef ()
void setQuoteMode (Makefile::QuoteMode mode)
void setExport (bool ex)
bool getExport ()

Protected Member Functions

virtual void checkName ()
 According to Gnu Make Manual http://www.gnu.org/software/make/manual/html_node/Using-Variables.html#Using-Variables it's recommended to use only alphanumerics and _ in Variable name.
virtual void checkValue ()
 It's not allowed to have newline characters in Variable values, if they are defined like this.
void Create ()
 Variable (string name_)
 To be used only by subclasses, like AutoVariable.

Protected Attributes

string name
std::vector< stringvalues
 holds a list of values
string separator
 separator for output of the value list
VariableDefdef
 A VariableDef connected to the Variable.
VariableRefref
 A VariableDef connected to the Variable.
Makefile::QuoteMode quotemode
bool exported
 Decides wether this Variable is defined with export.

Private Member Functions

 Variable (const Variable &)

Detailed Description

Holds name and value of a makefile variable.

The MakefileItems VariableRef and VariableDef refer are linked to one of these to know what they represent.

Examples:

example.cpp.

Definition at line 42 of file Variable.h.


Constructor & Destructor Documentation

makefile::Variable::Variable ( string  name_  )  [protected]

To be used only by subclasses, like AutoVariable.

Definition at line 63 of file Variable.cpp.

References Create().

makefile::Variable::Variable ( const Variable  )  [private]

makefile::Variable::Variable ( string  name_,
string  value_,
Makefile::QuoteMode  quotemode_ = Makefile::SHELL 
)

Takes a string value.

Definition at line 69 of file Variable.cpp.

References checkName(), checkValue(), Create(), and values.

makefile::Variable::Variable ( string  name_,
double  value_,
Makefile::QuoteMode  quotemode_ = Makefile::NONE 
)

Takes a numeric value.

Definition at line 77 of file Variable.cpp.

References checkName(), Create(), makefile::Makefile::locale, and values.

makefile::Variable::Variable ( string  name_,
std::vector< string >::iterator  start,
std::vector< string >::iterator  end,
Makefile::QuoteMode  quotemode_ = Makefile::SHELL,
string  separator_ = " " 
)

Takes values and appends them using seperator.

The seperators will not be quoted so using this, it's possible to have a list of filenames with spaces in them, quote those correctly, but have a space seperated list of filenames.

Definition at line 88 of file Variable.cpp.

References checkName(), checkValue(), Create(), and values.

makefile::Variable::~Variable (  )  [virtual]

Definition at line 98 of file Variable.cpp.

References def, and ref.


Member Function Documentation

void makefile::Variable::checkName (  )  [protected, virtual]

According to Gnu Make Manual http://www.gnu.org/software/make/manual/html_node/Using-Variables.html#Using-Variables it's recommended to use only alphanumerics and _ in Variable name.

Definition at line 39 of file Variable.cpp.

References cstr, and name.

Referenced by Variable().

void makefile::Variable::checkValue (  )  [protected, virtual]

It's not allowed to have newline characters in Variable values, if they are defined like this.

(There would be an alternative).

Definition at line 50 of file Variable.cpp.

References cstr, and getValue().

Referenced by Variable().

void makefile::Variable::Create (  )  [protected]

Definition at line 57 of file Variable.cpp.

References def, and ref.

Referenced by Variable().

virtual VariableDef& makefile::Variable::getDef (  )  [inline, virtual]

Reimplemented in makefile::AutoVariable.

Examples:
example.cpp.

Definition at line 109 of file Variable.h.

Referenced by HuginBase::PanoramaMakefilelibExport::createexposure(), createfiles_make(), HuginBase::PanoramaMakefilelibExport::createItems(), HuginBase::AssistantMakefilelibExport::createItems(), HuginBase::PanoramaMakefilelibExport::createstacks(), main(), makefile::tester::TestConditional::TestConditional(), makefile::tester::TestVariable::TestVariable(), tryall(), trycond(), trymakefile(), and tryrule().

bool makefile::Variable::getExport (  )  [inline]

Definition at line 128 of file Variable.h.

Referenced by makefile::VariableDef::toString().

virtual const string makefile::Variable::getName (  )  [inline, virtual]

Definition at line 88 of file Variable.h.

Referenced by HuginBase::PTScriptParsing::readVar(), makefile::tester::TestConditional::TestConditional(), makefile::VariableRef::toString(), makefile::VariableDef::toString(), tryall(), and trycond().

const string makefile::Variable::getquotedValue (  )  [virtual]

Returns:
The assembled value, quoted.

Reimplemented in makefile::AutoVariable.

Definition at line 116 of file Variable.cpp.

References makefile::Makefile::quote(), quotemode, separator, and values.

Referenced by makefile::VariableDef::toString().

virtual VariableRef& makefile::Variable::getRef (  )  [inline, virtual]

Examples:
example.cpp.

Definition at line 114 of file Variable.h.

Referenced by makefile::Rule::addPrereq(), makefile::Rule::addTarget(), createfiles_make(), HuginBase::PanoramaMakefilelibExport::createItems(), main(), makefile::tester::TestConditional::TestConditional(), makefile::tester::TestVariable::TestVariable(), tryall(), trycond(), trymakefile(), and tryrule().

const string makefile::Variable::getValue (  )  [virtual]

Returns:
The assembled value, unquoted.

Reimplemented in makefile::AutoVariable.

Definition at line 106 of file Variable.cpp.

References separator, and values.

Referenced by checkValue(), and tryall().

virtual const std::vector<string>& makefile::Variable::getValues (  )  [inline, virtual]

Returns:
The value vector.

Reimplemented in makefile::AutoVariable.

Definition at line 104 of file Variable.h.

Referenced by HuginBase::PanoramaMakefilelibExport::createItems().

void makefile::Variable::setExport ( bool  ex  )  [inline]

Definition at line 124 of file Variable.h.

Referenced by HuginBase::PanoramaMakefilelibExport::createItems().

void makefile::Variable::setQuoteMode ( Makefile::QuoteMode  mode  )  [inline]

Definition at line 119 of file Variable.h.

Referenced by tryall().


Member Data Documentation

VariableDef* makefile::Variable::def [protected]

A VariableDef connected to the Variable.

Definition at line 51 of file Variable.h.

Referenced by Create(), and ~Variable().

bool makefile::Variable::exported [protected]

Decides wether this Variable is defined with export.

Definition at line 56 of file Variable.h.

string makefile::Variable::name [protected]

Definition at line 45 of file Variable.h.

Referenced by checkName(), and HuginBase::LensVariable::printLink().

Makefile::QuoteMode makefile::Variable::quotemode [protected]

Definition at line 54 of file Variable.h.

Referenced by getquotedValue().

VariableRef* makefile::Variable::ref [protected]

A VariableDef connected to the Variable.

Definition at line 53 of file Variable.h.

Referenced by Create(), and ~Variable().

string makefile::Variable::separator [protected]

separator for output of the value list

Definition at line 49 of file Variable.h.

Referenced by getquotedValue(), and getValue().

std::vector<string> makefile::Variable::values [protected]

holds a list of values

Definition at line 47 of file Variable.h.

Referenced by getquotedValue(), getValue(), and Variable().


The documentation for this class was generated from the following files:
Generated on 5 Dec 2014 for Hugintrunk by  doxygen 1.4.7