i wrote document generation code for my project.
this might help some of you.
here is how it works
ConfigureEngine(); // create engine, register stuff
GenerateDocument(engine, "scriptDocument.h"); // create document for registered object, functions, etc..
you may also add comments
asDocgen::AddTypeComment("ProceduralTriangleBuffer", "/** Add generated shapes to this. \nThen transform to mesh to get a big mesh. */");
r = engine->RegisterObjectType("ProceduralTriangleBuffer", sizeof(TriangleBuffer), asOBJ_VALUE | asOBJ_APP_CLASS_CD);
assert( r>= 0);
asDocgen::AddTypeMemberComment("ProceduralTriangleBuffer", "MeshPtr transformToMesh", "/** Generate a mesh to be used */");
r = engine->RegisterObjectMethod("ProceduralTriangleBuffer", ("MeshPtr transformToMesh(const string &in name = \"\", const string &in group = \"" + ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME + "\")").c_str(), asMETHOD(TriangleBuffer, transformToMesh), asCALL_THISCALL);
asDocgen::AddGlobalPropertyComment("LevelLoader LL", "/** Handle to level loader singleton. \nHas object creation/destruction methods */");
r = engine->RegisterGlobalProperty("LevelLoader LL", LevelLoader::getSingletonPtr());
assert( r >= 0);
asDocgen::AddGlobalFunctionComment("void CallGarbageCollector", "/** Call script garbage collector, slow operation. Call after level destroy or\nsomething that created/destroyed many objects*/");
r = engine->RegisterGlobalFunction("void CallGarbageCollector()", asFUNCTION(CallGarbageCollector), asCALL_CDECL);
assert( r >= 0);
AddEnumComment("TESTENUM", "// TEST ENUMM");
engine->RegisterEnum("TESTENUM");
AddEnumComment("TESTENUM", "some", "// TEETETE TTET TET ET");
engine->RegisterEnumValue("TESTENUM", "some", some);
Do not forget to call, this will empty all the added comments from memory
asDoc::ClearComments();
Generated document will look like this:
/** Add generated shapes to this.
Then transform to mesh to get a big mesh. */
class ProceduralTriangleBuffer
{
public:
// Methods
/** Generate a mesh to be used */
MeshPtr transformToMesh(const string&in arg0 = "", const string&in arg1 = "General");
};
/** Call script garbage collector, slow operation. Call after level destroy or
something that created/destroyed many objects*/
void CallGarbageCollector();
/** Handle to level loader singleton.
Has object creation/destruction methods */
LevelLoader LL;
Goal is to generate and intellisense helper, and stop scripters asking you about registered methods.
Most of you probably already has something like this
might help to some lazy people like me
code is Public Domain.