Home | History | Annotate | Download | only in WindowsResource
      1 //===-- 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 
     22 namespace llvm {
     23 
     24 class WindowsResourceProcessor {
     25 public:
     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 
     42 private:
     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
     52