MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / WriteIndent

Method WriteIndent

CodeFormatCore/src/Format/FormatBuilder.cpp:371–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371void FormatBuilder::WriteIndent() {
372 auto topLevelIndent = _state.GetCurrentIndent();
373 switch (_state.GetStyle().indent_style) {
374 case IndentStyle::Space: {
375 if (topLevelIndent.SpaceSize != 0) {
376 auto oldSize = _formattedText.size();
377 _formattedText.resize(oldSize + topLevelIndent.SpaceSize, ' ');
378 }
379 break;
380 }
381 case IndentStyle::Tab: {
382 if (topLevelIndent.TabSize != 0) {
383 auto oldSize = _formattedText.size();
384 _formattedText.resize(oldSize + topLevelIndent.TabSize, '\t');
385 }
386 if (topLevelIndent.SpaceSize != 0) {
387 auto oldSize = _formattedText.size();
388 _formattedText.resize(oldSize + topLevelIndent.SpaceSize, ' ');
389 }
390 break;
391 }
392 }
393 _state.CurrentWidth() += topLevelIndent.SpaceSize + topLevelIndent.TabSize * _state.GetStyle().tab_width;
394}
395
396void FormatBuilder::WriteChar(char ch) {
397 _state.CurrentWidth()++;

Callers

nothing calls this directly

Calls 4

GetCurrentIndentMethod · 0.80
GetStyleMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected