1e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao/*
2e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * Copyright 2011, The Android Open Source Project
3e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao *
4e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * Licensed under the Apache License, Version 2.0 (the "License");
5e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * you may not use this file except in compliance with the License.
6e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * You may obtain a copy of the License at
7e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao *
8e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao *     http://www.apache.org/licenses/LICENSE-2.0
9e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao *
10e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * Unless required by applicable law or agreed to in writing, software
11e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * distributed under the License is distributed on an "AS IS" BASIS,
12e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * See the License for the specific language governing permissions and
14e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao * limitations under the License.
15e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao */
16e2cdbc6710aa43475f17e73aba143ceb786e968cShih-wei Liao
1755b5e7c242e599b88f5727352758808461483000Logan Chien#ifndef ELF_SECTION_STRTAB_H
1855b5e7c242e599b88f5727352758808461483000Logan Chien#define ELF_SECTION_STRTAB_H
1955b5e7c242e599b88f5727352758808461483000Logan Chien
2058611fc8193e7386698178f167a2e0cbdd6a4f6fLogan Chien#include "ELFTypes.h"
2155b5e7c242e599b88f5727352758808461483000Logan Chien#include "ELFSection.h"
2255b5e7c242e599b88f5727352758808461483000Logan Chien
23921465005aca46a100d137c9608a0aedd846e290Logan Chien#include <vector>
2455b5e7c242e599b88f5727352758808461483000Logan Chien
25a9ab5889e842a49ff16d06594efe96b0210fe1f7Logan Chientemplate <unsigned Bitwidth>
2655b5e7c242e599b88f5727352758808461483000Logan Chienclass ELFSectionStrTab : public ELFSection<Bitwidth> {
2758611fc8193e7386698178f167a2e0cbdd6a4f6fLogan Chienpublic:
2858611fc8193e7386698178f167a2e0cbdd6a4f6fLogan Chien  ELF_TYPE_INTRO_TO_TEMPLATE_SCOPE(Bitwidth);
2958611fc8193e7386698178f167a2e0cbdd6a4f6fLogan Chien
3055b5e7c242e599b88f5727352758808461483000Logan Chienprivate:
3158611fc8193e7386698178f167a2e0cbdd6a4f6fLogan Chien  ELFSectionHeaderTy const *section_header;
3255b5e7c242e599b88f5727352758808461483000Logan Chien  std::vector<char> buf;
3355b5e7c242e599b88f5727352758808461483000Logan Chien
3455b5e7c242e599b88f5727352758808461483000Logan Chienprivate:
3555b5e7c242e599b88f5727352758808461483000Logan Chien  ELFSectionStrTab() { }
3655b5e7c242e599b88f5727352758808461483000Logan Chien
3755b5e7c242e599b88f5727352758808461483000Logan Chienpublic:
3855b5e7c242e599b88f5727352758808461483000Logan Chien  template <typename Archiver>
3958611fc8193e7386698178f167a2e0cbdd6a4f6fLogan Chien  static ELFSectionStrTab *read(Archiver &AR, ELFSectionHeaderTy const *sh);
4055b5e7c242e599b88f5727352758808461483000Logan Chien
418e233aace27dd4c658db39ddd223bdc21121a4f2Logan Chien  virtual void print() const;
4255b5e7c242e599b88f5727352758808461483000Logan Chien
4355b5e7c242e599b88f5727352758808461483000Logan Chien  char const *operator[](size_t index) const {
4455b5e7c242e599b88f5727352758808461483000Logan Chien    return &*buf.begin() + index;
4555b5e7c242e599b88f5727352758808461483000Logan Chien  }
4655b5e7c242e599b88f5727352758808461483000Logan Chien};
4755b5e7c242e599b88f5727352758808461483000Logan Chien
488e233aace27dd4c658db39ddd223bdc21121a4f2Logan Chien#include "impl/ELFSectionStrTab.hxx"
498e233aace27dd4c658db39ddd223bdc21121a4f2Logan Chien
5055b5e7c242e599b88f5727352758808461483000Logan Chien#endif // ELF_SECTION_STRTAB_H
51