sys: Added setting to synchronize pattern source code between providers

This commit is contained in:
WerWolv
2022-07-31 20:07:15 +02:00
parent df94370598
commit 763f15fa36
11 changed files with 96 additions and 44 deletions

View File

@@ -24,6 +24,40 @@ namespace hex::plugin::builtin {
void drawAlwaysVisible() override;
void drawContent() override;
private:
struct PatternVariable {
bool inVariable;
bool outVariable;
pl::Token::ValueType type;
pl::Token::Literal value;
};
enum class EnvVarType
{
Integer,
Float,
String,
Bool
};
struct EnvVar {
u64 id;
std::string name;
pl::Token::Literal value;
EnvVarType type;
bool operator==(const EnvVar &other) const {
return this->id == other.id;
}
};
enum class DangerousFunctionPerms : u8 {
Ask,
Allow,
Deny
};
private:
std::unique_ptr<pl::PatternLanguage> m_parserRuntime;
@@ -47,47 +81,18 @@ namespace hex::plugin::builtin {
TextEditor m_textEditor;
std::vector<std::pair<pl::LogConsole::Level, std::string>> m_console;
struct PatternVariable {
bool inVariable;
bool outVariable;
pl::Token::ValueType type;
pl::Token::Literal value;
};
std::map<std::string, PatternVariable> m_patternVariables;
enum class EnvVarType
{
Integer,
Float,
String,
Bool
};
struct EnvVar {
u64 id;
std::string name;
pl::Token::Literal value;
EnvVarType type;
bool operator==(const EnvVar &other) const {
return this->id == other.id;
}
};
u64 m_envVarIdCounter;
std::list<EnvVar> m_envVarEntries;
enum class DangerousFunctionPerms : u8 {
Ask,
Allow,
Deny
};
std::atomic<bool> m_dangerousFunctionCalled = false;
std::atomic<DangerousFunctionPerms> m_dangerousFunctionsAllowed = DangerousFunctionPerms::Ask;
bool m_syncPatternSourceCode = false;
bool m_autoLoadPatterns = true;
private:
void drawConsole(ImVec2 size);
void drawEnvVars(ImVec2 size);
void drawVariableSettings(ImVec2 size);