summaryrefslogtreecommitdiff
path: root/ZAPD/OutputFormatter.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-04-28 05:19:50 -0400
committerGitHub <noreply@github.com>2021-04-28 05:19:50 -0400
commitb9120803e6094a54192ed67d9585ab046101c816 (patch)
treedf259449343cd0c5230dd2a5e1e9d5293d20c563 /ZAPD/OutputFormatter.cpp
parent50ad2fe786af4cf66998028a08c767e16a416a60 (diff)
Use OutputFormatter for every C and H file, to improve the generated output (#122)
* Small changes in collision * Use outputformatter to write C files * Outputformatter for .h files * Use more fs::path * Use gfxd_udata_set and gfxd_udata_get instead of an instance * Fix merge issues and warnings * run format
Diffstat (limited to 'ZAPD/OutputFormatter.cpp')
-rw-r--r--ZAPD/OutputFormatter.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/ZAPD/OutputFormatter.cpp b/ZAPD/OutputFormatter.cpp
index 32a48f6..65b45f3 100644
--- a/ZAPD/OutputFormatter.cpp
+++ b/ZAPD/OutputFormatter.cpp
@@ -25,9 +25,9 @@ void OutputFormatter::Flush()
wordNests = 0;
}
-int OutputFormatter::Write(const char* buf, uint32_t count)
+int OutputFormatter::Write(const char* buf, int count)
{
- for (uint32_t i = 0; i < count; i++)
+ for (int i = 0; i < count; i++)
{
char c = buf[i];
@@ -83,6 +83,11 @@ int OutputFormatter::Write(const char* buf, uint32_t count)
return count;
}
+int OutputFormatter::Write(const std::string& buf)
+{
+ return Write(buf.data(), buf.size());
+}
+
OutputFormatter* OutputFormatter::Instance;
int OutputFormatter::WriteStatic(const char* buf, int count)
@@ -98,7 +103,8 @@ int (*OutputFormatter::StaticWriter())(const char* buf, int count)
OutputFormatter::OutputFormatter(uint32_t tabSize, uint32_t defaultIndent, uint32_t lineLimit)
: tabSize{tabSize}, defaultIndent{defaultIndent}, lineLimit{lineLimit}, col{0}, nest{0},
- nestIndent{defaultIndent}, currentIndent{defaultIndent}, wordNests(0), wordP{word}, spaceP{space}
+ nestIndent{defaultIndent}, currentIndent{defaultIndent},
+ wordNests(0), wordP{word}, spaceP{space}
{
}