mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
add a getMethodSigsNS
takes a namespace as an explici value fed to it as oposed to inferring from an passed object
This commit is contained in:
parent
428f22d728
commit
b03cb4c49b
|
|
@ -2718,6 +2718,59 @@ DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (bool commands), (fal
|
|||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
DefineEngineFunction(getMethodSigsNS, ArrayObject*, (StringTableEntry className, bool commands), (false),
|
||||
"List the methods defined on this object.\n\n"
|
||||
"Each description is a newline-separated vector with the following elements:\n"
|
||||
"- method prototype string.\n"
|
||||
"- Documentation string (not including prototype). This takes up the remainder of the vector.\n"
|
||||
"@return An ArrayObject populated with (name,description) pairs of all methods defined on the object.")
|
||||
{
|
||||
|
||||
Namespace* ns = Con::lookupNamespace(className);
|
||||
if (!ns)
|
||||
return 0;
|
||||
|
||||
ArrayObject* dictionary = new ArrayObject();
|
||||
dictionary->registerObject();
|
||||
|
||||
VectorPtr<Namespace::Entry*> vec(__FILE__, __LINE__);
|
||||
ns->getEntryList(&vec);
|
||||
for (Vector< Namespace::Entry* >::iterator j = vec.begin(); j != vec.end(); j++)
|
||||
{
|
||||
Namespace::Entry* e = *j;
|
||||
|
||||
if (commands)
|
||||
{
|
||||
if ((e->mType < Namespace::Entry::ConsoleFunctionType))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((e->mType > Namespace::Entry::ScriptCallbackType))
|
||||
continue;
|
||||
}
|
||||
StringBuilder str;
|
||||
str.append("function ");
|
||||
str.append(ns->getName());
|
||||
str.append("::");
|
||||
str.append(e->getPrototypeSig());
|
||||
str.append('\n');
|
||||
str.append("{");
|
||||
String docs = e->getDocString();
|
||||
if (!docs.isEmpty())
|
||||
{
|
||||
str.append("\n/*");
|
||||
str.append(docs);
|
||||
str.append("\n*/");
|
||||
}
|
||||
str.append('\n');
|
||||
str.append("}");
|
||||
dictionary->push_back(e->mFunctionName, str.end());
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
Loading…
Reference in a new issue