blob: 4ca0a4b05bd0c155f231377b335a80a35b222310 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- ResourceProcessor.h -------------------------------------*- C++-*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===---------------------------------------------------------------------===//
9
10#ifndef LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_PROCESSOR_H
11#define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_PROCESSOR_H
12
13#include "llvm/ADT/StringMap.h"
14#include "llvm/ADT/StringRef.h"
15#include "llvm/Support/Error.h"
16#include "llvm/Support/raw_ostream.h"
17
18#include <memory>
19#include <vector>
20
21
22namespace llvm {
23
24class WindowsResourceProcessor {
25public:
26 using PathType = SmallVector<char, 64>;
27
28 WindowsResourceProcessor() {}
29
30 void addDefine(StringRef Key, StringRef Value = StringRef()) {
31 PreprocessorDefines.emplace_back(Key, Value);
32 }
33 void addInclude(const PathType &IncludePath) {
34 IncludeList.push_back(IncludePath);
35 }
36 void setVerbose(bool Verbose) { IsVerbose = Verbose; }
37 void setNullAtEnd(bool NullAtEnd) { AppendNull = NullAtEnd; }
38
39 Error process(StringRef InputData,
40 std::unique_ptr<raw_fd_ostream> OutputStream);
41
42private:
43 StringRef InputData;
44 std::vector<PathType> IncludeList;
45 std::vector<std::pair<StringRef, StringRef>> PreprocessorDefines;
46 bool IsVerbose, AppendNull;
47};
48
49}
50
51#endif