Форматирование вложенного класса AStyle ⇐ C++

Программы на C++. Форум разработчиков
Anonymous
Форматирование вложенного класса AStyle

Сообщение Anonymous »

В моем проекте есть следующий код:

Код: Выделить всё

class RangeConverter {
private:
struct Converter {
double MinimumInput;
double MaximumInput;

double MinimumOutput;
double MaximumOutput;

template 
RangeType Convert ( RangeType invalue ) const {
double v = static_cast ( invalue );
if ( v < MinimumInput ) {
v = MinimumInput;
} else if ( v > MaximumInput ) {
v = MaximumInput;
}
double interpolationfactor = ( v - MinimumInput ) / ( MaximumInput - MinimumInput );
return static_cast ( ( interpolationfactor * ( MaximumOutput - MinimumOutput ) ) + MinimumOutput );
}
};
.....
После форматирования этого кода с помощью AStyle я получаю следующее:

Код: Выделить всё

class RangeConverter {
private:
struct Converter {
ngeConverter {
private:
struct Converter {
double MinimumInput;
double MaximumInput;

double MinimumOutput;
double MaximumOutput;

template 
RangeType Convert ( RangeType invalue ) const {
double v = static_cast ( invalue );
if ( v < MinimumInput ) {
v = MinimumInput;
} else if ( v > MaximumInput ) {
v = MaximumInput;
}
double interpolationfactor = ( v - MinimumInput ) / ( MaximumInput - MinimumInput );
return static_cast ( ( interpolationfactor * ( MaximumOutput - MinimumOutput ) ) + MinimumOutput );
}
};
.....
Команда astyle:

Код: Выделить всё

astyle
\   --style=java
\   --indent=force-tab=2
\   --indent-classes
\   --indent-switches
\   --indent-labels
\   --indent-preprocessor
\   --indent-col1-comments
\   --pad-oper
\   --pad-paren
\   --delete-empty-lines
\   --add-brackets
\   --align-pointer=type
\   --align-reference=type
Это ошибка стиля, или я забыл какие-либо параметры?
Если это ошибка, что вы можете предложить для форматирования кода C++ с помощью VIM?< /п>

Подробнее здесь: https://stackoverflow.com/questions/123 ... formatting

Вернуться в «C++»