2014-08-06 07:53:10 +00:00
|
|
|
#include "scope.hpp"
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
2022-08-02 22:00:54 +00:00
|
|
|
#include <components/misc/strings/lower.hpp>
|
2014-08-06 07:53:10 +00:00
|
|
|
|
|
|
|
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)
|
2022-08-02 21:57:09 +00:00
|
|
|
namespace_ = Misc::StringUtils::lowerCase(std::string_view(id).substr(0, i));
|
2014-08-06 07:53:10 +00:00
|
|
|
|
|
|
|
if (namespace_=="project")
|
|
|
|
return Scope_Project;
|
|
|
|
|
|
|
|
if (namespace_=="session")
|
|
|
|
return Scope_Session;
|
|
|
|
|
|
|
|
return Scope_Content;
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|