/tags/rel-0-5-0/FreeSpeech/data-flow/src/gendoc.cc

# · C++ · 133 lines · 116 code · 16 blank · 1 comment · 17 complexity · 4ac0a99208b105b84993b2b82ad413dd MD5 · raw file

  1. // Copyright (C) 2001 Jean-Marc Valin
  2. #include "UIDocument.h"
  3. #include <string>
  4. #include "ParameterSet.h"
  5. #include "ObjectRef.h"
  6. void node2html(string nodeName, SubnetInfo *info, ostream &out)
  7. {
  8. int nb;
  9. out << "<p><a NAME=\"" << nodeName << "\"></a>\n"
  10. << "<h3>\n"
  11. << nodeName << " (" << info->category << ")</h3>\n"
  12. << info->description
  13. << "<br>&nbsp;\n"
  14. << "<table BORDER WIDTH=\"100%\" NOSAVE >\n"
  15. << "<tr>\n"
  16. << "<td></td>\n"
  17. << "<td>NAME</td>\n"
  18. << "<td>TYPE</td>\n"
  19. << "<td>MEANING</td>\n"
  20. << "</tr>\n";
  21. for (int field = 0;field<3;field++)
  22. {
  23. string fieldName;
  24. vector<ItemInfo *> *fieldInfoPtr;
  25. switch (field) {
  26. case 0:
  27. fieldName="Inputs";
  28. fieldInfoPtr = &info->inputs;
  29. break;
  30. case 1:
  31. fieldName="Outputs";
  32. fieldInfoPtr = &info->outputs;
  33. break;
  34. case 2:
  35. fieldName="Parameters";
  36. fieldInfoPtr = &info->params;
  37. break;
  38. }
  39. vector<ItemInfo *> &fieldInfo= *fieldInfoPtr;
  40. out << "<tr NOSAVE>\n"
  41. << "<td>" << fieldName << "</td>\n";
  42. nb = fieldInfo.size();
  43. if (nb > 0)
  44. {
  45. out << "<td>";
  46. for (int i=0;i<nb;i++)
  47. {
  48. if (i>0)
  49. out << "<br>";
  50. out << fieldInfo[i]->name;
  51. }
  52. out << "</td>";
  53. out << "<td>";
  54. for (int i=0;i<nb;i++)
  55. {
  56. if (i>0)
  57. out << "<br>";
  58. out << fieldInfo[i]->type;
  59. }
  60. out << "</td>";
  61. out << "<td>";
  62. for (int i=0;i<nb;i++)
  63. {
  64. if (i>0)
  65. out << "<br>";
  66. out << fieldInfo[i]->description;
  67. }
  68. out << "</td>";
  69. } else {
  70. out << "<td>none</td>";
  71. }
  72. out << "</tr>\n";
  73. }
  74. out << "</table>\n";
  75. }
  76. int main(int argc, char **argv)
  77. {
  78. UIDocument::loadAllInfo();
  79. ostream &out = cout;
  80. out << "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n"
  81. << "<html>\n"
  82. << "<head>\n"
  83. << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"
  84. << "<meta name=\"GENERATOR\" content=\"Overflow\">\n"
  85. << "<meta name=\"Author\" content=\"Jean-Marc Valin\">\n"
  86. << "<title>Overflow node documentation</title>\n"
  87. << "<!-- This page was created by the Overflow documentation generator -->\n"
  88. << "</head>\n"
  89. << "<body>\n";
  90. map<string, SubnetInfo *>::iterator i;
  91. out << "<h1>List of available Overflow Nodes</h1>\n\n";
  92. out << "<center><table BORDER COLS=3 WIDTH=\"100%\" NOSAVE >\n\n";
  93. int count=0;
  94. i = UIDocument::externalDocInfo.begin();
  95. while (i != UIDocument::externalDocInfo.end())
  96. {
  97. if (count %3==0)
  98. out << "<tr>\n";
  99. out << "<td><a href=\"#" << i->first << "\">" << i->first << "</a></td>\n";
  100. if (count %3==2)
  101. out << "</tr>\n";
  102. count++;
  103. i++;
  104. }
  105. if (count %3!=0)
  106. out << "</tr>\n";
  107. out << "</table></center>\n";
  108. out << "\n<h1>Nodes Documentation</h1>\n\n";
  109. i = UIDocument::externalDocInfo.begin();
  110. while (i != UIDocument::externalDocInfo.end())
  111. {
  112. node2html(i->first, i->second, out);
  113. i++;
  114. }
  115. out << "\n</body>\n"
  116. << "</html>\n";
  117. }