1
0
mirror of synced 2024-11-28 17:40:51 +01:00
ImHex/include/views/view_strings.hpp
qdlmcfresh 372908ba9d
add regex filter in string view (#345)
* Filter by regex in string view

* Dont recompile the regex for every string, display error message

* localization

* Use data->Buf for pattern creation / searching
The filter string seems to get updated after the callback finished.
Therefore the search string was always 1 character behind the actual
string in the textfield when calling find() / creating the regex.
2021-11-25 08:46:42 +01:00

42 lines
860 B
C++

#pragma once
#include <hex/views/view.hpp>
#include <cstdio>
#include <string>
namespace hex {
namespace prv { class Provider; }
struct FoundString {
u64 offset;
size_t size;
};
class ViewStrings : public View {
public:
explicit ViewStrings();
~ViewStrings() override;
void drawContent() override;
void drawMenu() override;
private:
bool m_searching = false;
bool m_regex = false;
bool m_pattern_parsed = false;
std::vector<FoundString> m_foundStrings;
std::vector<size_t> m_filterIndices;
int m_minimumLength = 5;
std::string m_filter;
std::string m_selectedString;
std::string m_demangledName;
void searchStrings();
void createStringContextMenu(const FoundString &foundString);
};
}