MCPcopy Create free account
hub / github.com/NPP-JSONViewer/JSON-Viewer / GetFormatSetting

Method GetFormatSetting

src/NppJsonViewer/JsonViewDlg.cpp:1006–1074  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006auto JsonViewDlg::GetFormatSetting() const -> std::tuple<LE, LF, char, unsigned>
1007{
1008 LE le = LE::kCrLf;
1009 LF lf = LF::kFormatDefault;
1010 char indentChar = ' ';
1011 unsigned indentLen = 0;
1012
1013 // Line formatting options
1014 lf = static_cast<LF>(m_pSetting->lineFormat);
1015
1016 // End of line options
1017 switch (m_pSetting->lineEnding)
1018 {
1019 case LineEnding::WINDOWS:
1020 le = LE::kCrLf;
1021 break;
1022
1023 case LineEnding::UNIX:
1024 le = LE::kLf;
1025 break;
1026
1027 case LineEnding::MAC:
1028 le = LE::kCr;
1029 break;
1030
1031 // Takes from Notepad++
1032 case LineEnding::AUTO:
1033 default:
1034 {
1035 const auto eol = m_pEditor->GetEOL();
1036 switch (eol)
1037 {
1038 case 0:
1039 le = LE::kCrLf;
1040 break;
1041 case 1:
1042 le = LE::kCr;
1043 break;
1044 default:
1045 le = LE::kLf;
1046 break;
1047 }
1048 }
1049 }
1050
1051 // Indentation options
1052 switch (m_pSetting->indent.style)
1053 {
1054 case IndentStyle::TAB:
1055 indentChar = '\t';
1056 indentLen = 1;
1057 break;
1058
1059 case IndentStyle::SPACE:
1060 indentChar = ' ';
1061 indentLen = m_pSetting->indent.len;
1062 break;
1063

Callers

nothing calls this directly

Calls 2

GetEOLMethod · 0.80
GetIndentMethod · 0.80

Tested by

no test coverage detected