2015-03-27 15:33:54 +00:00
|
|
|
#include "searchoperation.hpp"
|
|
|
|
|
|
|
|
#include "../doc/document.hpp"
|
2022-09-22 18:26:05 +00:00
|
|
|
#include "../doc/state.hpp"
|
2015-03-27 15:33:54 +00:00
|
|
|
|
|
|
|
#include "../world/data.hpp"
|
|
|
|
#include "../world/idtablebase.hpp"
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <apps/opencs/model/doc/messages.hpp>
|
|
|
|
#include <apps/opencs/model/doc/operation.hpp>
|
|
|
|
#include <apps/opencs/model/tools/search.hpp>
|
|
|
|
#include <apps/opencs/model/world/universalid.hpp>
|
|
|
|
|
2015-03-27 15:33:54 +00:00
|
|
|
#include "searchstage.hpp"
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
CSMTools::SearchOperation::SearchOperation(CSMDoc::Document& document)
|
|
|
|
: CSMDoc::Operation(CSMDoc::State_Searching, false)
|
2015-03-27 15:33:54 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
std::vector<CSMWorld::UniversalId::Type> types = CSMWorld::UniversalId::listTypes(
|
|
|
|
CSMWorld::UniversalId::Class_RecordList | CSMWorld::UniversalId::Class_ResourceList);
|
2015-03-28 13:36:28 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
for (std::vector<CSMWorld::UniversalId::Type>::const_iterator iter(types.begin()); iter != types.end(); ++iter)
|
|
|
|
appendStage(new SearchStage(&dynamic_cast<CSMWorld::IdTableBase&>(*document.getData().getTableModel(*iter))));
|
2015-06-20 17:04:19 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
setDefaultSeverity(CSMDoc::Message::Severity_Info);
|
2015-03-27 15:33:54 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void CSMTools::SearchOperation::configure(const Search& search)
|
2015-03-27 15:33:54 +00:00
|
|
|
{
|
|
|
|
mSearch = search;
|
|
|
|
}
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void CSMTools::SearchOperation::appendStage(SearchStage* stage)
|
2015-03-27 15:33:54 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
CSMDoc::Operation::appendStage(stage);
|
|
|
|
stage->setOperation(this);
|
2015-03-27 15:33:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const CSMTools::Search& CSMTools::SearchOperation::getSearch() const
|
|
|
|
{
|
|
|
|
return mSearch;
|
|
|
|
}
|