generalised the concept of record scope

deque
Marc Zinnschlag 11 years ago
parent 4d49924025
commit 828536e999

@ -24,7 +24,7 @@ opencs_units (model/world
opencs_units_noqt (model/world
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

@ -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;
}

@ -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…
Cancel
Save