xref: /trunk/main/autodoc/source/inc/adc_msg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef ADC_ADC_MSG_HXX
29 #define ADC_ADC_MSG_HXX
30 
31 
32 
33 // USED SERVICES
34 	// BASE CLASSES
35 	// COMPONENTS
36 	// PARAMETERS
37 namespace csv
38 {
39     class File;
40 }
41 
42 
43 namespace autodoc
44 {
45 
46 
47 /** Gathers, sorts and displays (mainly diagnostic) messages to the
48     user of Autodoc.
49 */
50 class Messages
51 {
52   public:
53     // LIFECYCLE
54 						Messages();
55 						~Messages();
56     // OPERATIONS
57     void                WriteFile(
58                             const String &      i_sOutputFilePath);
59     // INQUIRY
60 
61     // ACCESS
62     void                Out_MissingDoc(
63                             const String &      i_sEntity,
64                             const String &      i_sFile,
65                             uintt               i_nLine);
66     void                Out_ParseError(
67                             const String &      i_sFile,
68                             uintt               i_nLine);
69     void                Out_InvalidConstSymbol(
70                             const String &      i_sText,
71                             const String &      i_sFile,
72                             uintt               i_nLine);
73     void                Out_UnresolvedLink(
74                             const String &      i_sLinkText,
75                             const String &      i_sFile,
76                             uintt               i_nLine);
77     void                Out_TypeVsMemberMisuse(
78                             const String &      i_sLinkText,
79                             const String &      i_sFile,
80                             uintt               i_nLine);
81 
82     static Messages &   The_();
83 
84   private:
85     struct Location
86     {
87         String              sFile;
88         uintt               nLine;
89 
90                             Location(
91                                 const String &      i_file,
92                                 uintt               i_line)
93                                 :   sFile(i_file),
94                                     nLine(i_line)   {}
95         bool                operator<(
96                                 const Location &    i_other) const
97                                 { int cmp = csv::compare(sFile,i_other.sFile);
98                                   return cmp < 0
99                                             ?   true
100                                             :   cmp > 0
101                                                     ?   false
102                                                     :   nLine < i_other.nLine;
103                                 }
104     };
105 
106     typedef std::map<Location,String>   MessageMap;
107 
108     // Locals
109     void                AddValue(
110                             MessageMap &        o_dest,
111                             const String &      i_sText,
112                             const String &      i_sFile,
113 							uintt               i_nLine );
114     void                WriteParagraph(
115                             csv::File &         o_out,
116                             const MessageMap &  i_source,
117                             const String &      i_title,
118                             const String &      i_firstIntermediateText );
119 
120 	// DATA
121 	MessageMap          aMissingDocs;
122 	MessageMap          aParseErrors;
123 	MessageMap          aInvalidConstSymbols;
124 	MessageMap          aUnresolvedLinks;
125 	MessageMap          aTypeVsMemberMisuses;
126 };
127 
128 
129 
130 // IMPLEMENTATION
131 
132 
133 }   // namespace autodoc
134 
135 inline autodoc::Messages &
136 TheMessages()
137 {
138     return autodoc::Messages::The_();
139 }
140 
141 #endif
142