cmDocumentationFormatterUsage.cxx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmDocumentationFormatterUsage.h"
  14. cmDocumentationFormatterUsage::cmDocumentationFormatterUsage()
  15. :cmDocumentationFormatterText()
  16. {
  17. }
  18. void cmDocumentationFormatterUsage::PrintSection(std::ostream& os,
  19. const cmDocumentationEntry* section,
  20. const char* name)
  21. {
  22. if(name)
  23. {
  24. os << name << "\n";
  25. }
  26. if(!section) { return; }
  27. for(const cmDocumentationEntry* op = section; op->brief; ++op)
  28. {
  29. if(op->name)
  30. {
  31. os << " " << op->name;
  32. this->TextIndent = " ";
  33. int align = static_cast<int>(strlen(this->TextIndent))-4;
  34. for(int i = static_cast<int>(strlen(op->name)); i < align; ++i)
  35. {
  36. os << " ";
  37. }
  38. if ( strlen(op->name) > strlen(this->TextIndent)-4 )
  39. {
  40. os << "\n";
  41. os.write(this->TextIndent, strlen(this->TextIndent)-2);
  42. }
  43. os << "= ";
  44. this->PrintColumn(os, op->brief);
  45. os << "\n";
  46. }
  47. else
  48. {
  49. os << "\n";
  50. this->TextIndent = "";
  51. this->PrintFormatted(os, op->brief);
  52. }
  53. }
  54. os << "\n";
  55. }