xref: /aoo42x/main/autodoc/source/inc/adc_msg.hxx (revision 1c78a5d6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_ADC_MSG_HXX
25 #define ADC_ADC_MSG_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 	// COMPONENTS
32 	// PARAMETERS
33 namespace csv
34 {
35     class File;
36 }
37 
38 
39 namespace autodoc
40 {
41 
42 
43 /** Gathers, sorts and displays (mainly diagnostic) messages to the
44     user of Autodoc.
45 */
46 class Messages
47 {
48   public:
49     // LIFECYCLE
50 						Messages();
51 						~Messages();
52     // OPERATIONS
53     void                WriteFile(
54                             const String &      i_sOutputFilePath);
55     // INQUIRY
56 
57     // ACCESS
58     void                Out_MissingDoc(
59                             const String &      i_sEntity,
60                             const String &      i_sFile,
61                             uintt               i_nLine);
62     void                Out_ParseError(
63                             const String &      i_sFile,
64                             uintt               i_nLine);
65     void                Out_InvalidConstSymbol(
66                             const String &      i_sText,
67                             const String &      i_sFile,
68                             uintt               i_nLine);
69     void                Out_UnresolvedLink(
70                             const String &      i_sLinkText,
71                             const String &      i_sFile,
72                             uintt               i_nLine);
73     void                Out_TypeVsMemberMisuse(
74                             const String &      i_sLinkText,
75                             const String &      i_sFile,
76                             uintt               i_nLine);
77 
78     static Messages &   The_();
79 
80   private:
81     struct Location
82     {
83         String              sFile;
84         uintt               nLine;
85 
Locationautodoc::Messages::Location86                             Location(
87                                 const String &      i_file,
88                                 uintt               i_line)
89                                 :   sFile(i_file),
90                                     nLine(i_line)   {}
operator <autodoc::Messages::Location91         bool                operator<(
92                                 const Location &    i_other) const
93                                 { int cmp = csv::compare(sFile,i_other.sFile);
94                                   return cmp < 0
95                                             ?   true
96                                             :   cmp > 0
97                                                     ?   false
98                                                     :   nLine < i_other.nLine;
99                                 }
100     };
101 
102     typedef std::map<Location,String>   MessageMap;
103 
104     // Locals
105     void                AddValue(
106                             MessageMap &        o_dest,
107                             const String &      i_sText,
108                             const String &      i_sFile,
109 							uintt               i_nLine );
110     void                WriteParagraph(
111                             csv::File &         o_out,
112                             const MessageMap &  i_source,
113                             const String &      i_title,
114                             const String &      i_firstIntermediateText );
115 
116 	// DATA
117 	MessageMap          aMissingDocs;
118 	MessageMap          aParseErrors;
119 	MessageMap          aInvalidConstSymbols;
120 	MessageMap          aUnresolvedLinks;
121 	MessageMap          aTypeVsMemberMisuses;
122 };
123 
124 
125 
126 // IMPLEMENTATION
127 
128 
129 }   // namespace autodoc
130 
131 inline autodoc::Messages &
TheMessages()132 TheMessages()
133 {
134     return autodoc::Messages::The_();
135 }
136 
137 #endif
138