From 12cce7eac519786066003173ab072505f2ad8bb0 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 13 Apr 2012 13:48:32 +0200 Subject: Documentation. --- client/docgen/docgen.cc | 87 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 11 deletions(-) (limited to 'client/docgen/docgen.cc') 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 #include #include +#include #include @@ -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 &docs) out += "

Pracro "VERSION" Documentation

\n"; out += "

Overview

\n"; + out += "

Clientside

\n"; + out += "

Widgets

\n"; out += "
    \n"; QMap::iterator i = docs.begin(); while(i != docs.end()) { Doc &doc = *i; - out += "
  • ["+doc.name+"] - "+ - doc.title+"
  • \n"; + if(doc.tag != "") { + out += "
  • ["+doc.name+"] - "+ + doc.title+"
  • \n"; + } + i++; + } + out += "
\n"; + out += "

Classes

\n"; + out += "
    \n"; + i = docs.begin(); + while(i != docs.end()) { + Doc &doc = *i; + if(doc.classname != "" && doc.clientside) { + out += "
  • ["+doc.name+"] - "+ + doc.title+"
  • \n"; + } i++; } out += "
\n"; + out += "

Serverside

\n"; + out += "
    \n"; + i = docs.begin(); + while(i != docs.end()) { + Doc &doc = *i; + if(doc.classname != "" && doc.serverside) { + out += "
  • ["+doc.name+"] - "+ + doc.title+"
  • \n"; + } + i++; + } + out += "
\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; } -- cgit v1.2.3