LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StringRefMemoryObject.h
Go to the documentation of this file.
1 //===- llvm/Support/StringRefMemoryObject.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 // This file contains the declaration of the StringRefMemObject class, a simple
11 // wrapper around StringRef implementing the MemoryObject interface.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_SUPPORT_STRINGREFMEMORYOBJECT_H
16 #define LLVM_SUPPORT_STRINGREFMEMORYOBJECT_H
17 
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/Support/Compiler.h"
21 
22 namespace llvm {
23 
24 /// StringRefMemoryObject - Simple StringRef-backed MemoryObject
26  StringRef Bytes;
27  uint64_t Base;
28 public:
29  StringRefMemoryObject(StringRef Bytes, uint64_t Base = 0)
30  : Bytes(Bytes), Base(Base) {}
31 
32  uint64_t getBase() const LLVM_OVERRIDE { return Base; }
33  uint64_t getExtent() const LLVM_OVERRIDE { return Bytes.size(); }
34 
35  int readByte(uint64_t Addr, uint8_t *Byte) const LLVM_OVERRIDE;
36  int readBytes(uint64_t Addr, uint64_t Size, uint8_t *Buf) const LLVM_OVERRIDE;
37 };
38 
39 }
40 
41 #endif
size_t size() const
size - Get the string size.
Definition: StringRef.h:113
int readByte(uint64_t Addr, uint8_t *Byte) const LLVM_OVERRIDE
uint64_t getBase() const LLVM_OVERRIDE
StringRefMemoryObject - Simple StringRef-backed MemoryObject.
int readBytes(uint64_t Addr, uint64_t Size, uint8_t *Buf) const LLVM_OVERRIDE
StringRefMemoryObject(StringRef Bytes, uint64_t Base=0)
uint64_t getExtent() const LLVM_OVERRIDE
#define LLVM_OVERRIDE
Definition: Compiler.h:155