This file is indexed.

/usr/include/arc/IString.h is in nordugrid-arc-dev 4.2.0-2.

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
// -*- indent-tabs-mode: nil -*-

#ifndef __ARC_ISTRING__
#define __ARC_ISTRING__

#include <list>
#include <string>
#include <ostream>

#include <sigc++/slot.h>
#include <glibmm.h>

#include <stdio.h>  // snprintf
#include <stdlib.h> // free
#include <string.h> // strcpy, strdup

#define istring(x) (x)

namespace Arc {

  /** \cond Class used internally by IString. */
  class PrintFBase {
  public:
    PrintFBase();
    virtual ~PrintFBase();
    virtual void msg(std::ostream& os) = 0;
    virtual void msg(std::string& s) = 0;
    void Retain();
    bool Release();
  private:
    // Copying not allowed
    PrintFBase(const PrintFBase&);
    // Assignment not allowed
    PrintFBase& operator=(const PrintFBase&);
    int refcount;
  };
  /** \endcond */

  /// Return the translation of the given string.
  /** \ingroup common */
  const char* FindTrans(const char *p);
  /// Return the plural form translation of the given string when it refers to multiple n.
  /** \ingroup common */
  const char* FindNTrans(const char *s, const char *p, unsigned long n);

  /** \cond Class used internally by IString. */
  template<class T0 = int, class T1 = int, class T2 = int, class T3 = int,
           class T4 = int, class T5 = int, class T6 = int, class T7 = int>
  class PrintF
    : public PrintFBase {

  public:

    PrintF(const std::string& m,
           const T0& tt0 = 0, const T1& tt1 = 0,
           const T2& tt2 = 0, const T3& tt3 = 0,
           const T4& tt4 = 0, const T5& tt5 = 0,
           const T6& tt6 = 0, const T7& tt7 = 0)
      : PrintFBase(),
        m(m) {
      Copy(t0, tt0);
      Copy(t1, tt1);
      Copy(t2, tt2);
      Copy(t3, tt3);
      Copy(t4, tt4);
      Copy(t5, tt5);
      Copy(t6, tt6);
      Copy(t7, tt7);
    }

    ~PrintF() {
      for (std::list<char*>::iterator it = ptrs.begin();
           it != ptrs.end(); it++)
        free(*it);
    }

    virtual void msg(std::ostream& os) {

      char buffer[2048];
      snprintf(buffer, 2048, Get(m),
               Get(t0), Get(t1), Get(t2), Get(t3),
               Get(t4), Get(t5), Get(t6), Get(t7));
      os << buffer;
    }

    virtual void msg(std::string& s) {

      char buffer[2048];
      snprintf(buffer, 2048, Get(m),
               Get(t0), Get(t1), Get(t2), Get(t3),
               Get(t4), Get(t5), Get(t6), Get(t7));
      s = buffer;
    }

  private:

    // general case
    template<class T, class U>
    inline void Copy(T& t, const U& u) {
      t = u;
    }

    // char[] and const char[]
    template<class T>
    inline void Copy(T& t, const char u[]) {
      strcpy(t, u);
    }

    // const char*
    inline void Copy(const char*& t, const char*const& u) {
      t = strdup(u);
      ptrs.push_back(const_cast<char*>(t));
    }

    // char*
    inline void Copy(char*& t, char*const& u) {
      t = strdup(u);
      ptrs.push_back(t);
    }

    // general case
    template<class T>
    inline static const T& Get(const T& t) {
      return t;
    }

    // const char[] and const char*
    inline static const char* Get(const char*const& t) {
      return FindTrans(t);
    }

    // char[] and char*
    inline static const char* Get(char*const& t) {
      return FindTrans(const_cast<const char*&>(t));
    }

    // std::string
    inline static const char* Get(const std::string& t) {
      return FindTrans(t.c_str());
    }

    // std::string ()()
    inline static const char* Get(std::string (*t)()) {
      return FindTrans(t().c_str());
    }

    // Glib::ustring
    inline static const char* Get(const Glib::ustring& t) {
      return FindTrans(t.c_str());
    }

    // Glib::ustring ()()
    inline static const char* Get(Glib::ustring (*t)()) {
      return FindTrans(t().c_str());
    }

    // sigc::slot<const char*>*
    inline static const char* Get(const sigc::slot<const char*> *t) {
      return (*t)();
    }

    std::string m;
    T0 t0;
    T1 t1;
    T2 t2;
    T3 t3;
    T4 t4;
    T5 t5;
    T6 t6;
    T7 t7;
    std::list<char*> ptrs;
  };
  /** \endcond */

  /// Class used for localised output of log messages.
  /** IString should only be used directly in rare cases. Logger should be used
   *  instead in most cases.
   *  \ingroup common
   *  \headerfile IString.h arc/IString.h */
  class IString {

  public:

    IString(const std::string& m)
      : p(new PrintF<>(m)) {}

    template<class T0>
    IString(const std::string& m, const T0& t0)
      : p(new PrintF<T0>(m, t0)) {}

    template<class T0, class T1>
    IString(const std::string& m, const T0& t0, const T1& t1)
      : p(new PrintF<T0, T1>(m, t0, t1)) {}

    template<class T0, class T1, class T2>
    IString(const std::string& m, const T0& t0, const T1& t1, const T2& t2)
      : p(new PrintF<T0, T1, T2>(m, t0, t1, t2)) {}

    template<class T0, class T1, class T2, class T3>
    IString(const std::string& m, const T0& t0, const T1& t1, const T2& t2, const T3& t3)
      : p(new PrintF<T0, T1, T2, T3>(m, t0, t1, t2, t3)) {}

    template<class T0, class T1, class T2, class T3, class T4>
    IString(const std::string& m, const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4)
      : p(new PrintF<T0, T1, T2, T3, T4>(m, t0, t1, t2, t3, t4)) {}

    template<class T0, class T1, class T2, class T3, class T4, class T5>
    IString(const std::string& m, const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5)
      : p(new PrintF<T0, T1, T2, T3, T4, T5>(m, t0, t1, t2, t3, t4, t5)) {}

    template<class T0, class T1, class T2, class T3, class T4, class T5, class T6>
    IString(const std::string& m, const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6)
      : p(new PrintF<T0, T1, T2, T3, T4, T5, T6>(m, t0, t1, t2, t3, t4, t5, t6)) {}

    template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7>
    IString(const std::string& m, const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7)
      : p(new PrintF<T0, T1, T2, T3, T4, T5, T6, T7>(m, t0, t1, t2, t3, t4, t5, t6, t7)) {}

    ~IString();

    IString(const IString& istr);
    IString& operator=(const IString& istr);
    std::string str(void);

  private:

    PrintFBase *p;

    friend std::ostream& operator<<(std::ostream& os, const IString& msg);
  };

  /// Output localised message to an output stream.
  std::ostream& operator<<(std::ostream& os, const IString& msg);

} // namespace Arc

#endif // __ARC_ISTRING__