blob: 01aafeedf8640547bc9db8a046486c12e3b947ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
|