diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2021-04-13 07:49:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-13 07:49:30 -0400 |
| commit | 420508d2d872e8653081d95a43bf2ad8f85d894c (patch) | |
| tree | 9019e0a87ad719c4a3b1e38c61e7b67feebfa63a /ZAPD/OutputFormatter.cpp | |
| parent | 95bf5fc0080135f20f3ab17082f79b9e539e80a5 (diff) | |
Refactoring and various features added (#108)
* ZAPD prints out git hash
* Refactor: ZResource constructor sets parent always.
ZOverlay also no longer a ZResource, since it did not make much sense.
* Organized ZResource a bit
* A number of bug fixes, cleanup, and feature improvements.
* Prepping for legacy dlist disasm
* Fixed some merging issues. Fixed compilation issues with MSVC. Added in proper support for legacy display list disassembler. Refactored parts of ZFile.
* Merge with upstream
* Finished ZFile refactor, and other tidying.
* Fixed up merge issues
* Minor cleanup
* Got rid of libgfxd_win.a
* Fixed matching issue
* Fixed up a few bugs
* Fixed issue with exceptions
* Fixed up merge issues with ZPrerender, along with cleaning up some code
* Additional cleanup
* Fixed merge issues with ZMtx and fixed a bug with ZDisplayList
* Fixes based on PR feedback
* run clang-format (#7)
Signed-off-by: angie <angheloalf95@gmail.com>
* Fixed merge issues with Roz's PR
* Misc fixes
* Fixed MM bug, removed redundant file.
* Removed some commented out code
Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>
Diffstat (limited to 'ZAPD/OutputFormatter.cpp')
| -rw-r--r-- | ZAPD/OutputFormatter.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/ZAPD/OutputFormatter.cpp b/ZAPD/OutputFormatter.cpp index 3a7fbd6..324a12f 100644 --- a/ZAPD/OutputFormatter.cpp +++ b/ZAPD/OutputFormatter.cpp @@ -1,6 +1,6 @@ #include "OutputFormatter.h" -int OutputFormatter::write(const char* buf, int count) +int OutputFormatter::Write(const char* buf, int count) { for (int i = 0; i < count; i++) { @@ -9,13 +9,13 @@ int OutputFormatter::write(const char* buf, int count) if (c == '\n') { col = 0; - current_indent = nest_indent[nest]; + currentIndent = nestIndent[nest]; } else if (c == '\t') { - int n = tab_size - (col % tab_size); + int n = tabSize - (col % tabSize); for (int j = 0; j < n - 1; j++) - *space_p++ = ' '; + *spaceP++ = ' '; c = ' '; col += n; } @@ -27,8 +27,8 @@ int OutputFormatter::write(const char* buf, int count) if (c == '(') { nest++; - nest_indent[nest] = col; - current_indent = col; + nestIndent[nest] = col; + currentIndent = col; } else if (c == ')') { @@ -37,58 +37,58 @@ int OutputFormatter::write(const char* buf, int count) if (c == ' ' || c == '\t' || c == '\n') { - str.append(word, word_p - word); - word_p = word; + str.append(word, wordP - word); + wordP = word; - *space_p++ = c; + *spaceP++ = c; } else { - if (col > line_limit) + if (col > lineLimit) { str.append(1, '\n'); - str.append(current_indent, ' '); - col = current_indent + 1 + (word_p - word); + str.append(currentIndent, ' '); + col = currentIndent + 1 + (wordP - word); } else { - str.append(space, space_p - space); + str.append(space, spaceP - space); } - space_p = space; + spaceP = space; - *word_p++ = c; + *wordP++ = c; } } return count; } -OutputFormatter* OutputFormatter::static_instance; +OutputFormatter* OutputFormatter::Instance; -int OutputFormatter::write_static(const char* buf, int count) +int OutputFormatter::WriteStatic(const char* buf, int count) { - return static_instance->write(buf, count); + return Instance->Write(buf, count); } -int (*OutputFormatter::static_writer())(const char* buf, int count) +int (*OutputFormatter::StaticWriter())(const char* buf, int count) { - static_instance = this; - return &write_static; + Instance = this; + return &WriteStatic; } -OutputFormatter::OutputFormatter(int tab_size, int default_indent, int line_limit) - : tab_size{tab_size}, default_indent{default_indent}, line_limit{line_limit}, col{0}, nest{0}, - nest_indent{default_indent}, current_indent{default_indent}, word_p{word}, space_p{space} +OutputFormatter::OutputFormatter(int tabSize, int defaultIndent, int lineLimit) + : tabSize{tabSize}, defaultIndent{defaultIndent}, lineLimit{lineLimit}, col{0}, nest{0}, + nestIndent{defaultIndent}, currentIndent{defaultIndent}, wordP{word}, spaceP{space} { } -std::string OutputFormatter::get_output() +std::string OutputFormatter::GetOutput() { - str.append(space, space_p - space); - space_p = space; + str.append(space, spaceP - space); + spaceP = space; - str.append(word, word_p - word); - word_p = word; + str.append(word, wordP - word); + wordP = word; return std::move(str); } |
