Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* This file is part of the KDE Project
2
3 Copyright (C) 2006-2008 Ralf Habacker <ralf.habacker@freenet.de>
4 All rights reserved.
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20#ifndef _LINKFILE_H
21#define _LINKFILE_H
22
23#include <QList>
24#include <QString>
25#include <QStringList>
26
27class LinkFile {
28 public:
29 /// create instance
30 LinkFile(const QString &_linkPath, const QString &_execPath, const QString &_description, const QString &_workingDir)
31 {
32 m_execPath = _execPath;
33 m_arguments = QStringList();
34 m_linkPath = _linkPath;
35 m_description = _description;
36 m_workingDir = _workingDir;
37 }
38 /**
39 constructs LinkFile instance with arguments
40 */
41 LinkFile(const QString &linkPath, const QStringList &args, const QString &description, const QString &workingDir)
42 {
43 if (args.size() > 0)
44 m_execPath = args[0];
45 if (args.size() > 1) {
46 m_arguments = args;
47 m_arguments.removeFirst();
48 }
49 m_linkPath = linkPath;
50 m_description = description;
51 m_workingDir = workingDir;
52 }
53
54 /// check if link file exists
55 bool exists();
56 /// create link file from instance data
57 bool create();
58 /// remove link file
59 bool remove();
60 /// read link file content into instance
61 bool read();
62
63 const QString &execPath() { return m_execPath; }
64 const QString &linkPath() { return m_linkPath; }
65 const QString &description() { return m_description; }
66 const QString &workingDir() { return m_workingDir; }
67 const QStringList &arguments() { return m_arguments; }
68
69 void setExecPath(const QString &a) { m_execPath = a; }
70 void setLinkPath(const QString &a) { m_linkPath = a; }
71 void setDescription(const QString &a) { m_description = a; }
72 void setWorkingDir(const QString &a) { m_workingDir = a; }
73 void setArguments(const QStringList &a) { m_arguments = a; }
74
75 friend QDebug operator<<(QDebug out, const LinkFile &c);
76
77 protected:
78 QString m_execPath;
79 QString m_linkPath;
80 QString m_description;
81 QString m_workingDir;
82 QStringList m_arguments;
83};
84
85class LinkFiles {
86 public:
87 static bool scan(QList <LinkFile> &files, const QString &rootDir);
88 static bool create(QList <LinkFile> &newFiles);
89 static bool cleanup(QList <LinkFile> &newFiles, QList <LinkFile> &oldFiles);
90};
91
92#endif
93// vim: ts=4 sw=4 et
94

Warning: That file was not part of the compilation database. It may have many parsing errors.