remove unused custom filter code

This commit is contained in:
Akash Mozumdar 2018-06-12 19:37:45 -04:00
parent 1dbaff780c
commit 162b2cb79f
5 changed files with 0 additions and 118 deletions

View File

@ -56,8 +56,6 @@ set(resource_src
set(ithvnr_src
gui/command.cpp
gui/CustomFilter.cpp
gui/CustomFilter.h
gui/ITH.h
gui/language.cpp
gui/language.h

View File

@ -1,44 +0,0 @@
/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
* This file is part of the Interactive Text Hooker.
* Interactive Text Hooker 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "CustomFilter.h"
void CustomFilter::Insert(WORD number)
{
set.insert(number);
}
void CustomFilter::Erase(WORD number)
{
set.erase(number);
}
bool CustomFilter::Find(WORD number) const
{
return set.find(number) != set.end();
}
void CustomFilter::Clear()
{
set.clear();
}
void CustomFilter::Traverse(CustomFilterCallBack callback, PVOID param)
{
for (auto ch = set.begin(); ch != set.end(); ++ch)
callback(*ch, param);
}

View File

@ -1,34 +0,0 @@
/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
* This file is part of the Interactive Text Hooker.
* Interactive Text Hooker 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ITH.h"
typedef void (*CustomFilterCallBack) (WORD, PVOID);
class CustomFilter
{
public:
bool Find(WORD number) const;
void Insert(WORD number);
void Erase(WORD number);
void Clear();
void Traverse(CustomFilterCallBack callback, PVOID param);
private:
std::set<WORD> set;
};

View File

@ -19,7 +19,6 @@
#include "host/host.h"
#include "host/hookman.h"
#include "host/settings.h"
#include "CustomFilter.h"
#include "profile/Profile.h"
#include "ProfileManager.h"
@ -36,8 +35,6 @@ extern "C" {
void IthCloseSystemService();
}
CustomFilter* uni_filter;
CustomFilter* mb_filter;
HookManager* man;
Settings* setman;
LONG split_time, cyclic_remove, global_filter;
@ -94,10 +91,6 @@ void SaveSettings()
auto root = doc.root().append_child(L"ITH_Setting");
for (auto it = setting.begin(); it != setting.end(); ++it)
root.append_attribute(it->first.c_str()).set_value(it->second);
auto filter = root.append_child(L"SingleCharFilter");
filter.append_child(pugi::xml_node_type::node_pcdata);
mb_filter->Traverse(RecordMBChar, &filter);
uni_filter->Traverse(RecordUniChar, &filter);
doc.save(fw);
}
}
@ -169,32 +162,6 @@ void LoadSettings()
if (it != setting.end())
it->second = std::stoul(attr->value());
}
auto filter = root.child(L"SingleCharFilter");
if (filter)
{
for (auto attr = filter.attributes_begin(); attr != filter.attributes_end(); ++attr)
{
if (attr->name()[0] == L'm')
{
DWORD c = std::stoul(attr->name() + 1, NULL, 16);
mb_filter->Insert(c & 0xFFFF);
}
else if (attr->name()[0] == L'u')
{
DWORD c = std::stoul(attr->name() + 1, NULL, 16);
uni_filter->Insert(c & 0xFFFF);
}
}
std::wstring filter_value = filter.text().get();
for (auto it = filter_value.begin(); it != filter_value.end(); ++it)
{
WCHAR filter_unichar[2] = { *it, L'\0' };
char filter_mbchar[4];
WC_MB(filter_unichar, filter_mbchar, 4);
mb_filter->Insert(*(WORD*)filter_mbchar);
uni_filter->Insert(*it);
}
}
}
}
@ -254,8 +221,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
setman->splittingInterval = 200;
MonitorFlag = true;
pfman = new ProfileManager();
mb_filter = new CustomFilter();
uni_filter = new CustomFilter();
DefaultSettings();
LoadSettings();
InitializeSettings();

View File

@ -24,7 +24,6 @@
#include "version.h"
#include "ProfileManager.h"
#include "host/settings.h"
#include "CustomFilter.h"
#include "profile/Profile.h"
#include "TextBuffer.h"
#include "profile/misc.h"
@ -45,8 +44,6 @@ ProcessWindow* pswnd;
TextBuffer* texts;
extern ProfileManager* pfman; // ProfileManager.cpp
extern HookManager* man; // main.cpp
extern CustomFilter* mb_filter; // main.cpp
extern CustomFilter* uni_filter; // main.cpp
extern Settings* setman; // main.cpp
#define COMMENT_BUFFER_LENGTH 512
static WCHAR comment_buffer[COMMENT_BUFFER_LENGTH];