Implement gradle spec reader/writer

This commit is contained in:
Petr Mrázek
2014-07-16 02:03:52 +02:00
parent 71575a5022
commit 8a56ab6780
9 changed files with 241 additions and 15 deletions

35
logic/DefaultVariable.h Normal file
View File

@ -0,0 +1,35 @@
#pragma once
template <typename T>
class DefaultVariable
{
public:
DefaultVariable(const T & value)
{
defaultValue = value;
}
DefaultVariable<T> & operator =(const T & value)
{
currentValue = value;
is_default = currentValue == defaultValue;
is_explicit = true;
return *this;
}
operator const T &() const
{
return is_default ? defaultValue : currentValue;
}
bool isDefault() const
{
return is_default;
}
bool isExplicit() const
{
return is_explicit;
}
private:
T currentValue;
T defaultValue;
bool is_default = true;
bool is_explicit = false;
};