mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 14:45:39 +00:00
generalised the concept of record scope
This commit is contained in:
parent
4d49924025
commit
828536e999
3 changed files with 49 additions and 1 deletions
|
@ -24,7 +24,7 @@ opencs_units (model/world
|
||||||
|
|
||||||
opencs_units_noqt (model/world
|
opencs_units_noqt (model/world
|
||||||
universalid record commands columnbase scriptcontext cell refidcollection
|
universalid record commands columnbase scriptcontext cell refidcollection
|
||||||
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager
|
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_hdrs_noqt (model/world
|
opencs_hdrs_noqt (model/world
|
||||||
|
|
25
apps/opencs/model/world/scope.cpp
Normal file
25
apps/opencs/model/world/scope.cpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
#include "scope.hpp"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
|
CSMWorld::Scope CSMWorld::getScopeFromId (const std::string& id)
|
||||||
|
{
|
||||||
|
// get root namespace
|
||||||
|
std::string namespace_;
|
||||||
|
|
||||||
|
std::string::size_type i = id.find ("::");
|
||||||
|
|
||||||
|
if (i!=std::string::npos)
|
||||||
|
namespace_ = Misc::StringUtils::lowerCase (id.substr (0, i));
|
||||||
|
|
||||||
|
if (namespace_=="project")
|
||||||
|
return Scope_Project;
|
||||||
|
|
||||||
|
if (namespace_=="session")
|
||||||
|
return Scope_Session;
|
||||||
|
|
||||||
|
return Scope_Content;
|
||||||
|
}
|
23
apps/opencs/model/world/scope.hpp
Normal file
23
apps/opencs/model/world/scope.hpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef CSM_WOLRD_SCOPE_H
|
||||||
|
#define CSM_WOLRD_SCOPE_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
enum Scope
|
||||||
|
{
|
||||||
|
// record stored in content file
|
||||||
|
Scope_Content = 1,
|
||||||
|
|
||||||
|
// record stored in project file
|
||||||
|
Scope_Project = 2,
|
||||||
|
|
||||||
|
// record that exists only for the duration of one editing session
|
||||||
|
Scope_Session = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
Scope getScopeFromId (const std::string& id);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue