1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:53:52 +00:00
openmw/apps/opencs/model/tools/searchoperation.cpp
2022-10-31 21:04:01 +01:00

44 lines
1.3 KiB
C++

#include "searchoperation.hpp"
#include "../doc/document.hpp"
#include "../doc/state.hpp"
#include "../world/data.hpp"
#include "../world/idtablebase.hpp"
#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>
#include "searchstage.hpp"
CSMTools::SearchOperation::SearchOperation(CSMDoc::Document& document)
: CSMDoc::Operation(CSMDoc::State_Searching, false)
{
std::vector<CSMWorld::UniversalId::Type> types = CSMWorld::UniversalId::listTypes(
CSMWorld::UniversalId::Class_RecordList | CSMWorld::UniversalId::Class_ResourceList);
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))));
setDefaultSeverity(CSMDoc::Message::Severity_Info);
}
void CSMTools::SearchOperation::configure(const Search& search)
{
mSearch = search;
}
void CSMTools::SearchOperation::appendStage(SearchStage* stage)
{
CSMDoc::Operation::appendStage(stage);
stage->setOperation(this);
}
const CSMTools::Search& CSMTools::SearchOperation::getSearch() const
{
return mSearch;
}