This file is indexed.

/usr/include/KDb3/KDbConnectionData.h is in libkdb3-dev 3.1.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
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
/****************************************************************************
** Shared Class code from reading file 'KDbConnectionData.shared.h'
**
** Created
**      by: The Shared Data Compiler version 0.3
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

/* This file is part of the KDE project
   Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef KDB_CONNECTION_DATA_H
#define KDB_CONNECTION_DATA_H

#include "kdb_export.h"

#include <QCoreApplication>
#include <QDebug>
#include <QMap>
#include <QSharedData>
#include <QString>

/*! @brief Database specific connection data, e.g. host, port.

 KDbConnection data, once configured, can be later stored for reuse.
*/
/*! @note objects of this class are implicitly shared, what means they have value semantics
          by offering copy-on-write behaviour to maximize resource usage and minimize copying.
          Only a pointer to the data is passed around. See <a href="http://doc.qt.io/qt-5/qshareddatapointer.html#details">Qt documentation</a>.
 */
//! @note This class has been generated using the following SDC class options: operator==, with_from_to_map, implicit
class KDB_EXPORT KDbConnectionData
{
    Q_DECLARE_TR_FUNCTIONS(KDbConnectionData)
public:











    //! @internal data class used to implement implicitly shared class KDbConnectionData.
    //! Provides thread-safe reference counting.
    class Data : public QSharedData
    {
    public:
        Data()
        : port(0)
        , useLocalSocketFile(true)
        , savePassword(false)
        {
        }

        Data(const Data &other)
         : QSharedData(other)
         , databaseName(other.databaseName)
         , caption(other.caption)
         , description(other.description)
         , driverId(other.driverId)
         , userName(other.userName)
         , hostName(other.hostName)
         , port(other.port)
         , useLocalSocketFile(other.useLocalSocketFile)
         , localSocketFileName(other.localSocketFileName)
         , password(other.password)
         , savePassword(other.savePassword)
        {
        }

        virtual ~Data() {}

        //! Clones the object with all attributes; the copy isn't shared with the original.
        virtual Data* clone() const { return new Data(*this); }

        /*! Constructor for Data object, takes attributes saved to map @a map.
        If @a ok is not 0, *ok is set to true on success and to false on failure. @see toMap(). */
        Data(const QMap<QString, QString> &map, bool *ok);

        QMap<QString, QString> toMap() const;

        bool operator==(const Data &other) const {
            return databaseName == other.databaseName
                   && caption == other.caption
                   && description == other.description
                   && driverId == other.driverId
                   && userName == other.userName
                   && hostName == other.hostName
                   && port == other.port
                   && useLocalSocketFile == other.useLocalSocketFile
                   && localSocketFileName == other.localSocketFileName
                   && password == other.password
                   && savePassword == other.savePassword;
        }

        QString databaseName; //!< @see KDbConnectionData::databaseName(), KDbConnectionData::setDatabaseName()
        QString caption; //!< @see KDbConnectionData::caption(), KDbConnectionData::setCaption()
        QString description; //!< @see KDbConnectionData::description(), KDbConnectionData::setDescription()
        QString driverId; //!< @see KDbConnectionData::driverId(), KDbConnectionData::setDriverId()
        QString userName; //!< @see KDbConnectionData::userName(), KDbConnectionData::setUserName()
        QString hostName; //!< @see KDbConnectionData::hostName(), KDbConnectionData::setHostName()
        int port; //!< @see KDbConnectionData::port(), KDbConnectionData::setPort()
        bool useLocalSocketFile; //!< @see KDbConnectionData::useLocalSocketFile(), KDbConnectionData::setUseLocalSocketFile()
        QString localSocketFileName; //!< @see KDbConnectionData::localSocketFileName(), KDbConnectionData::setLocalSocketFileName()
        QString password; //!< @see KDbConnectionData::password(), KDbConnectionData::setPassword()
        bool savePassword; //!< @see KDbConnectionData::savePassword(), KDbConnectionData::setSavePassword()
    };

    KDbConnectionData()
     : d(new Data)
    {
    }

    KDbConnectionData(const KDbConnectionData &other)
     : d(other.d)
    {
    }

    /*! Constructor for KDbConnectionData object, takes attributes saved to map @a map.
         If @a ok is not 0, sets *ok to true on success and to false on failure. @see toMap(). */
    KDbConnectionData(const QMap<QString, QString> &map, bool *ok)
     : d(new Data(map, ok))
    {
    }

    virtual ~KDbConnectionData();

    /*!
    @return database name

    Optional attribute explicitly providing database name.
    If not empty, the database driver will attempt to use the database
    (e.g. with "USE DATABASE" SQL statement).

    For file-based database engines like SQLite, the database name is equal to filename
    (absolute or relative) that should be open. In this case hostName and port is unused.

    Can be empty, in which case if database name is required by the connection,
    after connecting KDbConnection::useDatabase() should be called.
    */
    QString databaseName() const {
        return d->databaseName;
    }

    /*!
    Explicitly sets database name.
    */
    void setDatabaseName(const QString & databaseName) {
        d->databaseName = databaseName;
    }

    /*!
    @return caption of the connection
    Captions are optional for identyfying given connection by name eg. for users.
    */
    QString caption() const {
        return d->caption;
    }

    /*!
    Sets caption of the connection
    */
    void setCaption(const QString & caption) {
        d->caption = caption;
    }

    /*!
    @return additional description for the connection
    */
    QString description() const {
        return d->description;
    }

    /*!
    Sets additional description for the connection
    */
    void setDescription(const QString & description) {
        d->description = description;
    }

    /*!
    @return identifier of the driver.
    ID (unique, not i18n-ed) of driver that is used (or should be used) to
    create a connection. If you pass this KDbConnectionData object to
    KDbDriver::createConnection() to create connection, the @a driverId member
    will be updated with a valid KDb driver ID.
    In other situations the @a driverId member may be used to store information what
    driver should be used to perform connection, before we get an appropriate
    driver object from KDbDriverManager.
    */
    QString driverId() const {
        return d->driverId;
    }

    /*!
    Sets identifier of the driver to use
    */
    void setDriverId(const QString & driverId) {
        d->driverId = driverId;
    }

    /*!
    @return username used for creating connections
    Can be empty.
    */
    QString userName() const {
        return d->userName;
    }

    /*!
    Sets username used for creating connections
    */
    void setUserName(const QString & userName) {
        d->userName = userName;
    }

    /*!
    @return host name used for creating remote connections
    Can be IP number. Can be empty if the connection is not remote.
    If empty, "localhost" is used.
    */
    QString hostName() const {
        return d->hostName;
    }

    /*!
    Sets host name used for creating remote connections
    */
    void setHostName(const QString & hostName) {
        d->hostName = hostName;
    }

    /*!
    The default is 0, what means using the database engine's default port.
    */
    int port() const {
        return d->port;
    }

    /*!
    Sets port used for creating remote connections
    */
    void setPort(int port) {
        d->port = port;
    }

    /*!
    @return true if local socket file should be used instead of TCP/IP port.

    Only meaningful for connections with localhost as server.
    True by default, so local communication can be optimized, and users can avoid problems
    with TCP/IP connections disabled by firewalls.

    If true, @a hostName and @a port will be ignored and @a localSocketFileName() will be used.
    On MS Windows this option is usually ignored and TCP/IP connection to the localhost is performed.
    */
    bool useLocalSocketFile() const {
        return d->useLocalSocketFile;
    }

    /*!
    Sets flag for usage of local socket file. @see useLocalSocketFile()
    */
    void setUseLocalSocketFile(bool useLocalSocketFile) {
        d->useLocalSocketFile = useLocalSocketFile;
    }

    /*!
    @return name of local (named) socket file.

    For local connections only. If empty, it's driver will try to locate existing local socket
    file. Empty by default.
    */
    QString localSocketFileName() const {
        return d->localSocketFileName;
    }

    /*!
    Sets name  of local (named) socket file
    */
    void setLocalSocketFileName(const QString & localSocketFileName) {
        d->localSocketFileName = localSocketFileName;
    }

    /*!
    @return password used for creating connections

    Can be empty string (QString("")) or null (QString()). If it is empty, empty password is passed
    to the connection. If it is null, no password is saved and thereform no password is passed to the connection.
    In the latter case, applications that KDb should ask for the password before performing connection
    if password is required by the connection.
    */
    QString password() const {
        return d->password;
    }

    /*!
    Sets password used for creating connections
    */
    void setPassword(const QString & password) {
        d->password = password;
    }

    /*!
    @return true if the connection's password should be stored in a configuration file for later use.
    False by default, in most cases can be set to true when non-null password is known.
    For instance, this flag can be then shown for a user as a checkbox in the graphical interface.
    */
    bool savePassword() const {
        return d->savePassword;
    }

    /*!
    Sets password-saving flag used to decide if the connection's password should be stored
    in a configuration file for later use
    */
    void setSavePassword(bool savePassword) {
        d->savePassword = savePassword;
    }

    /*! @return map with saved attributes of the KDbConnectionData object.

     @see KDbConnectionData(const QMap<QString, QString>&, bool *).
    */
    QMap<QString, QString> toMap() const {
        return d->toMap();
    }

    //! @return true if this object is equal to @a other; otherwise returns false.
    bool operator==(const KDbConnectionData &other) const {
        return *d == *other.d;
    }

    //! @return true if this object is not equal to @a other; otherwise returns false.
    bool operator!=(const KDbConnectionData &other) const {
        return !operator==(other);
    }


    //! Used in toUserVisibleString()
    enum class UserVisibleStringOption {
        None = 0,
        AddUser = 1
    };
    Q_DECLARE_FLAGS(UserVisibleStringOptions, UserVisibleStringOption)

    /*! @return A user-visible string for the connection data
    driverId() is used to know if driver handles server connections. If it's not possible
    to check the driver, defaults to "file" connection.

    Example strings:
     - "myhost.org:12345" if a host and port is specified;
     - "localhost:12345" if only a port and server-based driver is specified;
     - "user@myhost.org:12345" if user is specified too
     - "<file>" if a file-based driver is specified but no filename in the databaseName attribute
     - "file: pathto/mydb.kexi" if a file-based driver is specified and filename
       is specified in the databaseName attribute
     - "<file>" if the driver is unknown or not specified and no databaseName is specified

     User name is added if (@a options & UserVisibleStringOption::AddUser) is true (the default).
    */
    QString toUserVisibleString(UserVisibleStringOptions options = UserVisibleStringOption::AddUser) const;

    /*! @return true if password is needed for performing connection.
    The password has to be provided by the user.
    @note This method needs information about driver ID; it returns false if driverId()
          does not return a valid ID.
    */
    bool isPasswordNeeded() const;

protected:
    QSharedDataPointer<Data> d;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(KDbConnectionData::UserVisibleStringOptions)

//! Sends information about connection data @a data to debug output @a dbg.
KDB_EXPORT QDebug operator<<(QDebug dbg, const KDbConnectionData& data);

#endif