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 
36 namespace Gnome
37 {
38 
39 namespace Vfs
40 {
41 
56 {
60 };
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 
91 class 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 
113 protected:
114  // Do not derive this. Gnome::Vfs::Uri can neither be constructed nor deleted.
115  Uri();
116  void operator delete(void*, size_t);
117 
118 private:
119  // noncopyable
120  Uri(const Uri&);
121  Uri& operator=(const Uri&);
122 
123 
124 public:
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 /*
317 GList* 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
428  FileSize get_volume_free_space() const throw(exception);
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 /*
439 class 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 
451 namespace Gnome
452 {
453 
454 namespace Vfs
455 {
456 
462 bool operator==(const Uri& lhs, const Uri& rhs);
463 
469 bool operator!=(const Uri& lhs, const Uri& rhs);
470 
471 
472 } // namespace Vfs
473 
474 } // namespace Gnome
475 
476 
477 namespace 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