Bump for 3.6-28
[LibreOffice.git] / autodoc / source / exes / adc_uni / adc_msg.cxx
blob06d6f8e76dde9646a324ce049b2243e6b008394c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <precomp.h>
30 #include <adc_msg.hxx>
33 // NOT FULLY DEFINED SERVICES
34 #include <cosv/file.hxx>
35 #include <cosv/tpl/tpltools.hxx>
38 namespace autodoc
42 Messages::Messages()
43 : aMissingDocs(),
44 aParseErrors(),
45 aInvalidConstSymbols(),
46 aUnresolvedLinks(),
47 aTypeVsMemberMisuses()
51 Messages::~Messages()
55 void
56 Messages::WriteFile(const String & i_sOutputFilePath)
58 csv::File
59 aOut(i_sOutputFilePath, csv::CFM_CREATE);
60 aOut.open();
62 // KORR_FUTURE Enable this when appropriate:
63 WriteParagraph( aOut,
64 aParseErrors,
65 "Incompletely Parsed Files" );
67 WriteParagraph( aOut,
68 aMissingDocs,
69 "Entities Without Documentation" );
71 WriteParagraph( aOut,
72 aInvalidConstSymbols,
73 "Incorrectly Written Const Symbols" );
75 WriteParagraph( aOut,
76 aUnresolvedLinks,
77 "Unresolved Links" );
79 WriteParagraph( aOut,
80 aTypeVsMemberMisuses,
81 "Confusion or Misuse of <Type> vs. <Member>" );
82 aOut.close();
85 void
86 Messages::Out_MissingDoc( const String & i_sEntity,
87 const String & i_sFile,
88 uintt i_nLine)
90 AddValue( aMissingDocs,
91 i_sEntity,
92 i_sFile,
93 i_nLine );
96 void
97 Messages::Out_ParseError( const String & i_sFile,
98 uintt i_nLine)
100 aParseErrors[Location(i_sFile,i_nLine)] = String::Null_();
103 void
104 Messages::Out_InvalidConstSymbol( const String & i_sText,
105 const String & i_sFile,
106 uintt i_nLine)
108 AddValue( aInvalidConstSymbols,
109 i_sText,
110 i_sFile,
111 i_nLine );
114 void
115 Messages::Out_UnresolvedLink( const String & i_sLinkText,
116 const String & i_sFile,
117 uintt i_nLine)
119 AddValue( aUnresolvedLinks,
120 i_sLinkText,
121 i_sFile,
122 i_nLine );
125 void
126 Messages::Out_TypeVsMemberMisuse( const String & i_sLinkText,
127 const String & i_sFile,
128 uintt i_nLine)
130 AddValue( aTypeVsMemberMisuses,
131 i_sLinkText,
132 i_sFile,
133 i_nLine );
136 Messages &
137 Messages::The_()
139 static Messages TheMessages_;
140 return TheMessages_;
143 void
144 Messages::AddValue( MessageMap & o_dest,
145 const String & i_sText,
146 const String & i_sFile,
147 uintt i_nLine )
149 String &
150 rDest = o_dest[Location(i_sFile,i_nLine)];
151 StreamLock
152 slDest(2000);
153 if (NOT rDest.empty())
154 slDest() << rDest;
155 slDest() << "\n " << i_sText;
156 rDest = slDest().c_str();
159 void
160 Messages::WriteParagraph( csv::File & o_out,
161 const MessageMap & i_source,
162 const String & i_title )
164 StreamStr aLine(2000);
166 // Write title of paragraph:
167 aLine << i_title
168 << "\n";
169 o_out.write(aLine.c_str());
171 aLine.seekp(0);
172 for (uintt i = i_title.size(); i > 0; --i)
174 aLine << '-';
176 aLine << "\n\n";
177 o_out.write(aLine.c_str());
179 // Write Content
180 MessageMap::const_iterator it = i_source.begin();
181 MessageMap::const_iterator itEnd = i_source.end();
182 for ( ; it != itEnd; ++it )
184 aLine.seekp(0);
185 aLine << (*it).first.sFile;
186 // Nobody wants to see this, if we don't know the line:
187 if ((*it).first.nLine != 0)
189 aLine << ", line "
190 << (*it).first.nLine;
192 if (NOT (*it).second.empty())
194 aLine << ':'
195 << (*it).second
196 << "\n";
198 o_out.write(aLine.c_str());
200 o_out.write("\n\n\n");
203 } // namespace autodoc
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */