libgnomevfsmm 2.26.0
uri.h
Go to the documentation of this file.
1// -*- c++ -*-
2// Generated by gtkmmproc -- DO NOT MODIFY!
3#ifndef _LIBGNOMEVFSMM_URI_H
4#define _LIBGNOMEVFSMM_URI_H
5
6
7#include <glibmm.h>
8
9/* $Id: uri.hg,v 1.20 2006/10/31 09:06:50 murrayc Exp $ */
10// -*- C++ -*- // this is for the .hg, I realize gensig puts one in
11
12/* Copyright 2003 gnome-vfsmm Development Team
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
30#include <libgnomevfsmm/enums.h>
32#include <libgnomevfs/gnome-vfs-uri.h>
33#include <libgnomevfs/gnome-vfs-ops.h>
34
35
36namespace Gnome
37{
38
39namespace Vfs
40{
41
61
64 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
65
68 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
69
72 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
73
76 { return static_cast<MakeURIDirs>(~static_cast<unsigned>(flags)); }
77
80 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
81
84 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
85
88 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
89
90
91class Uri
92{
93 public:
94#ifndef DOXYGEN_SHOULD_SKIP_THIS
95 typedef Uri CppObjectType;
96 typedef GnomeVFSURI BaseObjectType;
97#endif /* DOXYGEN_SHOULD_SKIP_THIS */
98
99
100 // For use with Glib::RefPtr<> only.
101 void reference() const;
102 void unreference() const;
103
105 GnomeVFSURI* gobj();
106
108 const GnomeVFSURI* gobj() const;
109
111 GnomeVFSURI* gobj_copy() const;
112
113protected:
114 // Do not derive this. Gnome::Vfs::Uri can neither be constructed nor deleted.
116 void operator delete(void*, size_t);
117
118private:
119 // noncopyable
120 Uri(const Uri&);
121 Uri& operator=(const Uri&);
122
123
124public:
125
130 static Glib::RefPtr<Uri> create(const Glib::ustring& uri);
131
132
137 Glib::RefPtr<Uri> resolve_relative(const Glib::ustring& relative_reference);
138
139
146 Glib::RefPtr<Uri> append_string(const Glib::ustring& uri_fragment);
147
154 Glib::RefPtr<Uri> append_path(const Glib::ustring& path);
155
162 Glib::RefPtr<Uri> append_file_name(const Glib::ustring& filename);
163
170 Glib::ustring to_string(URIHideOptions hide_options = URI_HIDE_NONE) const;
171
175 Glib::RefPtr<Uri> dup();
176
180 bool is_local() const;
181
185 bool has_parent() const;
186
190 Glib::RefPtr<Uri> get_parent();
191
195 Glib::RefPtr<const Uri> get_parent() const;
196
197 //TODO: GnomeVFSToplevelURI inherits from GnomeVFSUri, but they are not GObjects. That needs a little work.
198 //_WRAP_METHOD(GnomeVFSToplevelURI* get_toplevel(), gnome_vfs_uri_get_toplevel)
199 //_WRAP_METHOD(const GnomeVFSToplevelURI* get_toplevel() const, gnome_vfs_uri_get_toplevel)
200
201
205 Glib::ustring get_host_name() const;
206
210 Glib::ustring get_scheme() const;
211
215 guint get_host_port() const;
216
220 Glib::ustring get_user_name() const;
221
225 Glib::ustring get_password() const;
226
227
231 void set_host_name(const Glib::ustring& host_name);
232
237 void set_host_port(guint host_port);
238
242 void set_user_name(const Glib::ustring& user_name);
243
247 void set_password(const Glib::ustring& password);
248
249
258 bool equal(const Glib::RefPtr<const Uri>& uri) const;
259 //We wrap this as equal() as well, because operator== requires an operator*.
260
261
269 bool is_parent(const Glib::RefPtr<const Uri>& possible_child, bool recursive = true) const;
270
271
275 Glib::ustring get_path() const;
276
280 Glib::ustring get_fragment_identifier() const;
281
286 Glib::ustring extract_dirname() const;
287
298 Glib::ustring extract_short_name() const;
299
310 Glib::ustring extract_short_path_name() const;
311
312 //These are used for creating hashes for hash tables, apparently.
313 //I don't see the point of wrapping them.
314
315
316/*
317GList* gnome_vfs_uri_list_parse(const Glib::ustring& uri_list), )
318*/
319
320
327 static Glib::ustring make_full_from_relative(const Glib::ustring& base_uri, const Glib::ustring& relative_uri);
328
329
344 static Glib::ustring format_for_display(const Glib::ustring& uri);
345
356 static Glib::ustring make_from_input(const Glib::ustring& uri);
357
358 static Glib::ustring make_from_input(const Glib::ustring& uri, MakeURIDirs dirs);
359
366 static Glib::ustring make_canonical_strip_fragment(const Glib::ustring& uri);
367
375 static bool uris_match(const Glib::ustring& uri_1, const Glib::ustring& uri_2);
376
383 static Glib::ustring get_scheme(const Glib::ustring& uri);
384
395 static Glib::ustring make_from_shell_arg(const Glib::ustring& uri);
396
397
402 #ifdef GLIBMM_EXCEPTIONS_ENABLED
403 Glib::RefPtr<FileInfo> get_file_info(FileInfoOptions options = FILE_INFO_DEFAULT) const throw(exception);
404 #else
405 Glib::RefPtr<FileInfo> get_file_info(FileInfoOptions options, std::auto_ptr<Gnome::Vfs::exception>& error) const;
406 #endif
407
411 #ifdef GLIBMM_EXCEPTIONS_ENABLED
412 void create_symbolic_link(const Glib::ustring& target_reference) throw(exception);
413 #else
414 void create_symbolic_link(const Glib::ustring& target_reference, std::auto_ptr<Gnome::Vfs::exception>& error);
415 #endif
416
420 bool uri_exists() const;
421
427 #ifdef GLIBMM_EXCEPTIONS_ENABLED
429 #else
430 FileSize get_volume_free_space(std::auto_ptr<Gnome::Vfs::exception>& error) const;
431 #endif
432
433
434};
435
436
437//TODO: GnomeVFSToplevelURI inherits from GnomeVFSUri, but they are not GObjects. That needs a little work.
438/*
439class TopLevelUri : Uri
440{
441 //TODO: Constructors/memory-management so we can wrap a GnomeVFSToplevelURI* in this.
442 //TODO: member accessors?
443};
444*/
445
446
447} // namespace Vfs
448} // namespace Gnome
449
450
451namespace Gnome
452{
453
454namespace Vfs
455{
456
462bool operator==(const Uri& lhs, const Uri& rhs);
463
469bool operator!=(const Uri& lhs, const Uri& rhs);
470
471
472} // namespace Vfs
473
474} // namespace Gnome
475
476
477namespace Glib
478{
479
488 Glib::RefPtr<Gnome::Vfs::Uri> wrap(GnomeVFSURI* object, bool take_copy = false);
489
490} // namespace Glib
491
492
493#endif /* _LIBGNOMEVFSMM_URI_H */
494
Definition uri.h:92
Glib::RefPtr< Uri > append_string(const Glib::ustring &uri_fragment)
Create a new Uri object by appending uri_fragment to this Uri object.
Glib::RefPtr< Uri > resolve_relative(const Glib::ustring &relative_reference)
Create a new Uri from relative_reference to this object.
Glib::ustring get_scheme() const
Retrieve this object's scheme.
bool operator!=(const Uri &lhs, const Uri &rhs)
Glib::ustring get_fragment_identifier() const
Retrieve the optional fragment identifier for this Uri.
void reference() const
void unreference() const
Glib::ustring get_host_name() const
Retrieve this object's host name.
bool has_parent() const
Check if this Uri has a parent or not.
static Glib::ustring get_scheme(const Glib::ustring &uri)
Retrieve the scheme used in uri.
Glib::ustring get_path() const
Retrieve full path name for this Uri.
Glib::ustring get_user_name() const
Retrieve the user name in this object.
static Glib::ustring make_from_shell_arg(const Glib::ustring &uri)
Similar to gnome_vfs_make_uri_from_input, except that:
static bool uris_match(const Glib::ustring &uri_1, const Glib::ustring &uri_2)
Compare two URIs.
Glib::RefPtr< Uri > append_path(const Glib::ustring &path)
Create a new Uri object by appending path to this Uri object.
void set_password(const Glib::ustring &password)
Set password as the password for this Uri.
Glib::RefPtr< Uri > append_file_name(const Glib::ustring &filename)
Create a new Uri object by appending filename to this Uri object.
guint get_host_port() const
Retrieve this object's host port number.
void set_host_port(guint host_port)
Set the host port number in this Uri.
Glib::RefPtr< FileInfo > get_file_info(FileInfoOptions options=FILE_INFO_DEFAULT) const
Retrieve the file info for this Uri.
static Glib::ustring make_canonical_strip_fragment(const Glib::ustring &uri)
If the uri passed contains a fragment (anything after a '#') strips if, then makes the URI canonical.
Glib::RefPtr< const Uri > get_parent() const
Retrieve this object's parent Uri.
GnomeVFSURI * gobj_copy() const
Provides access to the underlying C instance. The caller is responsible for unrefing it....
void set_user_name(const Glib::ustring &user_name)
Set user_name as the user name for this Uri.
Glib::ustring extract_dirname() const
Extract the name of the directory in which the file pointed to by this Uri is stored as a new string.
static Glib::RefPtr< Uri > create(const Glib::ustring &uri)
Create a new Uri from the text string uri.
Glib::RefPtr< Uri > get_parent()
Retrieve this object's parent Uri.
bool operator==(const Uri &lhs, const Uri &rhs)
const GnomeVFSURI * gobj() const
Provides access to the underlying C instance.
static Glib::ustring format_for_display(const Glib::ustring &uri)
Filter, modify, unescape and change URIs to make them appropriate to display to users.
bool equal(const Glib::RefPtr< const Uri > &uri) const
Compare a and b.
static Glib::ustring make_from_input(const Glib::ustring &uri, MakeURIDirs dirs)
Glib::RefPtr< Gnome::Vfs::Uri > wrap(GnomeVFSURI *object, bool take_copy=false)
A Glib::wrap() method for this object.
bool uri_exists() const
Check if this Uri points to an existing entity.
void create_symbolic_link(const Glib::ustring &target_reference)
Creates a symbolic link from this Uri to target_reference.
FileSize get_volume_free_space() const
This only works for URIs with the file: scheme.
Glib::ustring to_string(URIHideOptions hide_options=URI_HIDE_NONE) const
Translate this Uri into a printable string.
void set_host_name(const Glib::ustring &host_name)
Set host_name as the host name accessed by this Uri.
static Glib::ustring make_from_input(const Glib::ustring &uri)
Takes a user input path/URI and makes a valid URI out of it.
Glib::ustring get_password() const
Retrieve the password for this object.
bool is_parent(const Glib::RefPtr< const Uri > &possible_child, bool recursive=true) const
Check if possible_child is contained by this Uri.
GnomeVFSURI * gobj()
Provides access to the underlying C instance.
Glib::ustring extract_short_path_name() const
Retrieve base file name for this Uri, ignoring any trailing path separators.
static Glib::ustring make_full_from_relative(const Glib::ustring &base_uri, const Glib::ustring &relative_uri)
Returns a full Uri given a full base URI, and a secondary URI which may be relative.
Glib::ustring extract_short_name() const
Retrieve base file name for this Uri, ignoring any trailing path separators.
bool is_local() const
Check if this Uri is a local (native) file system.
Glib::RefPtr< Uri > dup()
Duplicate this Uri.
Definition exception.h:34
FileInfoOptions
Definition enums.h:55
FileInfoOptions & operator|=(FileInfoOptions &lhs, FileInfoOptions rhs)
Definition enums.h:81
FileInfoOptions & operator&=(FileInfoOptions &lhs, FileInfoOptions rhs)
Definition enums.h:85
FileInfoOptions operator|(FileInfoOptions lhs, FileInfoOptions rhs)
Definition enums.h:65
URIHideOptions
Definition enums.h:217
FileInfoOptions operator&(FileInfoOptions lhs, FileInfoOptions rhs)
Definition enums.h:69
FileInfoOptions & operator^=(FileInfoOptions &lhs, FileInfoOptions rhs)
Definition enums.h:89
FileInfoOptions operator~(FileInfoOptions flags)
Definition enums.h:77
FileInfoOptions operator^(FileInfoOptions lhs, FileInfoOptions rhs)
Definition enums.h:73
MakeURIDirs
Definition uri.h:56
@ FILE_INFO_DEFAULT
Definition enums.h:56
@ URI_HIDE_NONE
Definition enums.h:218
@ MAKE_URI_DIR_CURRENT
Definition uri.h:59
@ MAKE_URI_DIR_NONE
Definition uri.h:57
@ MAKE_URI_DIR_HOMEDIR
Definition uri.h:58
Definition address.h:120
GnomeVFSFileSize FileSize
Definition types.h:29
Definition address.h:37