summaryrefslogtreecommitdiff
path: root/client/docgen
diff options
context:
space:
mode:
Diffstat (limited to 'client/docgen')
-rw-r--r--client/docgen/doc.h3
-rw-r--r--client/docgen/docgen.cc87
-rw-r--r--client/docgen/generate.cc40
-rw-r--r--client/docgen/parse.cc18
-rw-r--r--client/docgen/style.css5
5 files changed, 129 insertions, 24 deletions
diff --git a/client/docgen/doc.h b/client/docgen/doc.h
index ae693f5..5678476 100644
--- a/client/docgen/doc.h
+++ b/client/docgen/doc.h
@@ -69,6 +69,9 @@ public:
QString title;
QString name;
QString tag;
+ bool serverside;
+ bool clientside;
+ QString classname;
QString extends;
bool container;
QString description;
diff --git a/client/docgen/docgen.cc b/client/docgen/docgen.cc
index e4af0a3..4eb2e08 100644
--- a/client/docgen/docgen.cc
+++ b/client/docgen/docgen.cc
@@ -32,6 +32,7 @@
#include <QDir>
#include <QMap>
#include <QDate>
+#include <QFileInfo>
#include <stdio.h>
@@ -39,7 +40,9 @@
#include "parse.h"
#include "generate.h"
-#define INPUT "../widgets"
+#define WIDGETS_DIR "../widgets"
+#define SERVER_DIR "../../server/src"
+#define CLIENT_DIR ".."
#define OUTPUT "html"
QString output;
@@ -94,16 +97,46 @@ void writeIndex(QMap<QString, Doc> &docs)
out += "<h1>Pracro "VERSION" Documentation</h1>\n";
out += "<h2>Overview</h2>\n";
+ out += "<h3>Clientside</h3>\n";
+ out += "<h4>Widgets</h4>\n";
out += "<ul>\n";
QMap<QString, Doc>::iterator i = docs.begin();
while(i != docs.end()) {
Doc &doc = *i;
- out += "<li><a href=\""+doc.name+".html\">["+doc.name+"]</a> - "+
- doc.title+"</li>\n";
+ if(doc.tag != "") {
+ out += "<li><a href=\""+doc.name+".html\">["+doc.name+"]</a> - "+
+ doc.title+"</li>\n";
+ }
+ i++;
+ }
+ out += "</ul>\n";
+ out += "<h4>Classes</h4>\n";
+ out += "<ul>\n";
+ i = docs.begin();
+ while(i != docs.end()) {
+ Doc &doc = *i;
+ if(doc.classname != "" && doc.clientside) {
+ out += "<li><a href=\""+doc.name+".html\">["+doc.name+"]</a> - "+
+ doc.title+"</li>\n";
+ }
i++;
}
out += "</ul>\n";
+ out += "<h3>Serverside</h3>\n";
+ out += "<ul>\n";
+ i = docs.begin();
+ while(i != docs.end()) {
+ Doc &doc = *i;
+ if(doc.classname != "" && doc.serverside) {
+ out += "<li><a href=\""+doc.name+".html\">["+doc.name+"]</a> - "+
+ doc.title+"</li>\n";
+ }
+ i++;
+ }
+ out += "</ul>\n";
+
+
QFile::remove(output + "/index.html");
QFile ofile(output + "/index.html");
ofile.open(QIODevice::ReadWrite | QIODevice::Text);
@@ -133,15 +166,47 @@ int main(int argc, char *argv[])
QFile::remove(output + "/style.css");
QFile::copy("style.css", output + "/style.css");
- QDir dir(INPUT);
- QStringList filter; filter << "*.h";
- dir.setNameFilters(filter);
+ QStringList files;
+
+ // Widgets
+ {
+ QDir dir(WIDGETS_DIR);
+ QStringList filter; filter << "*.h";
+ dir.setNameFilters(filter);
+ if(!dir.exists()) return 1;
+ QFileInfoList inflst = dir.entryInfoList(QDir::Files);
+ foreach(QFileInfo inf, inflst) {
+ files.append(inf.absoluteFilePath());
+ }
+ }
+
+ // Client
+ {
+ QDir dir(CLIENT_DIR);
+ QStringList filter; filter << "*.h";
+ dir.setNameFilters(filter);
+ if(!dir.exists()) return 1;
+ QFileInfoList inflst = dir.entryInfoList(QDir::Files);
+ foreach(QFileInfo inf, inflst) {
+ files.append(inf.absoluteFilePath());
+ }
+ }
+
+ // Server
+ {
+ QDir dir(SERVER_DIR);
+ QStringList filter; filter << "*.h";
+ dir.setNameFilters(filter);
+ if(!dir.exists()) return 1;
+ QFileInfoList inflst = dir.entryInfoList(QDir::Files);
+ foreach(QFileInfo inf, inflst) {
+ files.append(inf.absoluteFilePath());
+ }
+ }
- if(!dir.exists()) return 1;
- QStringList l = dir.entryList(QDir::Files);
- foreach(QString file, l) {
- Doc doc = parse(QString(INPUT) + "/" + file);
- if(doc.title != "" || doc.tag != "")
+ foreach(QString file, files) {
+ Doc doc = parse(file);
+ if(doc.title != "" || doc.tag != "" || doc.classname != "")
docs[doc.name] = doc;
}
diff --git a/client/docgen/generate.cc b/client/docgen/generate.cc
index b521f1f..f418b24 100644
--- a/client/docgen/generate.cc
+++ b/client/docgen/generate.cc
@@ -219,6 +219,18 @@ QString generate(Doc &doc, QMap<QString, QVector<Method> > &meths,
highlight("<" + doc.tag + " />", xml) + "</pre></div>\n";
}
+ if(doc.serverside)
+ out += " <div class=\"availablility\">Available serverside.</div>\n";
+
+ if(doc.clientside)
+ out += " <div class=\"availablility\">Available clientside.</div>\n";
+
+
+ if(doc.classname != "" ){
+ out += " <div class=\"classname\">Class<pre class=\"code\">" +
+ doc.classname + "</pre></div>\n";
+ }
+
if(doc.container) {
out += " <div class=\"container\">Widget is a container.</div>\n";
}
@@ -248,21 +260,23 @@ QString generate(Doc &doc, QMap<QString, QVector<Method> > &meths,
out += generateExamples(doc.examples, xml);
- out += " <h2>Attributes</h2>\n";
- out += " <div class=\"attributes\">\n";
- if(doc.attributes.size()) {
- out += generateAttributes(doc.attributes);
- }
+ if(doc.tag != "") {
+ out += " <h2>Attributes</h2>\n";
+ out += " <div class=\"attributes\">\n";
+ if(doc.attributes.size()) {
+ out += generateAttributes(doc.attributes);
+ }
- QMap<QString, QVector<Attribute> >::iterator i = atts.begin();
- while(i != atts.end()) {
- out += " <h3>Attributes inherited from <a href=\"" + i.key() +
- ".html\">"+i.key()+"</a>:</h3>\n";
- out += generateAttributes(i.value());
- i++;
+ QMap<QString, QVector<Attribute> >::iterator i = atts.begin();
+ while(i != atts.end()) {
+ out += " <h3>Attributes inherited from <a href=\"" + i.key() +
+ ".html\">"+i.key()+"</a>:</h3>\n";
+ out += generateAttributes(i.value());
+ i++;
+ }
+ out += " </div>\n";
}
- out += " </div>\n";
-
+
out += generateMethodOverview(doc, meths);
out += " <h2>Methods</h2>\n";
diff --git a/client/docgen/parse.cc b/client/docgen/parse.cc
index 64c2aa7..0354f57 100644
--- a/client/docgen/parse.cc
+++ b/client/docgen/parse.cc
@@ -89,6 +89,8 @@ Doc parse(QString filename)
{
Doc doc;
doc.container = false;
+ doc.serverside = false;
+ doc.clientside = false;
QFileInfo fi(filename);
QString name = fi.fileName();
@@ -134,10 +136,26 @@ Doc parse(QString filename)
continue;
}
+ if(state == none && line.left(6) == "@class") {
+ doc.classname = line.right(line.length() - line.indexOf(" ") - 1);
+ doc.name = doc.classname;
+ continue;
+ }
+
if(state == none && line.left(8) == "@extends") {
doc.extends = line.right(line.length() - line.indexOf(" ") - 1);
continue;
}
+
+ if(state == none && line.left(11) == "@serverside") {
+ doc.serverside = true;
+ continue;
+ }
+
+ if(state == none && line.left(11) == "@clientside") {
+ doc.clientside = true;
+ continue;
+ }
if(state == none && line.left(11) == "@screenshot") {
Screenshot s;
diff --git a/client/docgen/style.css b/client/docgen/style.css
index e938648..17f087e 100644
--- a/client/docgen/style.css
+++ b/client/docgen/style.css
@@ -26,6 +26,11 @@ a:hover {
}
.doc .tagname {
+ font-size: 1.5em;
+ text-align: center;
+}
+.doc .classname {
+ font-size: 1.5em;
text-align: center;
}
.doc .extends {}