glibmm r506 - in trunk: . docs/reference gio/src glib/src



Author: murrayc
Date: Fri Jan 11 15:23:14 2008
New Revision: 506
URL: http://svn.gnome.org/viewvc/glibmm?rev=506&view=rev

Log:
2008-01-11  Murray Cumming  <murrayc murrayc com>

* gio/src/appinfo.hg: Added class documentation.
* gio/src/asyncresult.hg:
* gio/src/cancellable.hg:
* gio/src/drive.hg:
* gio/src/file.hg:
* gio/src/fileattribute.hg:
* gio/src/fileenumerator.hg:
* gio/src/fileicon.hg:
* gio/src/fileinfo.hg:
* gio/src/fileinputstream.hg:
* gio/src/fileoutputstream.hg:
* gio/src/icon.hg:
* gio/src/inputstream.hg:
* gio/src/loadableicon.hg:
* gio/src/mountoperation.hg:
* gio/src/outputstream.hg:
* gio/src/seekable.hg:
* gio/src/simpleasyncresult.hg:
* gio/src/volume.hg: Added @newin2p16 to 
the documentation.

* glib/src/Makefile_list_of_hg.am_fragment:
* glib/src/uriutils.ccg:
* glib/src/uriutils.hg: Added wrappers of (some) of 
these new g_uri_* functions. Not yet documented.

Added:
   trunk/glib/src/uriutils.ccg
      - copied, changed from r504, /trunk/glib/src/fileutils.ccg
   trunk/glib/src/uriutils.hg
      - copied, changed from r504, /trunk/glib/src/fileutils.hg
Modified:
   trunk/ChangeLog
   trunk/docs/reference/Doxyfile.in
   trunk/gio/src/appinfo.hg
   trunk/gio/src/asyncresult.hg
   trunk/gio/src/cancellable.hg
   trunk/gio/src/drive.hg
   trunk/gio/src/file.hg
   trunk/gio/src/fileattribute.hg
   trunk/gio/src/fileenumerator.hg
   trunk/gio/src/fileicon.hg
   trunk/gio/src/fileinfo.hg
   trunk/gio/src/fileinputstream.hg
   trunk/gio/src/fileoutputstream.hg
   trunk/gio/src/icon.hg
   trunk/gio/src/inputstream.hg
   trunk/gio/src/loadableicon.hg
   trunk/gio/src/mountoperation.hg
   trunk/gio/src/outputstream.hg
   trunk/gio/src/seekable.hg
   trunk/gio/src/simpleasyncresult.hg
   trunk/gio/src/volume.hg
   trunk/glib/src/Makefile_list_of_hg.am_fragment
   trunk/glib/src/fileutils.ccg

Modified: trunk/docs/reference/Doxyfile.in
==============================================================================
--- trunk/docs/reference/Doxyfile.in	(original)
+++ trunk/docs/reference/Doxyfile.in	Fri Jan 11 15:23:14 2008
@@ -155,6 +155,8 @@
 ALIASES                += "newin2p12=\xrefitem newin2p12s \"Since glibmm 2.12\" \"New API since glibmm 2.12\""
 ALIASES                += "newin2p14=\xrefitem newin2p14s \"Since glibmm 2.14\" \"New API since glibmm 2.14\""
 ALIASES                += "newin2p16=\xrefitem newin2p16s \"Since glibmm 2.16\" \"New API since glibmm 2.16\""
+ALIASES                += "newin2p18=\xrefitem newin2p18s \"Since glibmm 2.18\" \"New API since glibmm 2.18\""
+ALIASES                += "newin2p20=\xrefitem newin2p20s \"Since glibmm 2.20\" \"New API since glibmm 2.20\""
 
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
 # only. Doxygen will then generate output that is more tailored for C. 

Modified: trunk/gio/src/appinfo.hg
==============================================================================
--- trunk/gio/src/appinfo.hg	(original)
+++ trunk/gio/src/appinfo.hg	Fri Jan 11 15:23:14 2008
@@ -39,6 +39,11 @@
 
 class AppInfo;
 
+/** This is used to handle, for instance, startup notification and launching of the new application on the same screen as the launching window.
+ * See also AppInfo.
+ *
+ * @newin2p16
+ */
 class AppLaunchContext : public Glib::Object
 {
   _CLASS_GOBJECT(AppLaunchContext, GAppLaunchContext, G_APP_LAUNCH_CONTEXT, Glib::Object, GObject)
@@ -49,16 +54,20 @@
 public:
   _WRAP_CREATE()
 
-  _WRAP_METHOD(std::string get_display(const Glib::RefPtr<AppInfo>& info,
-                                       const Glib::ListHandle<std::string>& files),
+  _WRAP_METHOD(std::string get_display(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle<std::string>& files),
                g_app_launch_context_get_display)
-  _WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr<AppInfo>& info,
-                                                 const Glib::ListHandle<std::string>& files),
+  _WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle<std::string>& files),
                g_app_launch_context_get_startup_notify_id)
   _WRAP_METHOD(void launch_failed(const std::string& startup_notify_id),
                g_app_launch_context_launch_failed)
 };
 
+/** Application information, to describe applications installed on the system, 
+ * and launch them.
+ * See also AppLaunchContext.
+ *
+ * @newin2p16
+ */
 class AppInfo : public Glib::Interface
 {
   _CLASS_INTERFACE(AppInfo, GAppInfo, G_APP_INFO, GAppInfoIface)
@@ -78,6 +87,8 @@
   _IGNORE(g_app_info_dup)
   _IGNORE(g_app_info_equal)
 
+  // TODO: Decide whether this is a good idea. murrayc
+  // TODO: Documentation.
   // I declare this as virtual so that it is possible to override
   // the method in possible derived classes. markoa
   virtual bool equal(const Glib::RefPtr<AppInfo>& other) const;
@@ -122,14 +133,15 @@
 
   static Glib::ListHandle< Glib::RefPtr<AppInfo> > get_all_for_type(const std::string& content_type);
 
-  static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type,
-                                                    bool must_support_uris = true);
+  static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type, bool must_support_uris = true);
 
   static Glib::RefPtr<AppInfo> get_default_for_uri_scheme(const std::string& uri_scheme);
 
   //TODO: vfuncs?
 };
 
+//TODO: Probably remove these (and others elsewhere) because they will lead to confusion with the regular RefPtr operator==. murrayc.
+
 /** @relates Gio::AppInfo */
 inline bool operator==(const Glib::RefPtr<AppInfo>& lhs, const Glib::RefPtr<AppInfo>& rhs)
 { return lhs->equal(rhs); }
@@ -139,3 +151,4 @@
 { return ! lhs->equal(rhs); }
 
 } // namespace Gio
+

Modified: trunk/gio/src/asyncresult.hg
==============================================================================
--- trunk/gio/src/asyncresult.hg	(original)
+++ trunk/gio/src/asyncresult.hg	Fri Jan 11 15:23:14 2008
@@ -39,6 +39,8 @@
  * @code
  * void on_async_ready(Glib::RefPtr<AsyncResult>& result);
  * @endcode
+ *
+ * @newin2p16
  */
 typedef sigc::slot<void, Glib::RefPtr<AsyncResult>& > SlotAsyncReady;
 
@@ -96,6 +98,8 @@
  *
  * Some ascynchronous operations are implemented using synchronous calls. These are run in a separate GThread, but otherwise they are sent 
  * to the Main Event Loop and processed in an idle function. So, if you truly need asynchronous operations, make sure to initialize GThread.
+ *
+ * @newin2p16
  */
 class AsyncResult : public Glib::Interface
 {

Modified: trunk/gio/src/cancellable.hg
==============================================================================
--- trunk/gio/src/cancellable.hg	(original)
+++ trunk/gio/src/cancellable.hg	Fri Jan 11 15:23:14 2008
@@ -30,6 +30,8 @@
 
 /** Allows actions to be cancelled.
  * Cancellable is a thread-safe operation cancellation stack used throughout GIO to allow for cancellation of synchronous and asynchronous operations.
+ *
+ * @newin2p16
  */
 class Cancellable : public Glib::Object
 {

Modified: trunk/gio/src/drive.hg
==============================================================================
--- trunk/gio/src/drive.hg	(original)
+++ trunk/gio/src/drive.hg	Fri Jan 11 15:23:14 2008
@@ -40,6 +40,8 @@
  *
  * If the Gio::Drive reports that media isn't automatically detected, one can poll for media; typically one should not do this periodically as a 
  * poll for media operation is potententially expensive and may spin up the drive, creating noise.
+ *
+ * @newin2p16
  */
 class Drive : public Glib::Interface
 {

Modified: trunk/gio/src/file.hg
==============================================================================
--- trunk/gio/src/file.hg	(original)
+++ trunk/gio/src/file.hg	Fri Jan 11 15:23:14 2008
@@ -62,6 +62,8 @@
  * One notable feature of Gio::Files are entity tags, or "etags" for short. Entity tags are somewhat like a more abstract version of the 
  * traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. 
  * See the HTTP 1.1 specification for HTTP Etag headers, which are a very similar concept.
+ *
+ * @newin2p16
  */ 
 class File : public Glib::Interface
 {

Modified: trunk/gio/src/fileattribute.hg
==============================================================================
--- trunk/gio/src/fileattribute.hg	(original)
+++ trunk/gio/src/fileattribute.hg	Fri Jan 11 15:23:14 2008
@@ -35,6 +35,8 @@
 // TODO: Use _CLASS_GENERIC?
 
 /** Information about a specific attribute - see FileAttributeInfoList.
+ *
+ * @newin2p16
  */
 class FileAttributeInfo
 {
@@ -75,6 +77,8 @@
  * the user id for a given file).
  *
  * See http://library.gnome.org/devel/gio/unstable/gio-GFileAttribute.html for the list of default namespaces and the list of default keys.
+ *
+ * @newin2p16
  */
 class FileAttributeInfoList
 {

Modified: trunk/gio/src/fileenumerator.hg
==============================================================================
--- trunk/gio/src/fileenumerator.hg	(original)
+++ trunk/gio/src/fileenumerator.hg	Fri Jan 11 15:23:14 2008
@@ -44,6 +44,8 @@
  *
  * To close a Gio::FileEnumerator, use FileEnumerator::close(), or its asynchronous version, close_async(). Once a FileEnumerator is closed, 
  * no further actions may be performed on it.
+ *
+ * @newin2p16
  */
 class FileEnumerator : public Glib::Object
 {

Modified: trunk/gio/src/fileicon.hg
==============================================================================
--- trunk/gio/src/fileicon.hg	(original)
+++ trunk/gio/src/fileicon.hg	Fri Jan 11 15:23:14 2008
@@ -31,6 +31,8 @@
 {
 
 /** FileIcon specifies an icon by pointing to an image file to be used as icon.
+ *
+ * @newin2p16
  */
 class FileIcon
 : public Glib::Object,

Modified: trunk/gio/src/fileinfo.hg
==============================================================================
--- trunk/gio/src/fileinfo.hg	(original)
+++ trunk/gio/src/fileinfo.hg	Fri Jan 11 15:23:14 2008
@@ -36,6 +36,8 @@
 //TODO: attribute strings
 
 /** FileAttributeMatcher allows for searching through a FileInfo for attributes.
+ *
+ * @newin2p16
  */
 class FileAttributeMatcher
 {

Modified: trunk/gio/src/fileinputstream.hg
==============================================================================
--- trunk/gio/src/fileinputstream.hg	(original)
+++ trunk/gio/src/fileinputstream.hg	Fri Jan 11 15:23:14 2008
@@ -39,6 +39,8 @@
  * provided the filesystem of the file allows it. In addition to the generic Seekable API, FileInputStream has its own API 
  * for seeking and positioning. To find the position of a file input stream, use tell(). To find out if a file input stream supports 
  * seeking, use can_seek(). To position a file input stream, use seek().
+ *
+ * @newin2p16
  */
 class FileInputStream 
 : public Gio::InputStream, 

Modified: trunk/gio/src/fileoutputstream.hg
==============================================================================
--- trunk/gio/src/fileoutputstream.hg	(original)
+++ trunk/gio/src/fileoutputstream.hg	Fri Jan 11 15:23:14 2008
@@ -43,6 +43,8 @@
  * file output stream, use seek(). To find out if a file output stream supports 
  * truncating, use can_truncate(). To truncate a file output stream, use 
  * truncate().
+ *
+ * @newin2p16
  */
 class FileOutputStream
 : public OutputStream,

Modified: trunk/gio/src/icon.hg
==============================================================================
--- trunk/gio/src/icon.hg	(original)
+++ trunk/gio/src/icon.hg	Fri Jan 11 15:23:14 2008
@@ -34,6 +34,8 @@
  * To obtain a hash of an Icon instance, see hash().
  *
  * To check if two Icon instances are equal, see equal().
+ *
+ * @newin2p16
  */
 class Icon : public Glib::Interface
 {

Modified: trunk/gio/src/inputstream.hg
==============================================================================
--- trunk/gio/src/inputstream.hg	(original)
+++ trunk/gio/src/inputstream.hg	Fri Jan 11 15:23:14 2008
@@ -31,6 +31,8 @@
 {
 
 /** Base class for implementing streaming input.
+ *
+ * @newin2p16
  */
 class InputStream : public Glib::Object
 {

Modified: trunk/gio/src/loadableicon.hg
==============================================================================
--- trunk/gio/src/loadableicon.hg	(original)
+++ trunk/gio/src/loadableicon.hg	Fri Jan 11 15:23:14 2008
@@ -30,6 +30,8 @@
 //TODO: Derive from Icon?
 
 /** Extends the Icon interface and adds the ability to load icons from streams.
+ *
+ * @newin2p16
  */
 class LoadableIcon : public Glib::Interface
 {

Modified: trunk/gio/src/mountoperation.hg
==============================================================================
--- trunk/gio/src/mountoperation.hg	(original)
+++ trunk/gio/src/mountoperation.hg	Fri Jan 11 15:23:14 2008
@@ -40,6 +40,8 @@
  * WebDAV.
  *
  * Developers should instantiate a subclass of this that implements all the various callbacks to show the required dialogs.
+ *
+ * @newin2p16
  */
 class MountOperation : public Glib::Object
 {

Modified: trunk/gio/src/outputstream.hg
==============================================================================
--- trunk/gio/src/outputstream.hg	(original)
+++ trunk/gio/src/outputstream.hg	Fri Jan 11 15:23:14 2008
@@ -33,6 +33,8 @@
 _WRAP_ENUM(OutputStreamSpliceFlags, GOutputStreamSpliceFlags, NO_GTYPE)
 
 /** Base class for implementing streaming output.
+ *
+ * @newin2p16
  */
 class OutputStream : public Glib::Object
 {

Modified: trunk/gio/src/seekable.hg
==============================================================================
--- trunk/gio/src/seekable.hg	(original)
+++ trunk/gio/src/seekable.hg	Fri Jan 11 15:23:14 2008
@@ -29,6 +29,8 @@
 
 /** Stream seeking interface.
  * Seekable is implemented by streams (implementations of InputStream or OutputStream) that support seeking.
+ *
+ * @newin2p16
  */
 class Seekable : public Glib::Interface
 {

Modified: trunk/gio/src/simpleasyncresult.hg
==============================================================================
--- trunk/gio/src/simpleasyncresult.hg	(original)
+++ trunk/gio/src/simpleasyncresult.hg	Fri Jan 11 15:23:14 2008
@@ -60,6 +60,8 @@
  * 
  * Likewise, to get the result of an asynchronous function, get_op_res_gpointer(), get_op_res_bool(), and 
  * get_op_res_gssize() are provided, getting the operation's result as a gpointer, bool, and gssize, respectively.
+ *
+ * @newin2p16
  */
 class SimpleAsyncResult : public Glib::Object, public AsyncResult
 {

Modified: trunk/gio/src/volume.hg
==============================================================================
--- trunk/gio/src/volume.hg	(original)
+++ trunk/gio/src/volume.hg	Fri Jan 11 15:23:14 2008
@@ -47,6 +47,8 @@
  * The callback will be fired when the operation has resolved (either with success or failure), and a AsyncReady structure will be passed to the callback. 
  * That callback should then call g_volume_mount_finish() with the GVolume instance and the GAsyncReady data to see if the operation was completed 
  * successfully. If an error is present when finish() is called, then it will be filled with any error information.
+ *
+ * @newin2p16
  */
 class Volume : public Glib::Interface
 {

Modified: trunk/glib/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- trunk/glib/src/Makefile_list_of_hg.am_fragment	(original)
+++ trunk/glib/src/Makefile_list_of_hg.am_fragment	Fri Jan 11 15:23:14 2008
@@ -5,6 +5,8 @@
 
 files_posix_hg =
 files_win32_hg =
-files_general_hg = convert.hg date.hg fileutils.hg iochannel.hg keyfile.hg markup.hg module.hg optioncontext.hg optionentry.hg optiongroup.hg regex.hg shell.hg spawn.hg thread.hg unicode.hg
+files_general_hg = convert.hg date.hg fileutils.hg iochannel.hg keyfile.hg markup.hg \
+                   module.hg optioncontext.hg optionentry.hg optiongroup.hg regex.hg \
+                   shell.hg spawn.hg thread.hg unicode.hg uriutils.hg 
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment 

Modified: trunk/glib/src/fileutils.ccg
==============================================================================
--- trunk/glib/src/fileutils.ccg	(original)
+++ trunk/glib/src/fileutils.ccg	Fri Jan 11 15:23:14 2008
@@ -52,7 +52,7 @@
 std::string Dir::read_name()
 {
   const char *const name = g_dir_read_name(gobject_);
-  return (name) ? std::string(name) : std::string();
+  return Glib::convert_const_gchar_ptr_to_stdstring(name);
 }
 
 void Dir::rewind()

Copied: trunk/glib/src/uriutils.ccg (from r504, /trunk/glib/src/fileutils.ccg)
==============================================================================
--- /trunk/glib/src/fileutils.ccg	(original)
+++ trunk/glib/src/uriutils.ccg	Fri Jan 11 15:23:14 2008
@@ -18,167 +18,27 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glib/gdir.h>
-#include <glib/gfileutils.h>
-#include <glib/gstrfuncs.h>
+#include <glib/gurifuncs.h>
 #include <glibmm/utility.h>
 
-
 namespace Glib
 {
 
-/**** Glib::Dir ************************************************************/
-
-Dir::Dir(const std::string& path)
-{
-  GError* error = 0;
-  gobject_ = g_dir_open(path.c_str(), 0, &error);
-
-  if(error)
-    Glib::Error::throw_exception(error);
-}
-
-Dir::Dir(GDir* gobject)
-:
-  gobject_ (gobject)
-{}
-
-Dir::~Dir()
-{
-  if(gobject_)
-    g_dir_close(gobject_);
-}
-
-std::string Dir::read_name()
-{
-  const char *const name = g_dir_read_name(gobject_);
-  return (name) ? std::string(name) : std::string();
-}
-
-void Dir::rewind()
-{
-  g_dir_rewind(gobject_);
-}
-
-void Dir::close()
-{
-  if(gobject_)
-  {
-    g_dir_close(gobject_);
-    gobject_ = 0;
-  }
-}
-
-DirIterator Dir::begin()
-{
-  g_dir_rewind(gobject_);
-  return DirIterator(gobject_, g_dir_read_name(gobject_));
-}
-
-DirIterator Dir::end()
-{
-  return DirIterator(gobject_, 0);
-}
-
-
-/**** Glib::DirIterator ****************************************************/
-
-DirIterator::DirIterator()
-:
-  gobject_ (0),
-  current_ (0)
-{}
-
-DirIterator::DirIterator(GDir* gobject, const char* current)
-:
-  gobject_ (gobject),
-  current_ (current)
-{}
-
-std::string DirIterator::operator*() const
-{
-  return (current_) ? std::string(current_) : std::string();
-}
-
-DirIterator& DirIterator::operator++()
+std::string uri_unescape_string(const std::string& escaped_string, const std::string& illegal_characters)
 {
-  current_ = g_dir_read_name(gobject_);
-  return *this;
+  const gchar* cresult = g_uri_unescape_string(escaped_string.c_str(), illegal_characters.c_str());
+  return Glib::convert_const_gchar_ptr_to_stdstring(cresult);
 }
 
-void DirIterator::operator++(int)
+std::string uri_get_scheme(const std::string& uri)
 {
-  current_ = g_dir_read_name(gobject_);
+  return Glib::convert_const_gchar_ptr_to_stdstring( g_uri_get_scheme(uri.c_str()) );
 }
 
-bool DirIterator::operator==(const DirIterator& rhs) const
+std::string uri_escape_string(const std::string& unescaped, const std::string& reserved_chars_allowed, bool allow_utf8)
 {
-  return (current_ == rhs.current_);
-}
-
-bool DirIterator::operator!=(const DirIterator& rhs) const
-{
-  return (current_ != rhs.current_);
-}
-
-
-bool file_test(const std::string& filename, FileTest test)
-{
-  return g_file_test(filename.c_str(), static_cast<GFileTest>(unsigned(test)));
-}
-
-int mkstemp(std::string& filename_template)
-{
-  const ScopedPtr<char> buf (g_strndup(filename_template.data(), filename_template.size()));
-  const int fileno = g_mkstemp(buf.get());
-
-  filename_template = buf.get();
-  return fileno;
-}
-
-int file_open_tmp(std::string& name_used, const std::string& prefix)
-{
-  std::string basename_template (prefix);
-  basename_template += "XXXXXX"; // this sillyness shouldn't be in the interface
-
-  GError* error = 0;
-  ScopedPtr<char> buf_name_used;
-
-  const int fileno = g_file_open_tmp(basename_template.c_str(), buf_name_used.addr(), &error);
-
-  if(error)
-    Glib::Error::throw_exception(error);
-
-  name_used = buf_name_used.get();
-  return fileno;
-}
-
-int file_open_tmp(std::string& name_used)
-{
-  GError* error = 0;
-  ScopedPtr<char> buf_name_used;
-
-  const int fileno = g_file_open_tmp(0, buf_name_used.addr(), &error);
-
-  if(error)
-    Glib::Error::throw_exception(error);
-
-  name_used = buf_name_used.get();
-  return fileno;
-}
-
-std::string file_get_contents(const std::string& filename)
-{
-  ScopedPtr<char> contents;
-  gsize   length = 0;
-  GError* error  = 0;
-
-  g_file_get_contents(filename.c_str(), contents.addr(), &length, &error);
-
-  if(error)
-    Glib::Error::throw_exception(error);
-
-  return std::string(contents.get(), length);
+  const gchar* cresult = g_uri_escape_string(unescaped.c_str(), reserved_chars_allowed.c_str(), allow_utf8);
+  return Glib::convert_const_gchar_ptr_to_stdstring(cresult);
 }
 
 } // namespace Glib

Copied: trunk/glib/src/uriutils.hg (from r504, /trunk/glib/src/fileutils.hg)
==============================================================================
--- /trunk/glib/src/fileutils.hg	(original)
+++ trunk/glib/src/uriutils.hg	Fri Jan 11 15:23:14 2008
@@ -19,382 +19,43 @@
 
 _DEFS(glibmm,glib)
 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-extern "C" { typedef struct _GDir GDir; }
-#endif
-
-#include <iterator>
 #include <string>
 
 #include <glibmmconfig.h>
-#include <glibmm/error.h>
 
-GLIBMM_USING_STD(input_iterator_tag)
 GLIBMM_USING_STD(string)
 
-
 namespace Glib
 {
 
-_WRAP_ENUM(FileTest, GFileTest, NO_GTYPE)
-
-/** @defgroup FileUtils File Utilities
- * Various file-related classes and functions.
- */
-
-/** Exception class for file-related errors.
- * @ingroup FileUtils
- */
-_WRAP_GERROR(FileError, GFileError, G_FILE_ERROR, NO_GTYPE,
-    s#^EXIST$#EXISTS#,
-    s#^ISDIR$#IS_DIRECTORY#,
-    s#^ACCES$#ACCESS_DENIED#,
-    s#^NAMETOOLONG$#NAME_TOO_LONG#,
-    s#^NOENT$#NO_SUCH_ENTITY#,
-    s#^NOTDIR$#NOT_DIRECTORY#,
-    s#^NXIO$#NO_SUCH_DEVICE#,
-    s#^NODEV$#NOT_DEVICE#,
-    s#^ROFS$#READONLY_FILESYSTEM#,
-    s#^TXTBSY$#TEXT_FILE_BUSY#,
-    s#^FAULT$#FAULTY_ADDRESS#,
-    s#^LOOP$#SYMLINK_LOOP#,
-    s#^NOSPC$#NO_SPACE_LEFT#,
-    s#^NOMEM$#NOT_ENOUGH_MEMORY#,
-    s#^MFILE$#TOO_MANY_OPEN_FILES#,
-    s#^NFILE$#FILE_TABLE_OVERFLOW#,
-    s#^BADF$#BAD_FILE_DESCRIPTOR#,
-    s#^INVAL$#INVALID_ARGUMENT#,
-    s#^PIPE$#BROKEN_PIPE#,
-    s#^AGAIN$#TRYAGAIN#,
-    s#^INTR$#INTERRUPTED#,
-    s#^IO$#IO_ERROR#,
-    s#^PERM$#NOT_OWNER#
-)
-
-/** @enum FileError::Code
- * Values corresponding to <tt>errno</tt> codes returned from file operations
- * on UNIX.
- * Unlike <tt>errno</tt> codes, FileError::Code values are available on all
- * systems, even Windows. The exact meaning of each code depends on what sort
- * of file operation you were performing; the UNIX documentation gives more
- * details.  The following error code descriptions come from the GNU C Library
- * manual, and are under the copyright of that manual.
- *
- * It's not very portable to make detailed assumptions about exactly which
- * errors will be returned from a given operation. Some errors don't occur on
- * some systems, etc., sometimes there are subtle differences in when a system
- * will report a given error, etc.
- */
-
-/** @var FileError::Code FileError::EXISTS
- * <tt>(EEXIST)</tt> Operation not permitted; only the owner of the file (or
- * other resource) or processes with special privileges can perform the operation.
- * <br><br>
- */
-/** @var FileError::Code FileError::IS_DIRECTORY
- * <tt>(EISDIR)</tt> File is a directory; you cannot open a directory for writing,
- * or create or remove hard links to it.
- * <br><br>
- */
-/** @var FileError::Code FileError::ACCESS_DENIED
- * <tt>(EACCES)</tt> Permission denied; the file permissions do not allow the
- * attempted operation.
- * <br><br>
- */
-/** @var FileError::Code FileError::NAME_TOO_LONG
- * <tt>(ENAMETOOLONG)</tt> Filename too long.
- * <br><br>
- */
-/** @var FileError::Code FileError::NO_SUCH_ENTITY
- * <tt>(ENOENT)</tt> No such file or directory.  This is a "file doesn't exist"
- * error for ordinary files that are referenced in contexts where they are expected
- * to already exist.
- * <br><br>
- */
-/** @var FileError::Code FileError::NOT_DIRECTORY
- * <tt>(ENOTDIR)</tt> A file that isn't a directory was specified when a directory
- * is required.
- * <br><br>
- */
-/** @var FileError::Code FileError::NO_SUCH_DEVICE
- * <tt>(ENXIO)</tt> No such device or address.  The system tried to use the device
- * represented by a file you specified, and it couldn't find the device. This can
- * mean that the device file was installed incorrectly, or that the physical device
- * is missing or not correctly attached to the computer.
- * <br><br>
- */
-/** @var FileError::Code FileError::NOT_DEVICE
- * <tt>(ENODEV)</tt> This file is of a type that doesn't support mapping.
- * <br><br>
- */
-/** @var FileError::Code FileError::READONLY_FILESYSTEM
- * <tt>(EROFS)</tt> The directory containing the new link can't be modified
- * because it's on a read-only file system.
- * <br><br>
- */
-/** @var FileError::Code FileError::TEXT_FILE_BUSY
- * <tt>(ETXTBSY)</tt> Text file busy.
- * <br><br>
- */
-/** @var FileError::Code FileError::FAULTY_ADDRESS
- * <tt>(EFAULT)</tt> You passed in a pointer to bad memory.  (Glib won't
- * reliably return this, don't pass in pointers to bad memory.)
- * <br><br>
- */
-/** @var FileError::Code FileError::SYMLINK_LOOP
- * <tt>(ELOOP)</tt> Too many levels of symbolic links were encountered in
- * looking up a file name.  This often indicates a cycle of symbolic links.
- * <br><br>
- */
-/** @var FileError::Code FileError::NO_SPACE_LEFT
- * <tt>(ENOSPC)</tt> No space left on device; write operation on a file failed
- * because the disk is full.
- * <br><br>
- */
-/** @var FileError::Code FileError::NOT_ENOUGH_MEMORY
- * <tt>(ENOMEM)</tt> No memory available.  The system cannot allocate more
- * virtual memory because its capacity is full.
- * <br><br>
- */
-/** @var FileError::Code FileError::TOO_MANY_OPEN_FILES
- * <tt>(EMFILE)</tt> The current process has too many files open and can't
- * open any more.  Duplicate descriptors do count toward this limit.
- * <br><br>
- */
-/** @var FileError::Code FileError::FILE_TABLE_OVERFLOW
- * <tt>(ENFILE)</tt> There are too many distinct file openings in the
- * entire system.
- * <br><br>
- */
-/** @var FileError::Code FileError::BAD_FILE_DESCRIPTOR
- * <tt>(EBADF)</tt> Bad file descriptor; for example, I/O on a descriptor
- * that has been closed or reading from a descriptor open only for writing
- * (or vice versa).
- * <br><br>
- */
-/** @var FileError::Code FileError::INVALID_ARGUMENT
- * <tt>(EINVAL)</tt> Invalid argument. This is used to indicate various kinds
- * of problems with passing the wrong argument to a library function.
- * <br><br>
- */
-/** @var FileError::Code FileError::BROKEN_PIPE
- * <tt>(EPIPE)</tt> Broken pipe; there is no process reading from the other
- * end of a pipe.  Every library function that returns this error code also
- * generates a <tt>SIGPIPE</tt> signal; this signal terminates the program
- * if not handled or blocked.  Thus, your program will never actually see
- * this code unless it has handled or blocked <tt>SIGPIPE</tt>.
- * <br><br>
- */
-/** @var FileError::Code FileError::TRYAGAIN
- * <tt>(EAGAIN)</tt> Resource temporarily unavailable; the call might work
- * if you try again later.
- * We used TRYAGAIN instead of TRY_AGAIN, because that is a defined as a macro by a Unix header.
- * <br><br>
- */
-/** @var FileError::Code FileError::INTERRUPTED
- * <tt>(EINTR)</tt> Interrupted function call; an asynchronous signal occurred
- * and prevented completion of the call.  When this happens, you should try
- * the call again.
- * <br><br>
- */
-/** @var FileError::Code FileError::IO_ERROR
- * <tt>(EIO)</tt> Input/output error; usually used for physical read or write
- * errors.  I.e. the disk or other physical device hardware is returning errors.
- * <br><br>
- */
-/** @var FileError::Code FileError::NOT_OWNER
- * <tt>(EPERM)</tt> Operation not permitted; only the owner of the file (or other
- * resource) or processes with special privileges can perform the operation.
- * <br><br>
- */
-/** @var FileError::Code FileError::FAILED
- * Does not correspond to a UNIX error code; this is the standard "failed for
- * unspecified reason" error code present in all Glib::Error error code
- * enumerations.  Returned if no specific code applies.
+/** @defgroup UriUtils URI Utilities
+ * Various uri-related functions.
  */
 
-class Dir;
+//TODO: Documentation: See http://bugzilla.gnome.org/show_bug.cgi?id=508773
 
-/** The iterator type of Glib::Dir.
- * @ingroup FileUtils
+/**
+ * @ingroup UriUtils
+ * @newin2p16
  */
-class DirIterator
-{
-public:
-  typedef std::input_iterator_tag   iterator_category;
-  typedef std::string               value_type;
-  typedef int                       difference_type;
-  typedef value_type                reference;
-  typedef void                      pointer;
-
-  DirIterator();
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  DirIterator(GDir* gobject, const char* current);
-#endif
-
-  std::string  operator*() const;
-  DirIterator& operator++();
-
-  /** @note DirIterator has input iterator semantics, which means real
-   * postfix increment is impossible. The return type is @c void to
-   * prevent surprising behaviour.
-   */
-  void operator++(int);
-
-  bool operator==(const DirIterator& rhs) const;
-  bool operator!=(const DirIterator& rhs) const;
-
-private:
-  GDir*       gobject_;
-  const char* current_;
-};
-
-
-/** Utility class representing an open directory.
- * @ingroup FileUtils
- * It's highly recommended to use the iterator interface.  With iterators,
- * reading an entire directory into a STL container is really easy:
- * @code
- * Glib::Dir dir (directory_path);
- * std::list<std::string> entries (dir.begin(), dir.end());
- * @endcode
- * @note The encoding of the directory entries isn't necessarily UTF-8.
- * Use Glib::filename_to_utf8() if you need to display them.
- */
-class Dir
-{
-public:
-  typedef DirIterator iterator;
-  typedef DirIterator const_iterator;
-
-  /** Opens a directory for reading. The names of the files in the
-   * directory can then be retrieved using read_name().
-   * @param path The path to the directory you are interested in.
-   * @throw Glib::FileError
-   */
-  explicit Dir(const std::string& path);
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  explicit Dir(GDir* gobject);
-#endif
-
-  /** Closes the directory and deallocates all related resources.
-   */
-  ~Dir();
-
-  /** Retrieves the name of the next entry in the directory.
-   * The <tt>'.'</tt> and <tt>'..'</tt> entries are omitted.
-   * @return The entry's name or <tt>""</tt> if there are no more entries.
-   * @see begin(), end()
-   */
-  std::string read_name();
-
-  /** Resets the directory.  The next call to
-   * read_name() will return the first entry again.
-   */
-  void rewind();
-
-  /** Closes the directory and deallocates all related resources.
-   * Note that close() is implicitely called by ~Dir().  Thus you don't
-   * need to call close() yourself unless you want to close the directory
-   * before the destructor runs.
-   */
-  void close();
-
-  /** Get the begin of an input iterator sequence.
-   * @return An input iterator pointing to the first directory entry.
-   */
-  DirIterator begin();
-
-  /** Get the end of an input iterator sequence.
-   * @return An input iterator pointing behind the last directory entry.
-   */
-  DirIterator end();
-
-private:
-  GDir* gobject_;
-
-  // noncopyable
-  Dir(const Dir&);
-  Dir& operator=(const Dir&);
-};
-
-
-/** Returns @c true if any of the tests in the bitfield @a test are true.
- * @ingroup FileUtils
- * For example, <tt>(Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_DIR)</tt> will
- * return @c true if the file exists; the check whether it's a directory
- * doesn't matter since the existence test is true. With the current set of
- * available tests, there's no point passing in more than one test at a time.
- *
- * Apart from <tt>Glib::FILE_TEST_IS_SYMLINK</tt> all tests follow symbolic
- * links, so for a symbolic link to a regular file file_test() will return
- * @c true for both <tt>Glib::FILE_TEST_IS_SYMLINK</tt> and
- * <tt>Glib::FILE_TEST_IS_REGULAR</tt>.
- *
- * @note For a dangling symbolic link file_test() will return @c true for
- * <tt>Glib::FILE_TEST_IS_SYMLINK</tt> and @c false for all other flags.
- *
- * @param filename A filename to test.
- * @param test Bitfield of Glib::FileTest flags.
- * @return Whether a test was true.
- */
-bool file_test(const std::string& filename, FileTest test);
-
-/** Opens a temporary file.
- * @ingroup FileUtils
- * See the %mkstemp() documentation on most UNIX-like systems. This is a
- * portability wrapper, which simply calls %mkstemp() on systems that have
- * it, and implements it in GLib otherwise.
- * @param filename_template A string that should match the rules for
- *   %mkstemp(), i.e. end in <tt>"XXXXXX"</tt>. The <tt>X</tt> string
- *   will be modified to form the name of a file that didn't exist.
- * @return A file handle (as from open()) to the file opened for reading
- *   and writing. The file is opened in binary mode on platforms where there
- *   is a difference. The file handle should be closed with close(). In
- *   case of errors, <tt>-1</tt> is returned.
- */
-int mkstemp(std::string& filename_template);
+std::string uri_unescape_string(const std::string& escaped_string, const std::string& illegal_characters);
 
-/** Opens a file for writing in the preferred directory for temporary files
- * (as returned by Glib::get_tmp_dir()).
- * @ingroup FileUtils
- * @a prefix should a basename template; it'll be suffixed by 6 characters
- * in order to form a unique filename.  No directory components are allowed.
- *
- * The actual name used is returned in @a name_used.
- *
- * @param prefix Template for file name, basename only.
- * @retval name_used The actual name used.
- * @return A file handle (as from <tt>open()</tt>) to the file opened for reading
- * and writing. The file is opened in binary mode on platforms where there is a
- * difference. The file handle should be closed with <tt>close()</tt>.
- * @throw Glib::FileError
- */
-int file_open_tmp(std::string& name_used, const std::string& prefix);
+//TODO: Use iterator? 
+//char *   g_uri_unescape_segment      (const char *escaped_string,
+//				      const char *escaped_string_end,
+//				      const char *illegal_characters);
 
-/** Opens a file for writing in the preferred directory for temporary files
- * (as returned by Glib::get_tmp_dir()).
- * @ingroup FileUtils
- * This function works like file_open_tmp(std::string&, const std::string&)
- * but uses a default basename prefix.
- *
- * @retval name_used The actual name used.
- * @return A file handle (as from <tt>open()</tt>) to the file opened for reading
- * and writing. The file is opened in binary mode on platforms where there is a
- * difference. The file handle should be closed with <tt>close()</tt>.
- * @throw Glib::FileError
+/**
+ * @ingroup UriUtils
+ * @newin2p16
  */
-int file_open_tmp(std::string& name_used);
+std::string uri_get_scheme(const std::string& uri);
 
-/** Reads an entire file into a string, with good error checking.
- * @ingroup FileUtils
- * @param filename A file to read contents from.
- * @return The file contents.
- * @throw Glib::FileError
+/**
+ * @ingroup UriUtils
+ * @newin2p16
  */
-std::string file_get_contents(const std::string& filename);
+std::string uri_escape_string(const std::string& unescaped, const std::string& reserved_chars_allowed, bool allow_utf8 = true);
 
 } // namespace Glib
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]