1/*
2 * Copyright 2012, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// Defines a generic interface to a file/memory region that
18// contains a generated wrapped bitcode file, bitcode file,
19// or data file.
20
21#ifndef LLVM_WRAP_WRAPPER_OUTPUT_H__
22#define LLVM_WRAP_WRAPPER_OUTPUT_H__
23
24#include <stdint.h>
25#include <stddef.h>
26
27#include "bcinfo/Wrap/support_macros.h"
28
29// The following is a generic interface to a file/memory region
30// that contains a generated bitcode file, wrapped bitcode file,
31// or a data file.
32class WrapperOutput {
33 public:
34  WrapperOutput() {}
35  virtual ~WrapperOutput() {}
36  // Writes a single byte, returning false if unable to write.
37  virtual bool Write(uint8_t byte) = 0;
38  // Writes the specified number of bytes in the buffer to
39  // output. Returns false if unable to write.
40  virtual bool Write(const uint8_t* buffer, size_t buffer_size);
41 private:
42  DISALLOW_CLASS_COPY_AND_ASSIGN(WrapperOutput);
43};
44
45#endif  // LLVM_WRAP_WRAPPER_OUTPUT_H__
46