MCPcopy Create free account
hub / github.com/axmolengine/axmol / calculateNamespacePath

Function calculateNamespacePath

core/base/Properties.cpp:1109–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1107}
1108
1109void calculateNamespacePath(std::string_view urlString,
1110 std::string& fileString,
1111 std::vector<std::string_view>& namespacePath)
1112{
1113 // If the url references a specific namespace within the file,
1114 // calculate the full namespace path to the final namespace.
1115 size_t loc = urlString.rfind('#');
1116 if (loc != std::string::npos)
1117 {
1118 fileString = urlString.substr(0, loc);
1119 auto namespacePathString = urlString.substr(loc + 1);
1120 while ((loc = namespacePathString.find('/')) != std::string::npos)
1121 {
1122 namespacePath.emplace_back(namespacePathString.substr(0, loc));
1123 namespacePathString = namespacePathString.substr(loc + 1);
1124 }
1125 namespacePath.emplace_back(namespacePathString);
1126 }
1127 else
1128 {
1129 fileString = urlString;
1130 }
1131}
1132
1133Properties* getPropertiesFromNamespacePath(Properties* properties, const std::vector<std::string_view>& namespacePath)
1134{

Callers 1

createNonRefCountedMethod · 0.85

Calls 4

rfindMethod · 0.45
substrMethod · 0.45
findMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected