~neon/pykde4/master

« back to all changes in this revision

Viewing changes to sip/kdecore/kurl.sip

  • Committer: Simon Edwards
  • Date: 2007-09-02 19:43:19 UTC
  • Revision ID: git-v1:6b8df0c7009f6b218f54589a9bc313cd8c4f82b9

Initial drop of PyKDE4 - Python bindings for the KDE API. See the README file
for more info about the current state of PyKDE4.


svn path=/trunk/KDE/kdebindings/python/pykde4/; revision=707731

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
//     Copyright 2007 Jim Bublitz <jbublitz@nwinternet.com>
 
3
//     Earlier copyrights 1998 - 2006 Jim Bublitz also apply
 
4
 
 
5
 
 
6
//                 Generated by preSip
 
7
//            PyKDE4 module kdecore  version KDE 3.92.0
 
8
 
 
9
 
 
10
// This file is part of PyKDE4.
 
11
 
 
12
// PyKDE4 is free software; you can redistribute it and/or modify
 
13
// it under the terms of the GNU Lesser General Public License as
 
14
// published by the Free Software Foundation; either version 2.1 of
 
15
// the License, or (at your option) any later version.
 
16
 
 
17
// PyKDE4 is distributed in the hope that it will be useful,
 
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
// GNU General Public License for more details.
 
21
 
 
22
// You should have received a copy of the GNU General Public License
 
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
24
 
 
25
%ModuleHeaderCode
 
26
//ctscc
 
27
#include <kurl.h>
 
28
%End
 
29
 
 
30
 
 
31
class KUrl : QUrl
 
32
{
 
33
%TypeHeaderCode
 
34
#include <kurl.h>
 
35
%End
 
36
 
 
37
 
 
38
public:
 
39
    typedef QMap<QString, QString> MetaDataMap;
 
40
 
 
41
    enum MimeDataFlags
 
42
    {
 
43
        DefaultMimeDataFlags, 
 
44
        NoTextExport
 
45
    };
 
46
 
 
47
 
 
48
    class List
 
49
    {
 
50
 
 
51
    public:
 
52
                             List ();
 
53
                             List (const KUrl&);
 
54
                             List (const QStringList&);
 
55
        QStringList          toStringList () const;
 
56
//ig                              operator QVariant () const;
 
57
        void                 populateMimeData (QMimeData*, const KUrl::MetaDataMap& = KUrl::MetaDataMap (), KUrl::MimeDataFlags = KUrl::DefaultMimeDataFlags ) const;
 
58
        static bool          canDecode (const QMimeData*);
 
59
        static QStringList   mimeDataTypes ();
 
60
        static KUrl::List    fromMimeData (const QMimeData*, KUrl::MetaDataMap* = 0);
 
61
 
 
62
    public:
 
63
//force
 
64
        int                  __len__ ()  /NonLazy/;
 
65
%MethodCode
 
66
//returns (int)
 
67
    Py_BEGIN_ALLOW_THREADS
 
68
    sipRes = sipCpp -> count();
 
69
    Py_END_ALLOW_THREADS
 
70
%End
 
71
 
 
72
        void                 __setitem__ (int, const KUrl&);
 
73
%MethodCode
 
74
//takes index | (int) | value | (KUrl)
 
75
    int len;
 
76
 
 
77
    len = sipCpp -> count();
 
78
 
 
79
    if ((a0 = sipConvertFromSequenceIndex(a0,len)) < 0)
 
80
        sipIsErr = 1;
 
81
    else
 
82
        (*sipCpp)[a0] = *a1;
 
83
%End
 
84
 
 
85
        void                 __setitem__ (SIP_PYSLICE, const KUrl::List&);
 
86
%MethodCode
 
87
//takes range | (a Python slice) | urlList | (KUrl.List)
 
88
 
 
89
    int len, start, stop, step, slicelength;
 
90
 
 
91
    len = sipCpp -> count();
 
92
 
 
93
    if (sipConvertFromSliceObject(a0,len,&start,&stop,&step,&slicelength) < 0)
 
94
        sipIsErr = 1;
 
95
    else
 
96
    {
 
97
        int vlen = a1 -> count();
 
98
        if (vlen != slicelength)
 
99
        {
 
100
            sipBadLengthForSlice(vlen,slicelength);
 
101
            sipIsErr = 1;
 
102
        }
 
103
        else
 
104
        {
 
105
            KUrl::List::ConstIterator it = a1 -> begin();
 
106
            for (int i = 0; i < slicelength; ++i)
 
107
            {
 
108
                (*sipCpp)[start] = *it;
 
109
                start += step;
 
110
                ++it;
 
111
            }
 
112
        }
 
113
    }
 
114
%End
 
115
 
 
116
        void                 __delitem__ (int);
 
117
%MethodCode
 
118
//takes index | (int)
 
119
    int len;
 
120
 
 
121
    len = sipCpp -> count();
 
122
 
 
123
    if ((a0 = sipConvertFromSequenceIndex(a0,len)) < 0)
 
124
        sipIsErr = 1;
 
125
    else
 
126
        sipCpp -> removeAt(a0);
 
127
%End
 
128
 
 
129
        void                 __delitem__ (SIP_PYSLICE);
 
130
%MethodCode
 
131
//takes range | (a Python slice)
 
132
    int len, start, stop, step, slicelength;
 
133
 
 
134
    len = sipCpp -> count();
 
135
    if (sipConvertFromSliceObject(a0,len,&start,&stop,&step,&slicelength) < 0)
 
136
        sipIsErr = 1;
 
137
    else
 
138
        for (int i = 0; i < slicelength; ++i)
 
139
        {
 
140
            sipCpp -> removeAt(start);
 
141
            start += step - 1;
 
142
        }
 
143
%End
 
144
 
 
145
        KUrl                 operator [] (int);
 
146
%MethodCode
 
147
//returns (KUrl)
 
148
//takes index | (int)
 
149
    int len;
 
150
 
 
151
    len = sipCpp -> count();
 
152
 
 
153
    if ((a0 = sipConvertFromSequenceIndex(a0,len)) < 0)
 
154
        sipIsErr = 1;
 
155
    else
 
156
        sipRes = new KUrl((*sipCpp)[a0]);
 
157
%End
 
158
 
 
159
        KUrl::List           operator [] (SIP_PYSLICE);
 
160
%MethodCode
 
161
//returns (KUrl.List)
 
162
//takes range | (a Python slice)
 
163
    int len, start, stop, step, slicelength;
 
164
 
 
165
    len = sipCpp -> count();
 
166
 
 
167
    if (sipConvertFromSliceObject(a0,len,&start,&stop,&step,&slicelength) < 0)
 
168
        sipIsErr = 1;
 
169
    else
 
170
    {
 
171
        sipRes = new KUrl::List();
 
172
 
 
173
        for (int i = 0; i < slicelength; ++i)
 
174
        {
 
175
            (*sipRes) += (*sipCpp)[start];
 
176
            start += step;
 
177
        }
 
178
    }
 
179
%End
 
180
 
 
181
        KUrl::List           operator + (const KUrl::List&);
 
182
%MethodCode
 
183
//returns (KUrl.List)
 
184
//takes listToAdd | (KUrl.List)
 
185
    Py_BEGIN_ALLOW_THREADS
 
186
//    sipRes = new KUrl::List((const KUrl::List&)((*sipCpp) + *a0));
 
187
    sipRes = new KUrl::List (*sipCpp);
 
188
    (*sipRes) += (*a0);
 
189
    Py_END_ALLOW_THREADS
 
190
%End
 
191
 
 
192
        KUrl::List&          operator += (const KUrl::List&);
 
193
        KUrl::List           operator * (int);
 
194
%MethodCode
 
195
    sipRes = new KUrl::List();
 
196
 
 
197
    for (int i = 0; i < a0; ++i)
 
198
        (*sipRes) += (*sipCpp);
 
199
%End
 
200
 
 
201
        KUrl::List&          operator *= (int);
 
202
%MethodCode
 
203
//returns (KUrl.List)
 
204
//takes val | (int)
 
205
    KUrl::List orig(*sipCpp);
 
206
 
 
207
    sipCpp -> clear();
 
208
 
 
209
    for (int i = 0; i < a0; ++i)
 
210
        (*sipCpp) += orig;
 
211
%End
 
212
 
 
213
        bool                 operator == (const KUrl::List&);
 
214
        bool                 operator != (const KUrl::List&);
 
215
        int                  __contains__ (KUrl)  /NonLazy/;
 
216
%MethodCode
 
217
//returns (bool)
 
218
//takes a0 | (KUrl)
 
219
 
 
220
    QString s = a0->url ();
 
221
    sipRes = 0;
 
222
    KUrl::List::Iterator it;
 
223
    for (it = sipCpp->begin (); (it != sipCpp->end ()) && (sipRes == 0); it++)
 
224
        if (s == (*it).url ())
 
225
            sipRes = 1;
 
226
%End
 
227
 
 
228
//end
 
229
 
 
230
 
 
231
    };  // class List
 
232
 
 
233
 
 
234
public:
 
235
                         KUrl ();
 
236
                         KUrl (const QString&);
 
237
                         KUrl (const char*);
 
238
                         KUrl (const QByteArray&);
 
239
                         KUrl (const KUrl&);
 
240
                         KUrl (const QUrl&);
 
241
                         KUrl (const KUrl&, const QString&);
 
242
    QString              protocol () const;
 
243
    void                 setProtocol (const QString&);
 
244
    QString              user () const;
 
245
    void                 setUser (const QString&);
 
246
    bool                 hasUser () const;
 
247
    QString              pass () const;
 
248
    void                 setPass (const QString&);
 
249
    bool                 hasPass () const;
 
250
    bool                 hasHost () const;
 
251
 
 
252
    enum AdjustPathOption
 
253
    {
 
254
        RemoveTrailingSlash, 
 
255
        LeaveTrailingSlash, 
 
256
        AddTrailingSlash
 
257
    };
 
258
 
 
259
    QString              path (KUrl::AdjustPathOption) const;
 
260
    QString              toLocalFile (KUrl::AdjustPathOption = KUrl::LeaveTrailingSlash ) const;
 
261
    void                 setPath (const QString&);
 
262
    bool                 hasPath () const;
 
263
 
 
264
    enum CleanPathOption
 
265
    {
 
266
        SimplifyDirSeparators, 
 
267
        KeepDirSeparators
 
268
    };
 
269
 
 
270
    typedef QFlags<KUrl::CleanPathOption> CleanPathOptions;
 
271
    void                 cleanPath (const KUrl::CleanPathOption& = KUrl::SimplifyDirSeparators );
 
272
    void                 adjustPath (KUrl::AdjustPathOption);
 
273
    void                 setEncodedPathAndQuery (const QString&);
 
274
 
 
275
    enum EncodedPathAndQueryOption
 
276
    {
 
277
        PermitEmptyPath, 
 
278
        AvoidEmptyPath
 
279
    };
 
280
 
 
281
    typedef QFlags<KUrl::EncodedPathAndQueryOption> EncodedPathAndQueryOptions;
 
282
    QString              encodedPathAndQuery (KUrl::AdjustPathOption = KUrl::LeaveTrailingSlash , const KUrl::EncodedPathAndQueryOptions& = KUrl::PermitEmptyPath ) const;
 
283
    void                 setQuery (const QString&);
 
284
    QString              query () const;
 
285
    QString              ref () const;
 
286
    void                 setRef (const QString&);
 
287
    bool                 hasRef () const;
 
288
    QString              htmlRef () const;
 
289
    QString              encodedHtmlRef () const;
 
290
    void                 setHTMLRef (const QString&);
 
291
    bool                 hasHTMLRef () const;
 
292
    bool                 isLocalFile () const;
 
293
    void                 setFileEncoding (const QString&);
 
294
    QString              fileEncoding () const;
 
295
    bool                 hasSubUrl () const;
 
296
    void                 addPath (const QString&);
 
297
 
 
298
    enum QueryItemsOption
 
299
    {
 
300
        CaseInsensitiveKeys
 
301
    };
 
302
 
 
303
    typedef QFlags<KUrl::QueryItemsOption> QueryItemsOptions;
 
304
    QMap<QString, QString> queryItems (const KUrl::QueryItemsOptions& = 0) const;
 
305
    QString              queryItem (const QString&) const;
 
306
    void                 addQueryItem (const QString&, const QString&);
 
307
    void                 setFileName (const QString&);
 
308
 
 
309
    enum DirectoryOption
 
310
    {
 
311
        ObeyTrailingSlash, 
 
312
        AppendTrailingSlash, 
 
313
        IgnoreTrailingSlash
 
314
    };
 
315
 
 
316
    typedef QFlags<KUrl::DirectoryOption> DirectoryOptions;
 
317
    QString              fileName (const KUrl::DirectoryOptions& = KUrl::IgnoreTrailingSlash ) const;
 
318
    QString              directory (const KUrl::DirectoryOptions& = KUrl::IgnoreTrailingSlash ) const;
 
319
    void                 setDirectory (const QString&);
 
320
    bool                 cd (const QString&);
 
321
    QString              url (KUrl::AdjustPathOption = KUrl::LeaveTrailingSlash ) const;
 
322
    QString              prettyUrl (KUrl::AdjustPathOption = KUrl::LeaveTrailingSlash ) const;
 
323
    QString              pathOrUrl () const;
 
324
    QString              toMimeDataString () const;
 
325
    KUrl                 upUrl () const;
 
326
    bool                 operator == (const KUrl&) const;
 
327
    bool                 operator == (const QString&) const;
 
328
    bool                 operator != (const KUrl&) const;
 
329
    bool                 operator != (const QString&) const;
 
330
//ig                          operator QVariant () const;
 
331
    bool                 cmp (const KUrl&, bool = 0) const;
 
332
 
 
333
    enum EqualsOption
 
334
    {
 
335
        CompareWithoutTrailingSlash, 
 
336
        CompareWithoutFragment
 
337
    };
 
338
 
 
339
    typedef QFlags<KUrl::EqualsOption> EqualsOptions;
 
340
    bool                 equals (const KUrl&, const KUrl::EqualsOptions& = 0) const;
 
341
    bool                 isParentOf (const KUrl&) const;
 
342
    static List          split (const QString&);
 
343
    static List          split (const KUrl&);
 
344
    static KUrl          join (const List&);
 
345
    static KUrl          fromPath (const QString&);
 
346
    static KUrl          fromPathOrUrl (const QString&);
 
347
    static KUrl          fromMimeDataByteArray (const QByteArray&);
 
348
    void                 populateMimeData (QMimeData*, const KUrl::MetaDataMap& = KUrl::MetaDataMap (), KUrl::MimeDataFlags = KUrl::DefaultMimeDataFlags ) const;
 
349
    static QString       encode_string (const QString&);
 
350
    static QString       encode_string_no_slash (const QString&);
 
351
    static QString       decode_string (const QString&);
 
352
    static bool          isRelativeUrl (const QString&);
 
353
    static QString       relativeUrl (const KUrl&, const KUrl&);
 
354
    static QString       relativePath (const QString&, const QString&, bool* /Out/);
 
355
 
 
356
private:
 
357
//igx                          operator QString () const;
 
358
 
 
359
// Subclasses for QUrl
 
360
 
 
361
public:
 
362
%ConvertToSubClassCode
 
363
 
 
364
    if (dynamic_cast<KUrl*>(sipCpp))
 
365
        sipClass = sipClass_KUrl;
 
366
    else
 
367
        sipClass = NULL;
 
368
%End
 
369
 
 
370
 
 
371
};  // class KUrl
 
372
 
 
373
bool                 urlcmp (const QString&, const QString&);
 
374
bool                 urlcmp (const QString&, const QString&, const KUrl::EqualsOptions&);
 
375
uint                 qHash (const QString&);