forked from teamnwah/openmw-tes3coop
generalised the concept of record scope
parent
4d49924025
commit
828536e999
@ -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…
Reference in New Issue