This file is indexed.

/usr/include/tntdb/bits/value.h is in libtntdb-dev 1.3-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
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
/*
 * Copyright (C) 2005,2010 Tommi Maekitalo
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * As a special exception, you may use this file as part of a free
 * software library without restriction. Specifically, if other files
 * instantiate templates or use macros or inline functions from this
 * file, or you compile this file and link it with other files to
 * produce an executable, this file does not by itself cause the
 * resulting executable to be covered by the GNU General Public
 * License. This exception does not however invalidate any other
 * reasons why the executable file might be covered by the GNU Library
 * General Public License.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef TNTDB_BITS_VALUE_H
#define TNTDB_BITS_VALUE_H

#include <tntdb/iface/ivalue.h>
#include <tntdb/date.h>
#include <tntdb/time.h>
#include <tntdb/datetime.h>
#include <tntdb/decimal.h>
#include <tntdb/blob.h>
#include <tntdb/config.h>
#include <cxxtools/smartptr.h>

namespace tntdb
{
  /**
   * The class Value represents a value, which is fetched from the database.
   */
  class Value
  {
      cxxtools::SmartPtr<IValue> value;

    public:
      explicit Value(IValue* value = 0)
        : value(value)
        { }

      //@{
      /**
       * Explicit data-access.
       * The getXXX-methods return the value in the requested type.
       * If the value can't be converted to the requested type, a exception of
       * type tntdb::TypeError is thrown.
       */
      /// return true, when value is null
      bool isNull() const                 { return !value || value->isNull(); }
      /// return true, when value represents boolean true.
      bool getBool() const                { return value->getBool(); }
      /// tries to convert value into an short.
      short getShort() const              { return value->getShort(); }
      /// tries to convert value into an int.
      int getInt() const                  { return value->getInt(); }
      /// tries to convert value into an long.
      long getLong() const                { return value->getLong(); }
      /// tries to convert value into an unsigned short.
      unsigned short getUnsignedShort() const { return value->getUnsignedShort(); }
      /// tries to convert value into an unsigned.
      unsigned getUnsigned() const        { return value->getUnsigned(); }
      /// tries to convert value into an unsigned long.
      unsigned long getUnsignedLong() const { return value->getUnsignedLong(); }
      /// tries to convert value into an int32_t.
      int32_t getInt32() const            { return value->getInt32(); }
      /// tries to convert value into an uint32_t.
      uint32_t getUnsigned32() const      { return value->getUnsigned32(); }
      /// tries to convert value into an int64_t.
      int64_t getInt64() const            { return value->getInt64(); }
      /// tries to convert value into an uint64_t.
      uint64_t getUnsigned64() const      { return value->getUnsigned64(); }
      /// tries to convert value into a Decimal.
      Decimal getDecimal() const          { return value->getDecimal(); }
      /// tries to convert value into an float.
      float getFloat() const              { return value->getFloat(); }
      /// tries to convert value into an double.
      double getDouble() const            { return value->getDouble(); }
      /// returns the first character of the text-representation.
      char getChar() const                { return value->getChar(); }
      /// returns the value as a string.
      std::string getString() const
        { std::string ret; value->getString(ret); return ret; }
      /// fills the passed string with the value.
      /// this might be slightly more efficient than just returning a new
      /// string since one copy is saved.
      void getString(std::string& ret) const
        { value->getString(ret); }
      /// returns the value as a unicode string.
      cxxtools::String getUString() const
        { cxxtools::String ret; value->getUString(ret); return ret; }
      void getUString(cxxtools::String& ret) const
        { value->getUString(ret); }
      /// Returns the value as a blob.
      /// This is more or less an alias to getString just to stress, that
      /// the data is truly binary and not some text value.
      Blob getBlob() const
        { Blob ret; value->getBlob(ret); return ret; }
      /// Returns the value as a blob.
      void getBlob(Blob& blob) const
        { value->getBlob(blob); }
      /// returns the value as a Date.
      Date getDate() const                { return value->getDate(); }
      /// returns the value as a Time.
      Time getTime() const                { return value->getTime(); }
      /// returns the value as a Datetime.
      Datetime getDatetime() const        { return value->getDatetime(); }
      //@}

      /**
       * Explicit data-access.
       * The get-template return false if the value is null. Otherwise the
       * passed reference is filled with the value.
       * If the value can't be converted to the requested type, a exception of
       * type tntdb::TypeError is thrown.
       *
       * In contrast to the getXXX-methods the type is not specified explictely
       * but determined by the passed reference.
       *
       * The extraction is actually done using the operator>> with a l-value of
       * const Value& and a r-value of a reference to the actual type. This
       * operator is defined for standard types and may be defined for user
       * defined types.
       */
      template <typename T>
      bool getValue(T& ret) const
        { return *this >> ret; }

      /// Shorter name for getValue.
      template <typename T>
      bool get(T& ret) const
        { return *this >> ret; }

      /// Returns true, if this class is not connected to a actual statement.
      bool operator!() const              { return !value; }
      ///  Returns the actual implementation-class.
      const IValue* getImpl() const       { return &*value; }
  };

  //@{
  /**
    Extraction operators for standard types.
   */
  inline bool operator>> (const Value& value, bool& out)
  {
    if (value.isNull())
      return false;

    out = value.getBool();
    return true;
  }

  inline bool operator>> (const Value& value, short& out)
  {
    if (value.isNull())
      return false;

    out = value.getShort();
    return true;
  }

  inline bool operator>> (const Value& value, int& out)
  {
    if (value.isNull())
      return false;

    out = value.getInt();
    return true;
  }

  inline bool operator>> (const Value& value, long& out)
  {
    if (value.isNull())
      return false;

    out = value.getLong();
    return true;
  }

  inline bool operator>> (const Value& value, unsigned short& out)
  {
    if (value.isNull())
      return false;

    out = value.getUnsignedShort();
    return true;
  }

  inline bool operator>> (const Value& value, unsigned& out)
  {
    if (value.isNull())
      return false;

    out = value.getUnsigned();
    return true;
  }

  inline bool operator>> (const Value& value, unsigned long& out)
  {
    if (value.isNull())
      return false;

    out = value.getUnsignedLong();
    return true;
  }

#if INT_INT32_T_CONFLICT != 1
  inline bool operator>> (const Value& value, int32_t& out)
  {
    if (value.isNull())
      return false;

    out = value.getInt32();
    return true;
  }
#endif

#if UNSIGNED_UINT32_T_CONFLICT != 1
  inline bool operator>> (const Value& value, uint32_t& out)
  {
    if (value.isNull())
      return false;

    out = value.getUnsigned32();
    return true;
  }
#endif

#if INT_INT64_T_CONFLICT != 1
  inline bool operator>> (const Value& value, int64_t& out)
  {
    if (value.isNull())
      return false;

    out = value.getInt64();
    return true;
  }
#endif

#if UNSIGNED_UINT64_T_CONFLICT != 1
  inline bool operator>> (const Value& value, uint64_t& out)
  {
    if (value.isNull())
      return false;

    out = value.getUnsigned64();
    return true;
  }
#endif

  inline bool operator>> (const Value& value, Decimal& out)
  {
    if (value.isNull())
      return false;

    out = value.getDecimal();
    return true;
  }

  inline bool operator>> (const Value& value, float& out)
  {
    if (value.isNull())
      return false;

    out = value.getFloat();
    return true;
  }

  inline bool operator>> (const Value& value, double& out)
  {
    if (value.isNull())
      return false;

    out = value.getDouble();
    return true;
  }

  inline bool operator>> (const Value& value, char& out)
  {
    if (value.isNull())
      return false;

    out = value.getChar();
    return true;
  }

  inline bool operator>> (const Value& value, std::string& out)
  {
    if (value.isNull())
      return false;

    value.getString(out);
    return true;
  }

  inline bool operator>> (const Value& value, cxxtools::String& out)
  {
    if (value.isNull())
      return false;

    value.getUString(out);
    return true;
  }

  inline bool operator>> (const Value& value, Blob& out)
  {
    if (value.isNull())
      return false;

    value.getBlob(out);
    return true;
  }

  inline bool operator>> (const Value& value, Date& out)
  {
    if (value.isNull())
      return false;

    out = value.getDate();
    return true;
  }

  inline bool operator>> (const Value& value, Time& out)
  {
    if (value.isNull())
      return false;

    out = value.getTime();
    return true;
  }

  inline bool operator>> (const Value& value, Datetime& out)
  {
    if (value.isNull())
      return false;

    out = value.getDatetime();
    return true;
  }
  //@}

}

#endif // TNTDB_BITS_VALUE_H