32 #define PR(x) cout << #x << " = " << (x) << endl;
34 typedef map<string, string, less<string> > keywordMap_type;
35 typedef keywordMap_type::value_type keyword_type;
37 template<
class A,
class B>
38 ostream& operator<<(ostream& out, const pair<A,B> &p)
40 out << p.first <<
" is defined in " << p.second;
44 int main(
int argc,
char* argv[])
47 cerr <<
"Usage: " << argv[0] <<
" file ..." << endl;
56 keywordMap_type keywordMap;
57 string htmlFile, keywordFile, baseName, line;
61 for (i=1; i<argc; i++) {
62 htmlFile = keywordFile = baseName = argv[i];
63 pos = htmlFile.find(
".html");
64 if (pos == string::npos) {
65 cerr << argv[0] <<
": error, file must have extension '.html': "
69 keywordFile.replace(pos, 5,
".keywords");
70 baseName.erase(pos, 5);
71 pos = baseName.rfind(
".");
72 if (pos != string::npos) baseName.erase(pos, line.size()-pos);
73 ifs.open(keywordFile.c_str());
75 keywordMap.insert(keyword_type(baseName, htmlFile));
80 getline(ifs, line,
'\n');
82 if (line.empty())
continue;
84 keywordMap.insert(keyword_type(line, htmlFile));
86 if (nkeys == 0) keywordMap.insert(keyword_type(baseName, htmlFile));
91 copy(keywordMap.begin(), keywordMap.end(), ostream_iterator<keyword_type>(cout,
"\n"));
96 const string indexName =
"index.html";
97 ofstream ofs(indexName.c_str());
99 cerr << argv[0] <<
": error, cannot create file " << indexName << endl;
102 cout <<
"writing index to " << indexName <<
" .";
103 ofs <<
"<html>" << endl;
104 ofs <<
"<!-- This code is generated automatically. Dont' modify it! -->" << endl;
105 ofs <<
"<head>" << endl;
106 ofs <<
"<title>StarClassLibrary: Class Browser</title>" << endl;
107 ofs <<
"</head>" << endl;
108 ofs <<
"<body bgcolor=#ffffff text=#000000>" << endl;
109 ofs <<
"<table border=0 width=110% cellpadding=0>" << endl;
110 ofs <<
"<tr bgcolor=darkblue>" << endl;
111 ofs <<
"<td align=left valign=top>" << endl;
112 ofs <<
"<ul>" << endl;
113 ofs <<
"<h4><br></h4>" << endl;
114 ofs <<
"<h1><font color=white>StarClassLibrary: </font><font color=red>"
115 <<
"Class Browser Index</font></h1>" << endl;
116 ofs <<
"</ul>" << endl;
117 ofs <<
"</td>" << endl;
118 ofs <<
"</tr>" << endl;
119 ofs <<
"</table>" << endl;
120 ofs <<
"<p>" << endl;
121 ofs <<
"<table border=0 width=100% cellpadding=15>" << endl;
122 ofs <<
"<tr>" << endl;
123 ofs <<
"<td bgcolor=#eeeeee align=left valign=top>" << endl;
124 ofs <<
"<ul>" << endl;
125 keywordMap_type::const_iterator iter;
126 for (iter = keywordMap.begin(); iter != keywordMap.end(); iter++) {
127 cout <<
'.'; cout.flush();
128 ofs <<
"<li><a href=" << iter->second <<
">"
129 << iter->first <<
"</a></li>" << endl;
131 ofs <<
"</ul>" << endl;
132 ofs <<
"</td>" << endl;
133 ofs <<
"<td align=left valign=top>" << endl;
134 ofs <<
"<p>This reference guide is an alphabetical
135 listing of all of the classes, algorithms, and function
136 objects provided by <i>this</i> release of the Star C++
137 Class Library. For each class, the reference begins with
138 a synopsis, which indicates the header file(s) and the
139 signature of a class object. It continues with
140 the C++ code that describes the <i>public</i> interface.
141 Please note, that the interface is displayed in its pure
142 ANSI form. In a few rare cases and depending on your platform
143 the actual code might differ slightly. </p>
144 <p>This guide only shows the interfaces, i.e., the prototypes
145 of the classes and function objects. For a more detailed description see the
146 <font color=green><i>Star C++ Class Library User Guide and
147 Reference Manual </i></font> which is available as a
148 PostScript document. It contains information concerning the
149 various platforms, installation procedures and a complete
150 description of all classes including many example programs.
151 Developers should also inspect the corrseponding header files.</p>
152 This index and all other HTML pages referenced were
153 generated automatically." << endl;
154 ofs <<
"</td>" << endl;
155 ofs <<
"</tr>" << endl;
156 ofs <<
"</table>" << endl;
157 time_t now = time(0);
158 ofs <<
"<hr noshade=noshade>" << endl;
159 ofs <<
"Index generated on " << ctime(&now);
160 ofs <<
"</body>" << endl;
161 ofs <<
"</html>" << endl;
164 cout <<
". done" << endl;