-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdburl.h
80 lines (77 loc) · 2.29 KB
/
dburl.h
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
/* -*- c++ -*-
* dburl.h
*
* Header for the DBURL class
* Copyright (C) 2002 lignum Computing, Inc. <[email protected]>
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef DBURL_H
#define DBURL_H
#include <qurl.h>
/*!
* The DBURL class is just a thin wrapper on the QUrl class. It's
* helpful to be able to extract paths other than the last in
* the URL representation of object paths, such as to extract the
* parent path of an object. Also, makes the access
* functions look less like URL components (e.g., name() instead of file()).
*/
class DBURL : public QUrl
{
public:
/*!
* In cases where the path is not known at construction time.
*/
DBURL ( void )
{}
/*!
* Constructor takes a URL-like path:
* protocol:///model-dburl/parent-name.type/.../object-name.type
* \param path URL-like descriptor of object.
*/
DBURL ( const QString& path ) : QUrl ( path )
{}
/*!
* The two part constructor (hopefully, will not try to ENCODE
* the protocol:/// part of the url!)
* \param url some rooted part of the URL (like just the protocol).
* \param relURL rest of the URL, relative to first argument.
*/
DBURL ( const QString& url, const QString& relURL )
{
QUrl rURL(relURL);
if(rURL.isRelative()) {
QUrl(url + relURL);
}
else {
QUrl(relURL);
}
}
/*!
* \return the object-name (without the type).
*/
QString name ( void ) const;
/*!
* \return the type of the object-name.type.
*/
QString type ( void ) const;
/*!
* \return the DBURL of the object's parent.
*/
DBURL parent ( void ) const;
};
#endif // DBURL_H