blob: 79f54c2e2a3a577572414d3f95906e918a2f08cd [file] [log] [blame]
Logan Chien0f0899a2012-03-23 10:48:18 +08001/*
2 * Copyright (C) 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#ifndef ART_SRC_ELF_IMAGE_H_
18#define ART_SRC_ELF_IMAGE_H_
19
20#include "globals.h"
21#include <string>
22
23namespace art {
24
25class ElfImage {
26 public:
27 explicit ElfImage(const std::string& str)
28 : begin_(reinterpret_cast<const byte*>(str.data())), size_(str.size()) {
29 }
30
31 explicit ElfImage(const byte* begin, size_t size)
32 : begin_(begin), size_(size) {
33 }
34
35 const byte* begin() const {
36 return begin_;
37 }
38
39 const byte* end() const {
40 return (begin_ + size_);
41 }
42
43 size_t size() const {
44 return size_;
45 }
46
47 private:
48 const byte* begin_;
49 size_t size_;
50};
51
52} // namespace art
53
54#endif // ART_SRC_ELF_IMAGE_H_