|
@@ -2718,6 +2718,59 @@ DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (bool commands), (fal
|
|
|
|
|
|
return dictionary;
|
|
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 {
|
|
namespace {
|