anwenden:onesource:dokstrip
dokstrip : Entfernen von Dokumentationskommentaren
Programmers are taught to comment their code:
good code has a lot of comments.
Unfortunately, they are never taught *why* code needs comments:
bad code *requires* lots of comments.— Andrew Hunt, David Thomas: The Pragmatic Programmer, p.29
Dokumentationszeilen beginnen mit genau 3 Schrägstrichen.
Manchmal stören solche Kommentare. Dann müssen sie unterdrückt werden können.
Das Programm dokstrip
soll alle Dokumentationszeilen
aus dem Datenstrom entfernen:
more dokgen.txt | dokstrip | extract
z.B. bevor der Quelltext dokgen.txt
(siehe dokgen )
mit dem Werkzeug extract
in einzelne Module zerlegt wird.
Folgt unmittelbar auf eine Dokumentationszeile eine Leerzeile,
so ist diese ebenfalls zu übergehen.
//: dokstrip.cpp : Entfernen von Dok-Kommentaren - R.Richter 2002-11-25 /////////////////////////////////////////////////////////////////////// #include <iostream> #include <string> int main() { std::string line; while (std::getline(std::cin, line)) { if (line.find("///") == 0 && line.c_str()[3] != '/') // Dok-Zeile { if (std::cin.peek() == '\n') std::cin.get(); } else std::cout << line << '\n'; } return 0; }
anwenden/onesource/dokstrip.txt · Zuletzt geändert: 2014-07-13 16:14 von 127.0.0.1