This file is indexed.

/usr/include/log4cxx/stream.h is in liblog4cxx-dev 0.10.0-10ubuntu1.

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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

#ifndef _LOG4CXX_STREAM_H
#define _LOG4CXX_STREAM_H

#include <log4cxx/logger.h>
#include <sstream>
#include <log4cxx/spi/location/locationinfo.h>

namespace log4cxx
{

       /**
         *   Base class for the basic_logstream template which attempts
         *   to emulate std::basic_ostream but attempts to short-circuit
         *   unnecessary operations.
         *
         *   The logstream has a logger and level that are used for logging
         *   requests.  The level of the stream is compared against the 
         *   current level of the logger to determine if the request should be processed.
         */
        class LOG4CXX_EXPORT logstream_base {
        public:
             /**
              *  Create new instance.
              *  @param logger logger logger used in log requests.
              *  @param level indicates level that will be used in log requests.  Can
              *      be modified later by inserting a level or calling setLevel.
              */
             logstream_base(const log4cxx::LoggerPtr& logger,
                 const log4cxx::LevelPtr& level);
             /**
              *  Destructor.
              */
             virtual ~logstream_base();
             /**
              *  Insertion operator for std::fixed and similar manipulators.
              */
             void insert(std::ios_base& (*manip)(std::ios_base&));

             /**
              *   get precision.
              */
             int precision();
             /**
              *   get width.
              */
             int width();
             /**
              *   set precision.  This should be used in preference to inserting an std::setprecision(n)
              *   since the other requires construction of an STL stream which may be expensive.
              */
             int precision(int newval);
             /**
              *   set width.  This should be used in preference to inserting an std::setw(n)
              *   since the other requires construction of an STL stream which may be expensive.
              */
             int width(int newval);
             /**
              *   Get fill character.
              */
             int fill();
             /**
              *  Set fill character.
              */
             int fill(int newval);
             
             /**
              *   Set flags. see std::ios_base.
              */
             std::ios_base::fmtflags flags(std::ios_base::fmtflags newflags);
             /**
              *   Set flags. see std::ios_base.
              */
             std::ios_base::fmtflags setf(std::ios_base::fmtflags newflags, std::ios_base::fmtflags mask);
             /**
              *   Set flags. see std::ios_base.
              */
             std::ios_base::fmtflags setf(std::ios_base::fmtflags newflags);
             
             
             /**
              *  end of message manipulator, triggers logging.
              */
             static logstream_base& endmsg(logstream_base&);

             /**
              *  no-operation manipulator,  Used to avoid ambiguity with VC6.
              */
             static logstream_base& nop(logstream_base&);
             
             /**
              *   end of message action.
              */
             void end_message();


            
             /**
              * Set the level.
              * @param level level
              */
              void setLevel(const LevelPtr& level);
              /**
               *  Returns true if the current level is the same or high as the 
               *  level of logger at time of construction or last setLevel.
               */
              inline bool isEnabled() const {
                 return enabled;
              }

              /**
               *  Returns if logger is currently enabled for the specified level.
               */
              bool isEnabledFor(const LevelPtr& level) const;

              /**
               *  Sets the location for subsequent log requests.
               */
              void setLocation(const log4cxx::spi::LocationInfo& location);

              /**
               *  Sets the state of the embedded stream (if any)
               *     to the state of the formatting info.
               *   @param os stream to receive formatting info.
               *   @param fillchar receives fill charater.
               *   @return true if fill character was specified.     
               */
              bool set_stream_state(std::ios_base& os, int& fillchar);

        protected:
              /**
               *   Dispatches the pending log request.
               */
              virtual void log(LoggerPtr& logger,
                               const LevelPtr& level,
                               const log4cxx::spi::LocationInfo& location) = 0;
              /**
               *   Erase any content in the message construction buffer.
               */
              virtual void erase() = 0;
              /**
               *   Copy state of embedded stream (if any)
               *      to value and mask instances of std::ios_base
               *      and return fill character value.
               */
              virtual void get_stream_state(std::ios_base& base,
                                            std::ios_base& mask,
                                            int& fill,
                                            bool& fillSet) const = 0;
              virtual void refresh_stream_state() = 0;
             
        private:
            /**
             *   prevent copy constructor.
             */
            logstream_base(logstream_base&);
            /**
             *   prevent copy operatpr.
             */
            logstream_base& operator=(logstream_base&);
            /**
             *   Minimal extension of std::ios_base to allow creation
             *     of embedded IO states.
             */
            class LOG4CXX_EXPORT logstream_ios_base : public std::ios_base {
            public:
                logstream_ios_base(std::ios_base::fmtflags initval, 
                    int initsize);
            } initset, initclear;
            /**
             *   fill character.
             */
            int fillchar;
            /**
             *   true if fill character is set.
             */
            bool fillset;
            /**
             *   true if assigned level was same or higher than level of associated logger.
             */
            bool enabled;
            /**
             *   associated logger.
             */
            log4cxx::LoggerPtr logger;
            /**
             *   associated level.
             */
            log4cxx::LevelPtr level;
            /**
             *   associated level.
             */
            log4cxx::spi::LocationInfo location;
        };
        
      typedef logstream_base& (*logstream_manipulator)(logstream_base&);
       
        /**
         *  An STL-like stream API for log4cxx using char as the character type.
       *. Instances of log4cxx::logstream
         *  are not  designedfor use by multiple threads and in general should be short-lived
         *  function scoped objects.  Using log4cxx::basic_logstream as a class member or 
         *  static instance should be avoided in the same manner as you would avoid placing a std::ostringstream
         *  in those locations.  Insertion operations are generally short-circuited if the 
         *  level for the stream is not the same of higher that the level of the associated logger.
         */
        class LOG4CXX_EXPORT logstream : public logstream_base {
          typedef char Ch;
        public:
            /**
             *   Constructor.
             */
             logstream(const log4cxx::LoggerPtr& logger,
                 const log4cxx::LevelPtr& level);
             
            /**
             *   Constructor.
             */
             logstream(const Ch* loggerName, 
                const log4cxx::LevelPtr& level);

            /**
             *   Constructor.
             */
             logstream(const std::basic_string<Ch>& loggerName, 
                const log4cxx::LevelPtr& level);
             
             ~logstream();
             
             /**
              *   Insertion operator for std::fixed and similar manipulators.
              */
             logstream& operator<<(std::ios_base& (*manip)(std::ios_base&));
            
             /**
              *   Insertion operator for logstream_base::endmsg.
              */
              logstream& operator<<(logstream_manipulator manip);
            
              /**
               *   Insertion operator for level.
               */
              logstream& operator<<(const log4cxx::LevelPtr& level);
            /**
             *   Insertion operator for location.
             */
             logstream& operator<<(const log4cxx::spi::LocationInfo& location);
            
            /**
             *   Alias for insertion operator for location.  Kludge to avoid
          *      inappropriate compiler ambiguity.
             */
             logstream& operator>>(const log4cxx::spi::LocationInfo& location);

            /**
             *   Cast operator to provide access to embedded std::basic_ostream.
             */
             operator std::basic_ostream<Ch>&();

#if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE)             
            /**
              *  Template to allow any class with an std::basic_ostream inserter
              *    to be applied to this class.
             */
             template <class V>
             inline log4cxx::logstream& operator<<(const V& val) {
                 if (LOG4CXX_UNLIKELY(isEnabled())) {
                      ((std::basic_ostream<char>&) *this) << val;
                 }
                 return *this;
              }
#endif              
             
            
        protected:
              virtual void log(LoggerPtr& logger,
                               const LevelPtr& level,
                               const log4cxx::spi::LocationInfo& location);
              
              virtual void erase();
              
              virtual void get_stream_state(std::ios_base& base,
                                            std::ios_base& mask,
                                            int& fill,
                                            bool& fillSet) const;
              virtual void refresh_stream_state();
              
            
        private:
            logstream(const logstream&);
            logstream& operator=(const logstream&);        
            std::basic_stringstream<Ch>* stream;
             
        };
        
#if LOG4CXX_WCHAR_T_API        
        /**
         *  An STL-like stream API for log4cxx using wchar_t as the character type.
       *. Instances of log4cxx::logstream
         *  are not  designedfor use by multiple threads and in general should be short-lived
         *  function scoped objects.  Using log4cxx::basic_logstream as a class member or 
         *  static instance should be avoided in the same manner as you would avoid placing a std::ostringstream
         *  in those locations.  Insertion operations are generally short-circuited if the 
         *  level for the stream is not the same of higher that the level of the associated logger.
         */
        class LOG4CXX_EXPORT wlogstream : public logstream_base {
          typedef wchar_t Ch;
        public:
            /**
             *   Constructor.
             */
             wlogstream(const log4cxx::LoggerPtr& logger,
                 const log4cxx::LevelPtr& level);
             
            /**
             *   Constructor.
             */
             wlogstream(const Ch* loggerName, 
                const log4cxx::LevelPtr& level);

            /**
             *   Constructor.
             */
             wlogstream(const std::basic_string<Ch>& loggerName, 
                const log4cxx::LevelPtr& level);
             
             ~wlogstream();
             
             /**
              *   Insertion operator for std::fixed and similar manipulators.
              */
             wlogstream& operator<<(std::ios_base& (*manip)(std::ios_base&));
            
             /**
              *   Insertion operator for logstream_base::endmsg.
              */
              wlogstream& operator<<(logstream_manipulator manip);
            
              /**
               *   Insertion operator for level.
               */
              wlogstream& operator<<(const log4cxx::LevelPtr& level);
            /**
             *   Insertion operator for location.
             */
            wlogstream& operator<<(const log4cxx::spi::LocationInfo& location);
            
            /**
             *   Alias for insertion operator for location.  Kludge to avoid
          *      inappropriate compiler ambiguity.
             */
             wlogstream& operator>>(const log4cxx::spi::LocationInfo& location);
            

            /**
             *   Cast operator to provide access to embedded std::basic_ostream.
             */
             operator std::basic_ostream<Ch>&();
            
#if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE)             
            /**
              *  Template to allow any class with an std::basic_ostream inserter
              *    to be applied to this class.
             */
             template <class V>
             inline log4cxx::wlogstream& operator<<(const V& val) {
                 if (LOG4CXX_UNLIKELY(isEnabled())) {
                      ((std::basic_ostream<wchar_t>&) *this) << val;
                 }
                 return *this;
              }
#endif              
            
        protected:
              virtual void log(LoggerPtr& logger,
                               const LevelPtr& level,
                               const log4cxx::spi::LocationInfo& location);
              
              virtual void erase();
              
              virtual void get_stream_state(std::ios_base& base,
                                            std::ios_base& mask,
                                            int& fill,
                                            bool& fillSet) const;
              virtual void refresh_stream_state();
              
            
        private:
            wlogstream(const wlogstream&);
            wlogstream& operator=(const wlogstream&);
            std::basic_stringstream<Ch>* stream;
             
        };
#endif

#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API        
        /**
         *  An STL-like stream API for log4cxx using UniChar as the character type.
       *. Instances of log4cxx::logstream
         *  are not  designedfor use by multiple threads and in general should be short-lived
         *  function scoped objects.  Using log4cxx::basic_logstream as a class member or 
         *  static instance should be avoided in the same manner as you would avoid placing a std::ostringstream
         *  in those locations.  Insertion operations are generally short-circuited if the 
         *  level for the stream is not the same of higher that the level of the associated logger.
         */
        class LOG4CXX_EXPORT ulogstream : public logstream_base {
          typedef UniChar Ch;
        public:
            /**
             *   Constructor.
             */
             ulogstream(const log4cxx::LoggerPtr& logger,
                 const log4cxx::LevelPtr& level);
             
#if LOG4CXX_UNICHAR_API             
            /**
             *   Constructor.
             */
             ulogstream(const Ch* loggerName, 
                const log4cxx::LevelPtr& level);

            /**
             *   Constructor.
             */
             ulogstream(const std::basic_string<Ch>& loggerName, 
                const log4cxx::LevelPtr& level);
#endif

#if LOG4CXX_CFSTRING_API
             ulogstream(const CFStringRef& loggerName,
                   const log4cxx::LevelPtr& level);
#endif             
             
             ~ulogstream();
             
             /**
              *   Insertion operator for std::fixed and similar manipulators.
              */
             ulogstream& operator<<(std::ios_base& (*manip)(std::ios_base&));
            
             /**
              *   Insertion operator for logstream_base::endmsg.
              */
              ulogstream& operator<<(logstream_manipulator manip);
            
              /**
               *   Insertion operator for level.
               */
              ulogstream& operator<<(const log4cxx::LevelPtr& level);
            /**
             *   Insertion operator for location.
             */
            ulogstream& operator<<(const log4cxx::spi::LocationInfo& location);
            
            /**
             *   Alias for insertion operator for location.  Kludge to avoid
          *      inappropriate compiler ambiguity.
             */
             ulogstream& operator>>(const log4cxx::spi::LocationInfo& location);
            

            /**
             *   Cast operator to provide access to embedded std::basic_ostream.
             */
             operator std::basic_ostream<Ch>&();
            
#if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE)             
            /**
              *  Template to allow any class with an std::basic_ostream inserter
              *    to be applied to this class.
             */
             template <class V>
             inline ulogstream& operator<<(const V& val) {
                 if (LOG4CXX_UNLIKELY(isEnabled())) {
                      ((std::basic_ostream<Ch>&) *this) << val;
                 }
                 return *this;
              }
#endif              
            
        protected:
              virtual void log(LoggerPtr& logger,
                               const LevelPtr& level,
                               const log4cxx::spi::LocationInfo& location);
              
              virtual void erase();
              
              virtual void get_stream_state(std::ios_base& base,
                                            std::ios_base& mask,
                                            int& fill,
                                            bool& fillSet) const;
              virtual void refresh_stream_state();
              
            
        private:
            ulogstream(const ulogstream&);
            ulogstream& operator=(const ulogstream&);
            std::basic_stringstream<Ch>* stream;
             
        };
#endif


}  // namespace log4cxx


#if LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE
//
//  VC6 will fail to compile if class-scope templates
//     are used to handle arbitrary insertion operations.
//     However, using global namespace insertion operations 
//     run into LOGCXX-150.

/**
 *  Template to allow any class with an std::basic_ostream inserter
 *    to be applied to this class.
 */
template <class V>
inline log4cxx::logstream& operator<<(log4cxx::logstream& os, const V& val) {
     if (LOG4CXX_UNLIKELY(os.isEnabled())) {
         ((std::basic_ostream<char>&) os) << val;
     }
     return os;
}

#if LOG4CXX_WCHAR_T_API            
/**
 *  Template to allow any class with an std::basic_ostream inserter
 *    to be applied to this class.
 */
template <class V>
inline log4cxx::wlogstream& operator<<(log4cxx::wlogstream& os, const V& val) {
     if (LOG4CXX_UNLIKELY(os.isEnabled())) {
         ((std::basic_ostream<wchar_t>&) os) << val;
     }
     return os;
}
#endif
#endif

#if !defined(LOG4CXX_ENDMSG)
#if LOG4CXX_LOGSTREAM_ADD_NOP
#define LOG4CXX_ENDMSG (log4cxx::logstream_manipulator) log4cxx::logstream_base::nop >> LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg
#else
#define LOG4CXX_ENDMSG LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg
#endif
#endif


#endif //_LOG4CXX_STREAM_H