bump product version to 4.1.6.2
[LibreOffice.git] / autodoc / source / exes / adc_uni / adc_msg.cxx
blobbf34e406f0812844f06fad50661ce7d679734f02
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <precomp.h>
21 #include <adc_msg.hxx>
24 // NOT FULLY DEFINED SERVICES
25 #include <cosv/file.hxx>
26 #include <cosv/tpl/tpltools.hxx>
29 namespace autodoc
33 Messages::Messages()
34 : aMissingDocs(),
35 aParseErrors(),
36 aInvalidConstSymbols(),
37 aUnresolvedLinks(),
38 aTypeVsMemberMisuses()
42 Messages::~Messages()
46 void
47 Messages::WriteFile(const String & i_sOutputFilePath)
49 csv::File
50 aOut(i_sOutputFilePath, csv::CFM_CREATE);
51 aOut.open();
53 // KORR_FUTURE Enable this when appropriate:
54 WriteParagraph( aOut,
55 aParseErrors,
56 "Incompletely Parsed Files" );
58 WriteParagraph( aOut,
59 aMissingDocs,
60 "Entities Without Documentation" );
62 WriteParagraph( aOut,
63 aInvalidConstSymbols,
64 "Incorrectly Written Const Symbols" );
66 WriteParagraph( aOut,
67 aUnresolvedLinks,
68 "Unresolved Links" );
70 WriteParagraph( aOut,
71 aTypeVsMemberMisuses,
72 "Confusion or Misuse of <Type> vs. <Member>" );
73 aOut.close();
76 void
77 Messages::Out_MissingDoc( const String & i_sEntity,
78 const String & i_sFile,
79 uintt i_nLine)
81 AddValue( aMissingDocs,
82 i_sEntity,
83 i_sFile,
84 i_nLine );
87 void
88 Messages::Out_ParseError( const String & i_sFile,
89 uintt i_nLine)
91 aParseErrors[Location(i_sFile,i_nLine)] = String::Null_();
94 void
95 Messages::Out_InvalidConstSymbol( const String & i_sText,
96 const String & i_sFile,
97 uintt i_nLine)
99 AddValue( aInvalidConstSymbols,
100 i_sText,
101 i_sFile,
102 i_nLine );
105 void
106 Messages::Out_UnresolvedLink( const String & i_sLinkText,
107 const String & i_sFile,
108 uintt i_nLine)
110 AddValue( aUnresolvedLinks,
111 i_sLinkText,
112 i_sFile,
113 i_nLine );
116 void
117 Messages::Out_TypeVsMemberMisuse( const String & i_sLinkText,
118 const String & i_sFile,
119 uintt i_nLine)
121 AddValue( aTypeVsMemberMisuses,
122 i_sLinkText,
123 i_sFile,
124 i_nLine );
127 Messages &
128 Messages::The_()
130 static Messages TheMessages_;
131 return TheMessages_;
134 void
135 Messages::AddValue( MessageMap & o_dest,
136 const String & i_sText,
137 const String & i_sFile,
138 uintt i_nLine )
140 String &
141 rDest = o_dest[Location(i_sFile,i_nLine)];
142 StreamLock
143 slDest(2000);
144 if (NOT rDest.empty())
145 slDest() << rDest;
146 slDest() << "\n " << i_sText;
147 rDest = slDest().c_str();
150 void
151 Messages::WriteParagraph( csv::File & o_out,
152 const MessageMap & i_source,
153 const String & i_title )
155 StreamStr aLine(2000);
157 // Write title of paragraph:
158 aLine << i_title
159 << "\n";
160 o_out.write(aLine.c_str());
162 aLine.seekp(0);
163 for (uintt i = i_title.size(); i > 0; --i)
165 aLine << '-';
167 aLine << "\n\n";
168 o_out.write(aLine.c_str());
170 // Write Content
171 MessageMap::const_iterator it = i_source.begin();
172 MessageMap::const_iterator itEnd = i_source.end();
173 for ( ; it != itEnd; ++it )
175 aLine.seekp(0);
176 aLine << (*it).first.sFile;
177 // Nobody wants to see this, if we don't know the line:
178 if ((*it).first.nLine != 0)
180 aLine << ", line "
181 << (*it).first.nLine;
183 if (NOT (*it).second.empty())
185 aLine << ':'
186 << (*it).second
187 << "\n";
189 o_out.write(aLine.c_str());
191 o_out.write("\n\n\n");
194 } // namespace autodoc
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */