Added: Logical operator "not" to expression language (see e.g. If and Eval commands).

This commit is contained in:
jthedering committed 2019-06-09 20:48:45 +00:00
1 parent c73cf6b7f2
commit e2d3da7a9e
6 files changed
+88

No files matched your search

+2
View File
@@ -182,6 +182,7 @@
<ClInclude Include="IFilter.h" />
<ClInclude Include="IFilterFactory.h" />
<ClInclude Include="libHybridConv-0.1.1\libHybridConv_eapo.h" />
<ClInclude Include="parser\LogicalOperators.h" />
<ClInclude Include="parser\RegexFunctions.h" />
<ClInclude Include="parser\RegistryFunctions.h" />
<ClInclude Include="parser\StringOperators.h" />
@@ -230,6 +231,7 @@
<ClCompile Include="helpers\VSTPluginLibrary.cpp" />
<ClCompile Include="IFilter.cpp" />
<ClCompile Include="libHybridConv-0.1.1\libHybridConv_eapo.cpp" />
<ClCompile Include="parser\LogicalOperators.cpp" />
<ClCompile Include="parser\RegexFunctions.cpp" />
<ClCompile Include="parser\RegistryFunctions.cpp" />
<ClCompile Include="parser\StringOperators.cpp" />
+6
View File
@@ -141,6 +141,9 @@
<ClInclude Include="filters\loudnessCorrection\LoudnessCorrectionFilter.h">
<Filter>filters\loudnessCorrection</Filter>
</ClInclude>
<ClInclude Include="parser\LogicalOperators.h">
<Filter>parser</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp" />
@@ -267,6 +270,9 @@
<ClCompile Include="filters\loudnessCorrection\LoudnessCorrectionFilter.cpp">
<Filter>filters\loudnessCorrection</Filter>
</ClCompile>
<ClCompile Include="parser\LogicalOperators.cpp">
<Filter>parser</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="filters">
+2
View File
@@ -21,6 +21,7 @@ SOURCES += main.cpp\
../helpers/LogHelper.cpp \
../helpers/StringHelper.cpp \
../helpers/RegistryHelper.cpp \
../parser/LogicalOperators.cpp \
IFilterGUIFactory.cpp \
IFilterGUI.cpp \
guis/PreampFilterGUI.cpp \
@@ -139,6 +140,7 @@ HEADERS += \
../helpers/LogHelper.h \
../helpers/StringHelper.h \
../helpers/RegistryHelper.h \
../parser/LogicalOperators.h \
IFilterGUIFactory.h \
stable.h \
IFilterGUI.h \
+2
View File
@@ -25,6 +25,7 @@
#include "parser/RegexFunctions.h"
#include "parser/RegistryFunctions.h"
#include "parser/StringOperators.h"
#include "parser/LogicalOperators.h"
#include "FilterEngine.h"
#include "ExpressionFilterFactory.h"
@@ -45,6 +46,7 @@ void ExpressionFilterFactory::initialize(FilterEngine* engine)
parser->RemoveOprt(L"+");
parser->DefineOprt(new AddOperator());
parser->DefineInfixOprt(new NotOperator());
}
vector<IFilter*> ExpressionFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters)
+44
View File
@@ -0,0 +1,44 @@
/*
This file is part of Equalizer APO, a system-wide equalizer.
Copyright (C) 2019 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
#include "LogicalOperators.h"
using namespace std;
using namespace mup;
NotOperator::NotOperator()
: IOprtInfix(L"not", prINFIX)
{}
void NotOperator::Eval(ptr_val_type& ret, const ptr_val_type* arg, int argc)
{
assert(argc == 1);
*ret = !arg[0]->GetBool();
}
const char_type* NotOperator::GetDesc() const
{
return L"logical not";
}
IToken* NotOperator::Clone() const
{
return new NotOperator(*this);
}
+32
View File
@@ -0,0 +1,32 @@
/*
This file is part of Equalizer APO, a system-wide equalizer.
Copyright (C) 2019 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include <mpParser.h>
#include <mpOprtNonCmplx.h>
class NotOperator : public mup::IOprtInfix
{
public:
NotOperator();
void Eval(mup::ptr_val_type& ret, const mup::ptr_val_type* arg, int argc) override;
const mup::char_type* GetDesc() const;
mup::IToken* Clone() const override;
};