cmDocumentationSection.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #ifndef _cmDocumentationSection_h
  14. #define _cmDocumentationSection_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmDocumentationFormatter.h"
  17. // Low-level interface for custom documents:
  18. /** Internal class representing a section of the documentation.
  19. * Cares e.g. for the different section titles in the different
  20. * output formats.
  21. */
  22. class cmDocumentationSection
  23. {
  24. public:
  25. /** Create a cmSection, with a special name for man-output mode. */
  26. cmDocumentationSection(const char* name, const char* manName)
  27. :Name(name), ManName(manName) {}
  28. /** Has any content been added to this section or is it empty ? */
  29. bool IsEmpty() const { return this->Entries.empty(); }
  30. /** Clear contents. */
  31. void Clear() { this->Entries.clear(); }
  32. /** Return the name of this section for the given output form. */
  33. const char* GetName(cmDocumentationEnums::Form form) const
  34. { return (form==cmDocumentationEnums::ManForm ?
  35. this->ManName.c_str() : this->Name.c_str()); }
  36. /** Return a pointer to the first entry of this section. */
  37. const std::vector<cmDocumentationEntry> &GetEntries() const
  38. { return this->Entries; }
  39. /** Append an entry to this section. */
  40. void Append(const cmDocumentationEntry& entry)
  41. { this->Entries.push_back(entry); }
  42. void Append(const std::vector<cmDocumentationEntry> &entries)
  43. { this->Entries.insert(this->Entries.end(),entries.begin(),entries.end()); }
  44. /** Append an entry to this section using NULL terminated chars */
  45. void Append(const char *[][3]);
  46. void Append(const char *n, const char *b, const char *f);
  47. /** Set the contents of this section. */
  48. // void Set(const std::vector<cmDocumentationEntry> header,
  49. // const std::vector<cmDocumentationEntry> section,
  50. // const std::vector<cmDocumentationEntry> footer);
  51. private:
  52. std::string Name;
  53. std::string ManName;
  54. std::vector<cmDocumentationEntry> Entries;
  55. };
  56. #endif