LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
MapList.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
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#ifndef LIEF_MAP_LIST_H
17#define LIEF_MAP_LIST_H
18#include <map>
19#include <vector>
20
21#include "LIEF/visibility.h"
22#include "LIEF/iterators.hpp"
23#include "LIEF/Object.hpp"
24
25#include "LIEF/DEX/MapItem.hpp"
26
27namespace LIEF {
28namespace DEX {
29class Parser;
30class Class;
31class LIEF_API MapList : public Object {
38 friend class Parser;
39
40 public:
41 using items_t = std::map<MapItem::TYPES, MapItem>;
42 using it_items_t = ref_iterator<std::vector<MapItem*>>;
43 using it_const_items_t = const_ref_iterator<std::vector<MapItem*>>;
44
45 public:
47
48 MapList(const MapList&);
49 MapList& operator=(const MapList&);
50 it_items_t items();
53 it_const_items_t items() const;
54 bool has(MapItem::TYPES type) const;
57 const MapItem& get(MapItem::TYPES type) const;
60 MapItem& get(MapItem::TYPES type);
63 const MapItem& operator[](MapItem::TYPES type) const;
66 MapItem& operator[](MapItem::TYPES type);
69
70 void accept(Visitor& visitor) const override;
71
72
73 LIEF_API friend std::ostream& operator<<(std::ostream& os, const MapList& mtd);
74
75 ~MapList() override;
76
77 private:
78 items_t items_;
79
80};
81
82} // Namespace DEX
83} // Namespace LIEF
84#endif
Class which represents a DEX Class (i.e. a Java/Kotlin class)
Definition DEX/Class.hpp:36
Class which represents the map_list structure that follows the main DEX header.
Definition MapList.hpp:37
const MapItem & operator[](MapItem::TYPES type) const
Return the LIEF::DEX::MapItem associated with the given type.
const MapItem & get(MapItem::TYPES type) const
Return the LIEF::DEX::MapItem associated with the given type.
it_items_t items()
Iterator over LIEF::DEX::MapItem.
~MapList() override
MapItem & get(MapItem::TYPES type)
Return the LIEF::DEX::MapItem associated with the given type.
MapItem & operator[](MapItem::TYPES type)
Return the LIEF::DEX::MapItem associated with the given type.
friend std::ostream & operator<<(std::ostream &os, const MapList &mtd)
MapList & operator=(const MapList &)
MapList(const MapList &)
bool has(MapItem::TYPES type) const
Check if the given type exists.
void accept(Visitor &visitor) const override
it_const_items_t items() const
Class which parses a DEX file to produce a DEX::File object.
Definition DEX/Parser.hpp:38
Definition DEX/Class.hpp:30
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41