MCPcopy Create free account
hub / github.com/anjo76/angelscript / DetermineNameAndNamespace

Method DetermineNameAndNamespace

sdk/angelscript/source/as_scriptengine.cpp:6439–6478  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

6437
6438// internal
6439int asCScriptEngine::DetermineNameAndNamespace(const char *in_name, asSNameSpace *implicitNs, asCString &out_name, asSNameSpace *&out_ns) const
6440{
6441 if( in_name == 0 )
6442 return asINVALID_ARG;
6443
6444 asCString name = in_name;
6445 asCString scope;
6446 asSNameSpace *ns = implicitNs;
6447
6448 // Check if the given name contains a scope
6449 int pos = name.FindLast("::");
6450 if( pos >= 0 )
6451 {
6452 scope = name.SubString(0, pos);
6453 name = name.SubString(pos+2);
6454 if( pos == 0 )
6455 {
6456 // The scope is '::' so the search must start in the global namespace
6457 ns = nameSpaces[0];
6458 }
6459 else if( scope.SubString(0, 2) == "::" )
6460 {
6461 // The scope starts with '::' so the given scope is fully qualified
6462 ns = FindNameSpace(scope.SubString(2).AddressOf());
6463 }
6464 else
6465 {
6466 // The scope doesn't start with '::' so it is relative to the current namespace
6467 if( implicitNs->name == "" )
6468 ns = FindNameSpace(scope.AddressOf());
6469 else
6470 ns = FindNameSpace((implicitNs->name + "::" + scope).AddressOf());
6471 }
6472 }
6473
6474 out_name = name;
6475 out_ns = ns;
6476
6477 return 0;
6478}
6479
6480
6481// interface

Callers 3

GetFunctionByNameMethod · 0.80
GetTypeInfoByNameMethod · 0.80

Calls 3

FindLastMethod · 0.80
SubStringMethod · 0.80
AddressOfMethod · 0.45

Tested by

no test coverage detected