ImHex/plugins/builtin/include/content/views/view_pattern_editor.hpp

60 lines
1.5 KiB
C++
Raw Normal View History

#pragma once
#include <hex/views/view.hpp>
#include <hex/pattern_language/pattern_language.hpp>
#include <hex/pattern_language/log_console.hpp>
#include <hex/providers/provider.hpp>
#include <cstring>
#include <filesystem>
#include <string_view>
#include <thread>
#include <vector>
#include <TextEditor.h>
2021-12-07 21:47:41 +00:00
namespace hex::plugin::builtin {
class ViewPatternEditor : public View {
public:
ViewPatternEditor();
~ViewPatternEditor() override;
void drawMenu() override;
void drawAlwaysVisible() override;
void drawContent() override;
private:
pl::PatternLanguage *m_patternLanguageRuntime;
std::vector<std::filesystem::path> m_possiblePatternFiles;
u32 m_selectedPatternFile = 0;
bool m_runAutomatically = false;
2021-02-22 10:56:33 +00:00
bool m_evaluatorRunning = false;
bool m_hasUnevaluatedChanges = false;
bool m_acceptPatternWindowOpen = false;
TextEditor m_textEditor;
std::vector<std::pair<pl::LogConsole::Level, std::string>> m_console;
enum class EnvVarType {
Integer,
Float,
String,
Bool
};
struct EnvVar {
std::string name;
pl::Token::Literal value;
EnvVarType type;
};
std::vector<EnvVar> m_envVarEntries;
void loadPatternFile(const std::string &path);
void clearPatternData();
2020-11-10 20:31:04 +00:00
void parsePattern(char *buffer);
};
}