IDA C++ SDK 9.2
Loading...
Searching...
No Matches
indexer.hpp
Go to the documentation of this file.
1/*
2 * Interactive disassembler (IDA).
3 * Copyright (c) 1990-2026 Hex-Rays
4 * ALL RIGHTS RESERVED.
5 */
6
17
18#ifndef INDEXER_HPP
19#define INDEXER_HPP
20
21#include <pro.h>
22#include <bytes.hpp>
23#include <name.hpp>
24
25//-------------------------------------------------------------------------
27using subindex_typeid_t = size_t;
28
30enum builtin_idxes_t ENUM_SIZE(subindex_typeid_t)
31{
32 INVALID_SUBIDX_ID = 0,
33 SUBIDX_FUNCTIONS,
34 SUBIDX_LTYPES,
35 SUBIDX_NAMES,
36 SUBIDX_SEGMENTS,
37 SUBIDX_FUNCTION_COMMENTS,
38 SUBIDX_REPEATABLE_FUNCTION_COMMENTS,
39#ifdef __KERNEL__
40 SUBIDX_MAX,
41#endif
42};
43
48{
49 size_t start;
50 size_t end;
51};
53
54//-------------------------------------------------------------------------
55
56// Indexer API
57//-------------------------------------------------------------------------
58
66
76
81{
84 virtual size_t size() const = 0;
86 virtual std::string_view get_name(size_t index) const = 0;
88 virtual const qstring &get_name_str(size_t index) const = 0;
90 virtual int get_score(size_t index) const = 0;
92 virtual ea_t get_ea(size_t index) const = 0;
94 virtual nodeidx_t get_netnode_idx(size_t index) const = 0;
96 virtual int get_ltype_ordinal(size_t index) const = 0;
98 virtual type_t get_ltype_type(size_t index) const = 0;
100 virtual subindex_typeid_t get_subindex(size_t index) const = 0;
102 virtual size_t get_match_ranges_count(size_t index) const = 0;
104 virtual match_range_t get_match_range(size_t index, size_t range_idx) const = 0;
107 virtual match_range_t get_match_line_range([[maybe_unused]] size_t index) const { return {0, 0}; }
108
109 bool empty() const { return size() == 0; }
110};
111
115idaman bool ida_export indexer_is_enabled();
116
121 const qstring &query,
122 const match_config_t &config);
123
128 subindex_typeid_t subindex_id,
129 const qstring &query,
130 const match_config_t &config);
131
132#endif // INDEXER_HPP
Contains functions that deal with individual byte characteristics.
DECLARE_TYPE_AS_MOVABLE(match_range_t)
size_t subindex_typeid_t
Numeric identifier for a sub-index category. See builtin_idxes_t.
Definition indexer.hpp:27
match_mode_t
Matching algorithm used by the indexer.
Definition indexer.hpp:61
@ STR_MATCH
Substring match (default). Fast and exact.
Definition indexer.hpp:62
@ FUZZY
Fuzzy match.
Definition indexer.hpp:63
idaman bool ida_export indexer_is_enabled()
Returns true if the indexer is enabled for the current database.
idaman search_result_data_t *ida_export indexer_match(subindex_typeid_t subindex_id, const qstring &query, const match_config_t &config)
Search a single sub-index identified by subindex_id for query.
idaman search_result_data_t *ida_export indexer_match_all(const qstring &query, const match_config_t &config)
Search all sub-indexes for query using config.
enum builtin_idxes_t ENUM_SIZE(subindex_typeid_t)
Identifiers for the built-in indexer sub-categories.
Definition indexer.hpp:30
uchar type_t
In serialized form, a type is represented by a byte sequence.
Definition nalt.hpp:1312
Functions that deal with names.
nodeidx64_t nodeidx_t
Definition netnode.hpp:114
This is the first header included in the IDA project.
uint64 ea_t
Definition pro.h:425
_qstring< char > qstring
regular string
Definition pro.h:3771
Configuration for an indexer search.
Definition indexer.hpp:69
int max_results
Maximum number of results to return.
Definition indexer.hpp:73
size_t cb
Size of this structure. Used for forward compatibility.
Definition indexer.hpp:70
int score_cutoff
Minimum score, in percent (fuzzy mode only). Results below this threshold are discarded.
Definition indexer.hpp:72
match_mode_t mode
Matching algorithm to use.
Definition indexer.hpp:71
A half-open character range [start, end) within a result name string, indicating which characters wer...
Definition indexer.hpp:48
size_t start
Index of the first matched character.
Definition indexer.hpp:49
size_t end
One past the last matched character.
Definition indexer.hpp:50
Opaque handle owning a set of search results returned by the indexer.
Definition indexer.hpp:81
virtual type_t get_ltype_type(size_t index) const =0
BT_* type code of the local type at index (valid when get_ltype_ordinal() != 0).
virtual match_range_t get_match_range(size_t index, size_t range_idx) const =0
Returns the range_idx'th matched range for result at index.
virtual ~search_result_data_t()
Definition indexer.hpp:82
virtual nodeidx_t get_netnode_idx(size_t index) const =0
Netnode index of result at index.
virtual int get_score(size_t index) const =0
Match score of result at index, in percent [0, 100].
virtual ea_t get_ea(size_t index) const =0
Effective address of result at index, or BADADDR for local types.
virtual int get_ltype_ordinal(size_t index) const =0
Local type ordinal of result at index, or 0 if not a local type.
virtual size_t get_match_ranges_count(size_t index) const =0
Number of matched character ranges for result at index.
virtual const qstring & get_name_str(size_t index) const =0
Name of result at index, as a qstring reference.
virtual size_t size() const =0
Number of results.
bool empty() const
Definition indexer.hpp:109
virtual subindex_typeid_t get_subindex(size_t index) const =0
Sub-index that produced result at index (e.g. SUBIDX_FUNCTIONS).
virtual std::string_view get_name(size_t index) const =0
Name of result at index.
virtual match_range_t get_match_line_range(size_t index) const
For function-comment results, the range within get_name_str() that holds the matched comment line.
Definition indexer.hpp:107