glibmm r548 - in trunk: . gio/giomm
- From: jjongsma svn gnome org
- To: svn-commits-list gnome org
- Subject: glibmm r548 - in trunk: . gio/giomm
- Date: Thu, 31 Jan 2008 22:05:26 +0000 (GMT)
Author: jjongsma
Date: Thu Jan 31 22:05:26 2008
New Revision: 548
URL: http://svn.gnome.org/viewvc/glibmm?rev=548&view=rev
Log:
* gio/giomm/Makefile.am:
* gio/giomm/contenttype.cc:
* gio/giomm/contenttype.h: wrap content_type_* functions
Added:
trunk/gio/giomm/contenttype.cc
trunk/gio/giomm/contenttype.h
Modified:
trunk/ChangeLog
trunk/gio/giomm/ (props changed)
trunk/gio/giomm/Makefile.am
Modified: trunk/gio/giomm/Makefile.am
==============================================================================
--- trunk/gio/giomm/Makefile.am (original)
+++ trunk/gio/giomm/Makefile.am Thu Jan 31 22:05:26 2008
@@ -13,7 +13,7 @@
sublib_files_extra_posix_cc =
sublib_files_extra_win32_cc =
-sublib_files_extra_general_cc = init.cc
+sublib_files_extra_general_cc = init.cc contenttype.cc
sublib_files_extra_general_deprecated_cc =
sublib_files_extra_posix_h =
Added: trunk/gio/giomm/contenttype.cc
==============================================================================
--- (empty file)
+++ trunk/gio/giomm/contenttype.cc Thu Jan 31 22:05:26 2008
@@ -0,0 +1,73 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2008 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <giomm/contenttype.h>
+#include <gio/gio.h>
+
+bool content_type_equals(const Glib::ustring& type1,
+ const Glib::ustring& type2)
+{
+ return g_content_type_equals(type1.c_str(), type2.c_str());
+}
+
+bool content_type_is_a(const Glib::ustring& type,
+ const Glib::ustring& supertype)
+{
+ return g_content_type_is_a(type.c_str(), supertype.c_str());
+}
+
+bool content_type_is_unknown(const Glib::ustring& type)
+{
+ return g_content_type_is_unknown(type.c_str());
+}
+
+Glib::ustring content_type_get_description(const Glib::ustring& type)
+{
+ return Glib::ustring(g_content_type_get_description(type.c_str()));
+}
+
+Glib::ustring content_type_get_mime_type(const Glib::ustring& type)
+{
+ return Glib::ustring(g_content_type_get_mime_type(type.c_str()));
+}
+
+Glib::RefPtr<Gio::Icon> content_type_get_icon(const Glib::ustring& type)
+{
+ return Glib::wrap(g_content_type_get_icon(type.c_str()));
+}
+
+bool content_type_can_be_executable(const Glib::ustring& type)
+{
+ return g_content_type_can_be_executable(type.c_str());
+}
+
+Glib::ustring content_type_guess(const std::string& filename,
+ const std::basic_string<guchar>& data,
+ bool& result_uncertain)
+{
+ return Glib::ustring(g_content_type_guess(filename.c_str(), data.c_str(),
+ data.size(), reinterpret_cast<gboolean*>(&result_uncertain)));
+}
+
+Glib::ListHandle<Glib::ustring> content_types_get_registered(void)
+{
+ return Glib::ListHandle<Glib::ustring>(g_content_types_get_registered(),
+ Glib::OWNERSHIP_DEEP);
+}
+
Added: trunk/gio/giomm/contenttype.h
==============================================================================
--- (empty file)
+++ trunk/gio/giomm/contenttype.h Thu Jan 31 22:05:26 2008
@@ -0,0 +1,126 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2008 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef _GIOMM_CONTENTTYPE_H
+#define _GIOMM_CONTENTTYPE_H
+
+#include <glibmm/ustring.h>
+#include <glibmm/listhandle.h>
+#include <giomm/icon.h>
+#include <string>
+
+namespace Gio
+{
+
+/**
+ * Compares two content types for equality.
+
+ * @param type1 a content type string.
+ * @param type2 a content type string.
+ *
+ * @return true if the two strings are identical or equivalent, false otherwise.
+ **/
+bool content_type_equals(const Glib::ustring& type1,
+ const Glib::ustring& type2);
+
+/**
+ * Determines if @type is a subset of @supertype.
+ *
+ * @param type a content type string.
+ * @param supertype a string.
+
+ * @return true if @type is a kind of @supertype, false otherwise.
+ **/
+bool content_type_is_a(const Glib::ustring& type,
+ const Glib::ustring& supertype);
+
+/**
+ * Checks if the content type is the generic "unknown" type.
+ * On unix this is the "application/octet-stream" mimetype,
+ * while on win32 it is "*".
+ *
+ * @param type a content type string.
+ *
+ * @return true if the type is the unknown type.
+ **/
+bool content_type_is_unknown(const Glib::ustring& type);
+
+/**
+ * Gets the human readable description of the content type.
+ *
+ * @param type a content type string.
+ *
+ * @return a short description of the content type @type.
+ **/
+Glib::ustring content_type_get_description(const Glib::ustring& type);
+
+/**
+ * Gets the mime-type for the content type. If one is registered
+ *
+ * @param type a content type string.
+ *
+ * @return the registered mime-type for the given @type, or NULL if unknown.
+ **/
+Glib::ustring content_type_get_mime_type(const Glib::ustring& type);
+
+/**
+ * @param type a content type string.
+ *
+ * Gets the icon for a content type.
+ *
+ * @return Icon corresponding to the content type.
+ **/
+Glib::RefPtr<Icon> content_type_get_icon(const Glib::ustring& type);
+
+/**
+ * Checks if a content type can be executable. Note that for instance
+ * things like text files can be executables (i.e. scripts and batch files).
+ *
+ * @param type a content type string.
+ *
+ * @return true if the file type corresponds to a type that can be executable,
+ * true otherwise.
+ **/
+bool content_type_can_be_executable(const Glib::ustring& type);
+
+/**
+ * Guesses the content type based on example data. If the function is uncertain,
+ * @result_uncertain will be set to true
+ *
+ * @param filename a string.
+ * @param data a stream of data.
+ * @param data_size the size of @data.
+ * @param result_uncertain a flag indicating the certainty of the result.
+ *
+ * Returns: a string indicating a guessed content type for the
+ * given data.
+ **/
+Glib::ustring content_type_guess(const std::string& filename,
+ const std::basic_string<guchar>& data,
+ bool& result_uncertain);
+
+/**
+ * Gets a list of strings containing all the registered content types
+ * known to the system.
+ *
+ * @return List of the registered content types.
+ **/
+Glib::ListHandle<Glib::ustring> content_types_get_registered(void);
+
+} // namespace Gio
+#endif // _GIOMM_CONTENTTYPE_H
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]