extend global search to all record and reference tables

search
Marc Zinnschlag 10 years ago
parent 13a4fb3fdc
commit c5f1c2127d

@ -12,8 +12,15 @@
CSMTools::SearchOperation::SearchOperation (CSMDoc::Document& document)
: CSMDoc::Operation (CSMDoc::State_Searching, false)
{
appendStage (new SearchStage (&dynamic_cast<CSMWorld::IdTableBase&> (*document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells))));
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))));
}
void CSMTools::SearchOperation::configure (const Search& search)

@ -348,6 +348,25 @@ std::vector<CSMWorld::UniversalId::Type> CSMWorld::UniversalId::listReferenceabl
return list;
}
std::vector<CSMWorld::UniversalId::Type> CSMWorld::UniversalId::listTypes (int classes)
{
std::vector<CSMWorld::UniversalId::Type> list;
for (int i=0; sNoArg[i].mName; ++i)
if (sNoArg[i].mClass & classes)
list.push_back (sNoArg[i].mType);
for (int i=0; sIdArg[i].mName; ++i)
if (sIdArg[i].mClass & classes)
list.push_back (sIdArg[i].mType);
for (int i=0; sIndexArg[i].mName; ++i)
if (sIndexArg[i].mClass & classes)
list.push_back (sIndexArg[i].mType);
return list;
}
CSMWorld::UniversalId::Type CSMWorld::UniversalId::getParentType (Type type)
{
for (int i=0; sIdArg[i].mType; ++i)

@ -16,16 +16,16 @@ namespace CSMWorld
enum Class
{
Class_None = 0,
Class_Record,
Class_RefRecord, // referenceable record
Class_SubRecord,
Class_RecordList,
Class_Collection, // multiple types of records combined
Class_Transient, // not part of the world data or the project data
Class_NonRecord, // record like data that is not part of the world
Class_Resource, ///< \attention Resource IDs are unique only within the
Class_Record = 1,
Class_RefRecord = 2, // referenceable record
Class_SubRecord = 4,
Class_RecordList = 8,
Class_Collection = 16, // multiple types of records combined
Class_Transient = 32, // not part of the world data or the project data
Class_NonRecord = 64, // record like data that is not part of the world
Class_Resource = 128, ///< \attention Resource IDs are unique only within the
/// respective collection
Class_ResourceList
Class_ResourceList = 256
};
enum ArgumentType
@ -181,6 +181,8 @@ namespace CSMWorld
static std::vector<Type> listReferenceableTypes();
static std::vector<Type> listTypes (int classes);
/// If \a type is a SubRecord, RefRecord or Record type return the type of the table
/// that contains records of type \a type.
/// Otherwise return Type_None.

Loading…
Cancel
Save