[DEV] Create group property
This commit is contained in:
parent
cbccbcad59
commit
7c34efef74
@ -98,15 +98,19 @@ static void setPropertyDoxygenMultiLine(eproperty::List<int32_t>& _data) {
|
||||
_data.add(DOXYGEN_MULTI_LINE__NORMAL_SINGLE_LINE_EXCLAMATION, "single-line-exclamation");
|
||||
}
|
||||
|
||||
estyle::BraceProperty::BraceProperty() :
|
||||
estyle::GroupProperty::GroupProperty() :
|
||||
inNewLineBefore(false),
|
||||
inNewLineAfter(false),
|
||||
inSpaceBefore(false),
|
||||
inSpaceAfter(false),
|
||||
inIndentBefore(false),
|
||||
inIndentAfter(false),
|
||||
outNewLineBefore(false),
|
||||
outNewLineAfter(false),
|
||||
outSpaceBefore(false),
|
||||
outSpaceAfter(false),
|
||||
outIndentBefore(false),
|
||||
outIndentAfter(false),
|
||||
oneLineIfSingleMaxSize(-1),
|
||||
single(false),
|
||||
singleInNewLine(false),
|
||||
@ -115,45 +119,53 @@ estyle::BraceProperty::BraceProperty() :
|
||||
singleOutSpace(false) {
|
||||
|
||||
}
|
||||
estyle::BraceProperty::BraceProperty(class estyle::Generator* _generator, const etk::String& _typeName, bool _allowSingle):
|
||||
inNewLineBefore(_generator, "brace-" + _typeName + "-in-new-line-before", false, "Set a new line before the input brace"),
|
||||
inNewLineAfter(_generator, "brace-" + _typeName + "-in-new-line-after", false, "Set a new line after the input brace"),
|
||||
inSpaceBefore(_generator, "brace-" + _typeName + "-in-space-before", false, "Set a space before the input brace (if not already present)"),
|
||||
inSpaceAfter(_generator, "brace-" + _typeName + "-in-space-after", false, "Set a space after the input brace (if not already present)"),
|
||||
outNewLineBefore(_generator, "brace-" + _typeName + "-out-new-line-before", false, "Set a new line before the input brace"),
|
||||
outNewLineAfter(_generator, "brace-" + _typeName + "-out-new-line-after", false, "Set a new line after the input brace"),
|
||||
outSpaceBefore(_generator, "brace-" + _typeName + "-out-space-before", false, "Set a space before the input brace (if not already present)"),
|
||||
outSpaceAfter(_generator, "brace-" + _typeName + "-out-space-after", false, "Set a space after the input brace (if not already present)"),
|
||||
estyle::GroupProperty::GroupProperty(class estyle::Generator* _generator, const etk::String& _groupName, const etk::String& _typeName, bool _allowSingle):
|
||||
inNewLineBefore(_generator, _groupName + "-" + _typeName + "-in-new-line-before", false, "Set a new line before the input brace"),
|
||||
inNewLineAfter(_generator, _groupName + "-" + _typeName + "-in-new-line-after", false, "Set a new line after the input brace"),
|
||||
inSpaceBefore(_generator, _groupName + "-" + _typeName + "-in-space-before", false, "Set a space before the input brace (if not already present)"),
|
||||
inSpaceAfter(_generator, _groupName + "-" + _typeName + "-in-space-after", false, "Set a space after the input brace (if not already present)"),
|
||||
inIndentBefore(_generator, _groupName + "-" + _typeName + "-in-indent-before", false, "Increment indendation before adding brace"),
|
||||
inIndentAfter(_generator, _groupName + "-" + _typeName + "-in-indent-after", false, "Increment indendation after adding brace"),
|
||||
outNewLineBefore(_generator, _groupName + "-" + _typeName + "-out-new-line-before", false, "Set a new line before the input " + _groupName + ""),
|
||||
outNewLineAfter(_generator, _groupName + "-" + _typeName + "-out-new-line-after", false, "Set a new line after the input " + _groupName + ""),
|
||||
outSpaceBefore(_generator, _groupName + "-" + _typeName + "-out-space-before", false, "Set a space before the input " + _groupName + " (if not already present)"),
|
||||
outSpaceAfter(_generator, _groupName + "-" + _typeName + "-out-space-after", false, "Set a space after the input " + _groupName + " (if not already present)"),
|
||||
outIndentBefore(_generator, _groupName + "-" + _typeName + "-out-indent-before", false, "Decrement indendation before adding " + _groupName + ""),
|
||||
outIndentAfter(_generator, _groupName + "-" + _typeName + "-out-indent-after", false, "Decrement indendation after adding " + _groupName + ""),
|
||||
oneLineIfSingleMaxSize((_allowSingle==true?
|
||||
etk::move(eproperty::Value<int32_t>(_generator, "brace-" + _typeName + "-single-one-line-size-max", -1, "Set i a single line if the size if < XXX (-1 to disable)")):
|
||||
etk::move(eproperty::Value<int32_t>(_generator, _groupName + "-" + _typeName + "-single-one-line-size-max", -1, "Set i a single line if the size if < XXX (-1 to disable)")):
|
||||
etk::move(eproperty::Value<int32_t>(-1)) )),
|
||||
single((_allowSingle==true?
|
||||
etk::move(eproperty::Value<bool>(_generator, "brace-" + _typeName + "-single", false, "remove or add brace if only 1 action is present.")):
|
||||
etk::move(eproperty::Value<bool>(_generator, _groupName + "-" + _typeName + "-single", false, "remove or add " + _groupName + " if only 1 action is present.")):
|
||||
etk::move(eproperty::Value<bool>(false)) )),
|
||||
singleInNewLine((_allowSingle==true?
|
||||
etk::move(eproperty::Value<bool>(_generator, "brace-" + _typeName + "-single-in-new-line", false, "Set new line before action.")):
|
||||
etk::move(eproperty::Value<bool>(_generator, _groupName + "-" + _typeName + "-single-in-new-line", false, "Set new line before action.")):
|
||||
etk::move(eproperty::Value<bool>(false)) )),
|
||||
singleInSpace((_allowSingle==true?
|
||||
etk::move(eproperty::Value<bool>(_generator, "brace-" + _typeName + "-single-in-space", false, "Set Space before action.")):
|
||||
etk::move(eproperty::Value<bool>(_generator, _groupName + "-" + _typeName + "-single-in-space", false, "Set Space before action.")):
|
||||
etk::move(eproperty::Value<bool>(false)) )),
|
||||
singleOutNewLine((_allowSingle==true?
|
||||
etk::move(eproperty::Value<bool>(_generator, "brace-" + _typeName + "-single-out-new-line", false, "Set new line after action.")):
|
||||
etk::move(eproperty::Value<bool>(_generator, _groupName + "-" + _typeName + "-single-out-new-line", false, "Set new line after action.")):
|
||||
etk::move(eproperty::Value<bool>(false)) )),
|
||||
singleOutSpace((_allowSingle==true?
|
||||
etk::move(eproperty::Value<bool>(_generator, "brace-" + _typeName + "-single-out-space", false, "Set space after action.")):
|
||||
etk::move(eproperty::Value<bool>(_generator, _groupName + "-" + _typeName + "-single-out-space", false, "Set space after action.")):
|
||||
etk::move(eproperty::Value<bool>(false)) )) {
|
||||
|
||||
}
|
||||
|
||||
estyle::BraceProperty::BraceProperty(estyle::BraceProperty&& _obj) :
|
||||
estyle::GroupProperty::GroupProperty(estyle::GroupProperty&& _obj) :
|
||||
inNewLineBefore(etk::move(_obj.inNewLineBefore)),
|
||||
inNewLineAfter(etk::move(_obj.inNewLineAfter)),
|
||||
inSpaceBefore(etk::move(_obj.inSpaceBefore)),
|
||||
inSpaceAfter(etk::move(_obj.inSpaceAfter)),
|
||||
inIndentBefore(etk::move(_obj.inIndentBefore)),
|
||||
inIndentAfter(etk::move(_obj.inIndentAfter)),
|
||||
outNewLineBefore(etk::move(_obj.outNewLineBefore)),
|
||||
outNewLineAfter(etk::move(_obj.outNewLineAfter)),
|
||||
outSpaceBefore(etk::move(_obj.outSpaceBefore)),
|
||||
outSpaceAfter(etk::move(_obj.outSpaceAfter)),
|
||||
outIndentBefore(etk::move(_obj.outIndentBefore)),
|
||||
outIndentAfter(etk::move(_obj.outIndentAfter)),
|
||||
oneLineIfSingleMaxSize(etk::move(_obj.oneLineIfSingleMaxSize)),
|
||||
single(etk::move(_obj.single)),
|
||||
singleInNewLine(etk::move(_obj.singleInNewLine)),
|
||||
@ -163,15 +175,19 @@ estyle::BraceProperty::BraceProperty(estyle::BraceProperty&& _obj) :
|
||||
|
||||
}
|
||||
|
||||
estyle::BraceProperty& estyle::BraceProperty::operator=(BraceProperty&& _obj) {
|
||||
estyle::GroupProperty& estyle::GroupProperty::operator=(GroupProperty&& _obj) {
|
||||
inNewLineBefore = etk::move(_obj.inNewLineBefore);
|
||||
inNewLineAfter = etk::move(_obj.inNewLineAfter);
|
||||
inSpaceBefore = etk::move(_obj.inSpaceBefore);
|
||||
inSpaceAfter = etk::move(_obj.inSpaceAfter);
|
||||
inIndentBefore = etk::move(_obj.inIndentBefore);
|
||||
inIndentAfter = etk::move(_obj.inIndentAfter);
|
||||
outNewLineBefore = etk::move(_obj.outNewLineBefore);
|
||||
outNewLineAfter = etk::move(_obj.outNewLineAfter);
|
||||
outSpaceBefore = etk::move(_obj.outSpaceBefore);
|
||||
outSpaceAfter = etk::move(_obj.outSpaceAfter);
|
||||
outIndentBefore = etk::move(_obj.outIndentBefore);
|
||||
outIndentAfter = etk::move(_obj.outIndentAfter);
|
||||
oneLineIfSingleMaxSize = etk::move(_obj.oneLineIfSingleMaxSize);
|
||||
single = etk::move(_obj.single);
|
||||
singleInNewLine = etk::move(_obj.singleInNewLine);
|
||||
@ -241,28 +257,26 @@ estyle::Generator::Generator():
|
||||
propertySemiColonReturnBetweenAction(this, "semi-colon-return-between-action", false, "true: 2 action separate with a ';' element have a newLine added")
|
||||
{
|
||||
setPropertyDoxygenMultiLine(propertyDoxygenMultipleLine);
|
||||
propertyBrace.set("if", etk::move(estyle::BraceProperty(this, "if")));
|
||||
propertyBrace.set("else", etk::move(estyle::BraceProperty(this, "else")));
|
||||
propertyBrace.set("function", etk::move(estyle::BraceProperty(this, "function", false)));
|
||||
propertyBrace.set("for", etk::move(estyle::BraceProperty(this, "for")));
|
||||
propertyBrace.set("while", etk::move(estyle::BraceProperty(this, "while")));
|
||||
propertyBrace.set("namespace", etk::move(estyle::BraceProperty(this, "namespace", false)));
|
||||
propertyBrace.set("block", etk::move(estyle::BraceProperty(this, "block", false)));
|
||||
propertyBrace.set("if", etk::move(estyle::GroupProperty(this, "brace", "if")));
|
||||
propertyBrace.set("else", etk::move(estyle::GroupProperty(this, "brace", "else")));
|
||||
propertyBrace.set("function", etk::move(estyle::GroupProperty(this, "brace", "function", false)));
|
||||
propertyBrace.set("for", etk::move(estyle::GroupProperty(this, "brace", "for")));
|
||||
propertyBrace.set("while", etk::move(estyle::GroupProperty(this, "brace", "while")));
|
||||
propertyBrace.set("namespace", etk::move(estyle::GroupProperty(this, "brace", "namespace", false)));
|
||||
propertyBrace.set("block", etk::move(estyle::GroupProperty(this, "brace", "block", false)));
|
||||
|
||||
propertyBrace.set("do-while", etk::move(estyle::BraceProperty(this, "do-while")));
|
||||
propertyBrace.set("switch", etk::move(estyle::BraceProperty(this, "switch", false)));
|
||||
propertyBrace.set("class", etk::move(estyle::BraceProperty(this, "class", false)));
|
||||
propertyBrace.set("struct", etk::move(estyle::BraceProperty(this, "struct", false)));
|
||||
propertyBrace.set("do-while", etk::move(estyle::GroupProperty(this, "brace", "do-while")));
|
||||
propertyBrace.set("switch", etk::move(estyle::GroupProperty(this, "brace", "switch", false)));
|
||||
propertyBrace.set("class", etk::move(estyle::GroupProperty(this, "brace", "class", false)));
|
||||
propertyBrace.set("struct", etk::move(estyle::GroupProperty(this, "brace", "struct", false)));
|
||||
|
||||
propertyParenthese.set("if", etk::move(estyle::ParentheseProperty(this, "if")));
|
||||
propertyParenthese.set("for", etk::move(estyle::ParentheseProperty(this, "for")));
|
||||
propertyParenthese.set("while", etk::move(estyle::ParentheseProperty(this, "while")));
|
||||
propertyParenthese.set("do-while", etk::move(estyle::ParentheseProperty(this, "do-while")));
|
||||
propertyParenthese.set("switch", etk::move(estyle::ParentheseProperty(this, "switch")));
|
||||
propertyParenthese.set("block", etk::move(estyle::ParentheseProperty(this, "block")));
|
||||
propertyParenthese.set("if", etk::move(estyle::GroupProperty(this, "parenthese", "if")));
|
||||
propertyParenthese.set("for", etk::move(estyle::GroupProperty(this, "parenthese", "for")));
|
||||
propertyParenthese.set("while", etk::move(estyle::GroupProperty(this, "parenthese", "while")));
|
||||
propertyParenthese.set("do-while", etk::move(estyle::GroupProperty(this, "parenthese", "do-while")));
|
||||
propertyParenthese.set("switch", etk::move(estyle::GroupProperty(this, "parenthese", "switch")));
|
||||
propertyParenthese.set("block", etk::move(estyle::GroupProperty(this, "parenthese", "block")));
|
||||
|
||||
|
||||
//ParentheseProperty
|
||||
}
|
||||
|
||||
estyle::Generator::~Generator() {
|
||||
|
@ -14,29 +14,33 @@
|
||||
|
||||
namespace estyle {
|
||||
class Generator;
|
||||
class BraceProperty {
|
||||
class GroupProperty {
|
||||
public:
|
||||
BraceProperty();
|
||||
BraceProperty(estyle::Generator* _generator, const etk::String& _typeName, bool _allowSingle=true);
|
||||
GroupProperty();
|
||||
GroupProperty(estyle::Generator* _generator, const etk::String& _groupName, const etk::String& _typeName, bool _allowSingle=true);
|
||||
eproperty::Value<bool> inNewLineBefore;
|
||||
eproperty::Value<bool> inNewLineAfter;
|
||||
eproperty::Value<bool> inSpaceBefore;
|
||||
eproperty::Value<bool> inSpaceAfter;
|
||||
eproperty::Value<bool> inIndentBefore;
|
||||
eproperty::Value<bool> inIndentAfter;
|
||||
eproperty::Value<bool> outNewLineBefore;
|
||||
eproperty::Value<bool> outNewLineAfter;
|
||||
eproperty::Value<bool> outSpaceBefore;
|
||||
eproperty::Value<bool> outSpaceAfter;
|
||||
eproperty::Value<bool> outIndentBefore;
|
||||
eproperty::Value<bool> outIndentAfter;
|
||||
eproperty::Value<int32_t> oneLineIfSingleMaxSize;
|
||||
eproperty::Value<bool> single;
|
||||
eproperty::Value<bool> singleInNewLine;
|
||||
eproperty::Value<bool> singleInSpace;
|
||||
eproperty::Value<bool> singleOutNewLine;
|
||||
eproperty::Value<bool> singleOutSpace;
|
||||
BraceProperty(const BraceProperty& _obj) = delete;
|
||||
BraceProperty(BraceProperty&& _obj);
|
||||
~BraceProperty() = default;
|
||||
BraceProperty& operator=(BraceProperty&& _obj);
|
||||
BraceProperty& operator=(const BraceProperty& _obj) = delete;
|
||||
GroupProperty(const GroupProperty& _obj) = delete;
|
||||
GroupProperty(GroupProperty&& _obj);
|
||||
~GroupProperty() = default;
|
||||
GroupProperty& operator=(GroupProperty&& _obj);
|
||||
GroupProperty& operator=(const GroupProperty& _obj) = delete;
|
||||
};
|
||||
class ParentheseProperty {
|
||||
public:
|
||||
@ -68,8 +72,8 @@ namespace estyle {
|
||||
|
||||
// Brace section
|
||||
// brace for "if"
|
||||
etk::Map<etk::String, estyle::BraceProperty> propertyBrace;
|
||||
etk::Map<etk::String, estyle::ParentheseProperty> propertyParenthese;
|
||||
etk::Map<etk::String, estyle::GroupProperty> propertyBrace;
|
||||
etk::Map<etk::String, estyle::GroupProperty> propertyParenthese;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user