Reputation: 378
In my company's coding convention, we format nested namespaces on one line. For example:
namespace Foo { namespace Bar {
...
}} // Foo::Bar
I am trying to enforce this style using astyle but could not find anything in the documentation at http://astyle.sourceforge.net/astyle.html
When I run the following astyle command (ignore the irrelevant options)
astyle --style=allman --add-brackets --align-reference=name --align-pointer=name --attach-namespaces --pad-header --pad-oper --unpad-paren -n <filename>
I end up with each of the nested namespace on a separate line as shown below:
namespace Foo {
namespace Bar {
...
}
}
Upvotes: 3
Views: 599
Reputation: 77
Try to modify astyle
source code. Find method ASFormater::isOkToBreakBlock
and insert at the beginning:
if (isBraceType(braceType, NAMESPACE_TYPE))
return false;
Make sure that it doesn't break the whole formatting.
P.S. Hope that astyle
team will hear and will make correct changes with option.
Upvotes: 2