2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGExtensions_NSURL_misc_H__
23 #define __NGExtensions_NSURL_misc_H__
25 #import <Foundation/NSObject.h> // required by gstep-base
26 #import <Foundation/NSURL.h>
27 #import <Foundation/NSString.h>
29 @interface NSURL(misc)
32 This method tries to construct the "shortest" path
33 between the two URLs. If the URLs are not in the same
34 namespace, -absoluteString is returned ...
36 - (NSString *)stringValueRelativeToURL:(NSURL *)_base;
39 This checks whether protocol, host, login match. That is,
40 checks whether it's possible to build a relative URL to
41 _url (whether self is in the same path namespace).
43 - (BOOL)isInSameNamespaceWithURL:(NSURL *)_url;
45 /* adding fragments and queries to a string ... */
46 - (NSString *)stringByAddingFragmentAndQueryToPath:(NSString *)_path;
50 @interface NSString(URLPathProcessing)
52 /* relative path processing (should never return an absolute path) */
56 should resolve to: "c.html"
58 Directories are a bit more difficult, eg:
63 - (NSString *)urlPathRelativeToSelf;
65 /* this is the same like the absolute path, only without a leading "/" .. */
66 - (NSString *)urlPathRelativeToRoot;
69 This can be used for URLs in the same namespace. It should
70 never return an absolute path (it only does in error conditions).
72 - (NSString *)urlPathRelativeToPath:(NSString *)_base;
76 #endif /* __NGExtensions_NSURL_misc_H__ */