This file is indexed.

/usr/include/xalanc/Harness/XalanXMLFileReporter.hpp is in libxalan110-dev 1.10-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
/*
 * Copyright 1999-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#if !defined(HARNESS_HEADER_GUARD_1357924680)
#define HARNESS_HEADER_GUARD_1357924680



#include "xalanc/Harness/XalanHarnessDefinitions.hpp"



#include <cstdio>



#include "xalanc/XalanDOM/XalanDOMString.hpp"



#include "xalanc/Include/XalanMemMgrHelper.hpp"
#include "xalanc/Include/XalanMap.hpp"



#include "xalanc/PlatformSupport/DOMStringHelper.hpp"



XALAN_CPP_NAMESPACE_BEGIN




class XALAN_HARNESS_EXPORT XalanXMLFileReporter
{
    
public:

    typedef XalanMap<XalanDOMString, XalanDOMString>  Hashtable;

#if defined(XALAN_STRICT_ANSI_HEADERS)
    typedef std::FILE   FileHandleType;
#else
    typedef FILE        FileHandleType;
#endif

public:


    // Construct and initialize this reporter with specified filename, if
    // the filename is not empty.
    XalanXMLFileReporter(MemoryManagerType& theManager, const XalanDOMString& fileName);

    // Initialize this XalanXMLFileReporter.  Must be called before attempting to log anything.
    bool initialize(MemoryManagerType& theManager);

    MemoryManagerType&
    getMemoryManager()
    {
        return m_fileName.getMemoryManager();
    }

    // Accessor for flushing; is set from properties.
    bool getFlushOnCaseClose();

    // Accessor methods for our properties block.
    const XalanDOMString& getFileName() const;

    // Accessor methods for our properties block.
    void setFileName(const XalanDOMString& fileName);

    // Accessor methods for our properties block.
    void setFileName(const char* fileName, MemoryManagerType& theManager)
    {
        setFileName(XalanDOMString(fileName, theManager));
    }

    //
    // Is this Reporter still running OK?  
    // @returns status - true if an error has occoured, false if it's still working fine
    bool checkError();

      
    //
    // Is this Reporter ready to log results?  
    // @returns status - true if it's ready to report, false otherwise
    bool isReady();

    // Flush this reporter - ensure our File is flushed.
    void flush();


    // Close this reporter - ensure our File, etc. are closed.
    void close();

    //-----------------------------------------------------
    //-------- Testfile / Testcase start and stop routines --------
    //-----------------------------------------------------

    /**
    * Report that a testfile has started.  
    * @param msg message to log out
    */
    void logTestFileInit(const XalanDOMString& msg);

    void logTestFileInit(const char*    msg)
    {
        logTestFileInit(XalanDOMString(msg,  getMemoryManager()));
    }

    /**
    * Report that a testfile has finished, and report it's result.  
    * @param msg message to log out
    * @param result result of testfile
    */
    void logTestFileClose(const XalanDOMString& msg, const XalanDOMString& result);

    void logTestFileClose(const char* msg, const char* result)
    {
        logTestFileClose(XalanDOMString(msg, getMemoryManager()), XalanDOMString(result, getMemoryManager()));  
    }

    void logTestCaseInit(const XalanDOMString& msg);

    void logTestCaseInit(const char*    msg)
    {
        logTestCaseInit(XalanDOMString(msg,  getMemoryManager()));
    }

    /**
    * Report that a testcase has finished, and report it's result.  
    * @param msg message to log out
    * @param result result of testfile
    */
    void logTestCaseClose(const XalanDOMString& msg, const XalanDOMString& result);

    void logTestCaseClose(const char* msg, const char* result)
    {
        logTestCaseClose(XalanDOMString(msg , getMemoryManager()), XalanDOMString(result , getMemoryManager()));
    }
    //-----------------------------------------------------
    //-------- Test results reporting and logging routines --------
    //-----------------------------------------------------


    /**
    * Report a comment to result file with specified severity.  
    * <P>Record format: &lt;message level="##"&gt;msg&lt;/message&gt;</P>
    * @param level severity or class of message.
    * @param msg comment to log out.
    */
    void logMessage(int level, const XalanDOMString& msg);

    /**
    * Logs out statistics to result file with specified severity.  
    * <P>Record format: &lt;statistic level="##" desc="msg"&gt;&lt;longval&gt;1234&lt;/longval&gt;&lt;doubleval&gt;1.234&lt;/doubleval&gt;&lt;/statistic&gt;</P>
    * @param level severity of message.
    * @param lVal statistic in long format.
    * @param dVal statistic in double format.
    * @param msg comment to log out.
    */
    void logStatistic (int level, long lVal, double dVal, const XalanDOMString& msg);

    void logStatistic (int level, long lVal, double dVal, const char*   msg)
    {
        logStatistic(level, lVal, dVal, XalanDOMString(msg, getMemoryManager()));
    }

    // This routine will add an attribute to the attribute list.
    void addMetricToAttrs(char* desc, double theMetric, Hashtable& attrs);

    /**
    * Logs out a element to results with specified severity.
    * Uses user-supplied element name and attribute list.  Currently
    * attribute values and msg are forced .toString().  Also,
    * 'level' is forced to be the first attribute of the element.
    * @param level severity of message.
    * @param element name of enclosing element
    * @param attrs hash of name=value attributes; note that the
    * caller must ensure they're legal XML
    * @param msg comment to log out.
    */
    void logElementWAttrs(int level, const XalanDOMString& element, Hashtable& attrs, const XalanDOMString& msg);

    void logElementWAttrs(int level,  const char* element, Hashtable& attrs, const char* msg)
    {
        logElementWAttrs(level, XalanDOMString(element, getMemoryManager()), attrs, XalanDOMString(msg, getMemoryManager()));
    }

    void logElement(int level, const XalanDOMString& element, const XalanDOMString& msg);

    void logElement(const XalanDOMString& element, const XalanDOMString& msg);
    /**
    * Report an arbitrary XalanDOMString to result file with specified severity.  
    * <P>Appends and prepends \\n newline characters at the start and 
    * end of the message to separate it from the tags.</P>
    * <P>Record format: &lt;arbitrary level="##"&gt;<BR/>
    * msg<BR/>
    * &lt;/arbitrary&gt;
    * </P>
    * @param level severity or class of message.
    * @param msg arbitrary XalanDOMString to log out.
    */
    void logArbitraryMessage (int level, const XalanDOMString& msg);

    /**
    * Report a complete Hashtable to result file with specified severity.  
    * <P>Indents each hashitem within the table.</P>
    * <P>Record format: &lt;hashtable level="##" desc="msg"/&gt;<BR/>
    * &nbsp;&nbsp;&lt;hashitem key="key1"&gt;value1&lt;/hashitem&gt;<BR/>
    * &nbsp;&nbsp;&lt;hashitem key="key2"&gt;value2&lt;/hashitem&gt;<BR/>
    * &lt;/hashtable&gt;
    * </P>
    * @param level severity or class of message.
    * @param hash Hashtable to log the contents of. 
    * @param msg decription of the Hashtable.
    */
    /*
    void logHashtable (int level, Hashtable hash, const XalanDOMString& msg);
    */

    /**
    * Writes out a Pass record with comment.  
    * <P>Record format: &lt;checkresult result="PASS" desc="comment"/&gt;</P>
    * @param comment comment to log with the pass record.
    */
    void logCheckPass(const XalanDOMString& comment);

    /**
    * Writes out an ambiguous record with comment.  
    * <P>Record format: &lt;checkresult result="AMBG" desc="comment"/&gt;</P>
    * @param comment comment to log with the ambg record.
    */
    void logCheckAmbiguous(const XalanDOMString& comment);

    /**
    * Writes out a Fail record with comment.  
    * <P>Record format: &lt;checkresult result="FAIL" desc="comment"/&gt;</P>
    * @param comment comment to log with the fail record.
    */
    void logCheckFail(const XalanDOMString& comment);

    void logCheckFail(const XalanDOMString& test, const Hashtable& faildata, const Hashtable& actexp);

    void logCheckFail(const XalanDOMString& test, const Hashtable& actexp);

    void logErrorResult(const XalanDOMString& test, const XalanDOMString& reason);

    /**
    * Writes out a Error record with comment.  
    * <P>Record format: &lt;checkresult result="ERRR" desc="comment"/&gt;</P>
    * @param comment comment to log with the error record.
    */
    void logCheckErr(const XalanDOMString& comment);

    /**
    * Escapes a XalanDOMString to remove <, >, ', &, and " so it's valid XML.  
    * <P>Stolen mostly from Xalan applet sample.</P>
    * @param s XalanDOMString to escape.
    * @return XalanDOMString that has been escaped.
    */
    XalanDOMString& escapestring(const XalanDOMString& s, XalanDOMString&      buffer);


private:
    // not implemented
    XalanXMLFileReporter(const XalanXMLFileReporter&);
    /**
    * worker method to dump the xml header and open the resultsfile element.  
    */
    bool startResultsFile();

    /**
    * worker method to close the resultsfile element.  
    */
    bool closeResultsFile();

    /**
    * worker method to prints to the resultsfile.  
    */
    bool printToFile(const XalanDOMString& output);

    void
    initStrings();

    /**
    * worker method to prints to the resultsfile.  
    */
    XalanDOMString&
    getDateTimeString(XalanDOMString& result);
    
    /** Key for Properties block that denotes our output filename.  */
    XalanDOMString  OPT_FILENAME;

    /** XML tagnames for results file structure.  */
    XalanDOMString  ELEM_RESULTSFILE;
    XalanDOMString  ELEM_TESTFILE;
    XalanDOMString  ELEM_FILERESULT;
    XalanDOMString  ELEM_TESTCASE;
    XalanDOMString  ELEM_CASERESULT;
    XalanDOMString  ELEM_CHECKRESULT;
    XalanDOMString  ELEM_STATISTIC;
    XalanDOMString  ELEM_LONGVAL;
    XalanDOMString  ELEM_DOUBLEVAL;
    XalanDOMString  ELEM_MESSAGE;
    XalanDOMString  ELEM_ARBITRARY;
    XalanDOMString  ELEM_HASHTABLE;
    XalanDOMString  ELEM_HASHITEM;

    /** XML attribute names for results file structure.  */
    XalanDOMString  ATTR_LEVEL;
    XalanDOMString  ATTR_DESC;
    XalanDOMString  ATTR_TIME;
    XalanDOMString  ATTR_RESULT;
    XalanDOMString  ATTR_KEY;
    XalanDOMString  ATTR_FILENAME;
    XalanDOMString  LESS_THAN;
    XalanDOMString  GREATER_THAN;
    XalanDOMString  EQUALS_QUOTE;
    XalanDOMString  SPACE;
    XalanDOMString  QUOTE;
    XalanDOMString  QUOTE_SPACE;
    XalanDOMString  QUOTE_GREATER_THAN;
    XalanDOMString  QUOTE_SOLIDUS_GREATER_THAN;
    XalanDOMString  PASS;
    XalanDOMString  AMBG;
    XalanDOMString  ERRR;
    XalanDOMString  FAIL;
    XalanDOMString  LESS_THAN_SOLIDUS;
    XalanDOMString  XML_HEADER;
    XalanDOMString  REASON_EQUALS_QUOTE;

    /** 
    * Optimization: for heavy use methods, form pre-defined constants to save on XalanDOMString concatenation.  
    * <P>Note the indent; must be updated if we ever switch to another indenting method.</P>
    */
    XalanDOMString  TESTCASEINIT_HDR;
    XalanDOMString  TESTCASECLOSE_HDR;
    XalanDOMString  MESSAGE_HDR;
    XalanDOMString  STATISTIC_HDR;
    XalanDOMString  ARBITRARY_HDR;
    XalanDOMString  HASHTABLE_HDR;
    XalanDOMString  HASHITEM_HDR;
    XalanDOMString  CHECKPASS_HDR;
    XalanDOMString  CHECKAMBG_HDR;
    XalanDOMString  CHECKERRR_HDR;
    XalanDOMString  CHECKFAIL_HDR;
    XalanDOMString  CHECKFAIL_FTR;

    /** If we have output anything yet.  */
    bool m_anyOutput;

    /** Name of the file we're outputing to.  */
    XalanDOMString m_fileName;

    /** File reference and other internal convenience variables.  */
    FileHandleType* m_fileHandle;

    /** If we're ready to start outputting yet.  */
    bool m_ready;

    /** If an error has occoured in this Reporter.  */
    bool m_error;

    /** If we should flush after every logTestCaseClose.  */
    bool m_flushOnCaseClose;

};        // end of class XalanXMLFileReporter



XALAN_CPP_NAMESPACE_END



#endif