diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-04-22 09:32:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-22 09:32:25 -0400 |
| commit | da0d295d6c8b6fb03245dea0583437c198890349 (patch) | |
| tree | ed17baba750b15f6ace1427f04cf19690269161e /tools/slang-cpp-extractor/file-util.h | |
| parent | 34fba7b5e726136c6eee8a318ab9a75381399c00 (diff) | |
C++ extractor improvements (#1803)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Split of NodeTree.
Split out FileUtil.
Split out MacroWriter.
* Rename slang-cpp-extractor-main.cpp -> cpp-extractor-main.cpp
* First pass at extractor unit-tests
* Initial parsing of enum.
* Ability to disable/enable parsing of scope types.
* Initial support for typedef.
* Added operator== != to ArrayVIew.
Added test for splitting to unit tests.
* Improve comment in StringUtil.
* Fix comment.
* Fix typo.
Diffstat (limited to 'tools/slang-cpp-extractor/file-util.h')
| -rw-r--r-- | tools/slang-cpp-extractor/file-util.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/slang-cpp-extractor/file-util.h b/tools/slang-cpp-extractor/file-util.h new file mode 100644 index 000000000..01aafeedf --- /dev/null +++ b/tools/slang-cpp-extractor/file-util.h @@ -0,0 +1,25 @@ +#ifndef CPP_EXTRACT_FILE_UTIL_H +#define CPP_EXTRACT_FILE_UTIL_H + +#include "diagnostics.h" + +namespace CppExtract { +using namespace Slang; + +// A macro to define a single indent as a string +#define CPP_EXTRACT_INDENT_STRING " " + +struct FileUtil +{ + /// Read text into outRead. Any failures written to sink (can be passed as nullptr, for no output) + static SlangResult readAllText(const Slang::String& fileName, DiagnosticSink* sink, String& outRead); + /// Write text to filename. Any failures written to sink. (can be passed as nullptr, for no output) + static SlangResult writeAllText(const Slang::String& fileName, DiagnosticSink* sink, const UnownedStringSlice& text); + + /// Appends CPP_EXTRACT_INDENT_STRING indentCount number of times to out + static void indent(Index indentCount, StringBuilder& out); +}; + +} // CppExtract + +#endif |
