blob: 2018259730fe627acd2cad6edb4a77c24e7772a5 (
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
26
27
28
29
30
31
32
33
34
|
#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);
};
} // namespace CppExtract
#endif
|