mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
new method, getMethodSigs. spits out callback proto-functions
This commit is contained in:
parent
f903140d22
commit
a8e74787b7
3 changed files with 87 additions and 0 deletions
|
|
@ -2655,6 +2655,50 @@ DefineEngineMethod( SimObject, dumpMethods, ArrayObject*, (),,
|
|||
return dictionary;
|
||||
}
|
||||
|
||||
DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (), ,
|
||||
"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 = object->getNamespace();
|
||||
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 (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…
Add table
Add a link
Reference in a new issue