1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDocumentationFormatter.cxx,v $
6 Date: $Date: 2007-09-19 13:05:28 $
7 Version: $Revision: 1.1 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmDocumentationFormatter.h"
19 cmDocumentationFormatter::cmDocumentationFormatter()
23 cmDocumentationFormatter::~cmDocumentationFormatter()
27 void cmDocumentationFormatter::PrintFormatted(std::ostream
& os
,
34 const char* ptr
= text
;
37 // Any ptrs starting in a space are treated as preformatted text.
38 std::string preformatted
;
41 for(char ch
= *ptr
; ch
&& ch
!= '\n'; ++ptr
, ch
= *ptr
)
43 preformatted
.append(1, ch
);
48 preformatted
.append(1, '\n');
51 if(preformatted
.length())
53 this->PrintPreformatted(os
, preformatted
.c_str());
56 // Other ptrs are treated as paragraphs.
57 std::string paragraph
;
58 for(char ch
= *ptr
; ch
&& ch
!= '\n'; ++ptr
, ch
= *ptr
)
60 paragraph
.append(1, ch
);
65 paragraph
.append(1, '\n');
67 if(paragraph
.length())
69 this->PrintParagraph(os
, paragraph
.c_str());