1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <giomm/fileinfo.h>
5 #include <giomm/private/fileinfo_p.h>
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
9 /* Copyright (C) 2007 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 // FileAttributeMatcher
32 Glib::RefPtr<FileAttributeMatcher>
33 FileAttributeMatcher::create(const std::string& attributes)
35 return Glib::wrap(g_file_attribute_matcher_new(attributes.c_str()));
38 Glib::TimeVal FileInfo::modification_time() const
41 g_file_info_get_modification_time(const_cast<GFileInfo*>(gobj()), (GTimeVal*)(&result));
49 } // anonymous namespace
52 /* Why reinterpret_cast<FileAttributeMatcher*>(gobject) is needed:
54 * A FileAttributeMatcher instance is in fact always a GFileAttributeMatcher instance.
55 * Unfortunately, GFileAttributeMatcher cannot be a member of FileAttributeMatcher,
56 * because it is an opaque struct. Also, the C interface does not provide
57 * any hooks to install a destroy notification handler, thus we cannot
58 * wrap it dynamically either.
60 * The cast works because FileAttributeMatcher does not have any member data, and
61 * it is impossible to derive from it. This is ensured by not implementing
62 * the (protected) default constructor. The ctor is protected rather than
63 * private just to avoid a compile warning.
69 Glib::RefPtr<Gio::FileAttributeMatcher> wrap(GFileAttributeMatcher* object, bool take_copy)
71 if(take_copy && object)
72 g_file_attribute_matcher_ref(object);
74 // See the comment at the top of this file, if you want to know why the cast works.
75 return Glib::RefPtr<Gio::FileAttributeMatcher>(reinterpret_cast<Gio::FileAttributeMatcher*>(object));
85 void FileAttributeMatcher::reference() const
87 // See the comment at the top of this file, if you want to know why the cast works.
88 g_file_attribute_matcher_ref(reinterpret_cast<GFileAttributeMatcher*>(const_cast<FileAttributeMatcher*>(this)));
91 void FileAttributeMatcher::unreference() const
93 // See the comment at the top of this file, if you want to know why the cast works.
94 g_file_attribute_matcher_unref(reinterpret_cast<GFileAttributeMatcher*>(const_cast<FileAttributeMatcher*>(this)));
97 GFileAttributeMatcher* FileAttributeMatcher::gobj()
99 // See the comment at the top of this file, if you want to know why the cast works.
100 return reinterpret_cast<GFileAttributeMatcher*>(this);
103 const GFileAttributeMatcher* FileAttributeMatcher::gobj() const
105 // See the comment at the top of this file, if you want to know why the cast works.
106 return reinterpret_cast<const GFileAttributeMatcher*>(this);
109 GFileAttributeMatcher* FileAttributeMatcher::gobj_copy() const
111 // See the comment at the top of this file, if you want to know why the cast works.
112 GFileAttributeMatcher *const gobject = reinterpret_cast<GFileAttributeMatcher*>(const_cast<FileAttributeMatcher*>(this));
113 g_file_attribute_matcher_ref(gobject);
118 bool FileAttributeMatcher::matches(const std::string& full_name) const
120 return g_file_attribute_matcher_matches(const_cast<GFileAttributeMatcher*>(gobj()), full_name.c_str());
123 bool FileAttributeMatcher::matches_only(const std::string& full_name) const
125 return g_file_attribute_matcher_matches_only(const_cast<GFileAttributeMatcher*>(gobj()), full_name.c_str());
128 bool FileAttributeMatcher::enumerate_namespace(const std::string& ns)
130 return g_file_attribute_matcher_enumerate_namespace(gobj(), ns.c_str());
133 std::string FileAttributeMatcher::enumerate_next()
135 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_attribute_matcher_enumerate_next(gobj()));
145 Glib::RefPtr<Gio::FileInfo> wrap(GFileInfo* object, bool take_copy)
147 return Glib::RefPtr<Gio::FileInfo>( dynamic_cast<Gio::FileInfo*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
148 //We use dynamic_cast<> in case of multiple inheritance.
151 } /* namespace Glib */
158 /* The *_Class implementation: */
160 const Glib::Class& FileInfo_Class::init()
162 if(!gtype_) // create the GType if necessary
164 // Glib::Class has to know the class init function to clone custom types.
165 class_init_func_ = &FileInfo_Class::class_init_function;
167 // This is actually just optimized away, apparently with no harm.
168 // Make sure that the parent type has been created.
169 //CppClassParent::CppObjectType::get_type();
171 // Create the wrapper type, with the same class/instance size as the base type.
172 register_derived_type(g_file_info_get_type());
174 // Add derived versions of interfaces, if the C type implements any interfaces:
181 void FileInfo_Class::class_init_function(void* g_class, void* class_data)
183 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
184 CppClassParent::class_init_function(klass, class_data);
186 #ifdef GLIBMM_VFUNCS_ENABLED
187 #endif //GLIBMM_VFUNCS_ENABLED
189 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
190 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
193 #ifdef GLIBMM_VFUNCS_ENABLED
194 #endif //GLIBMM_VFUNCS_ENABLED
196 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
197 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
200 Glib::ObjectBase* FileInfo_Class::wrap_new(GObject* object)
202 return new FileInfo((GFileInfo*)object);
206 /* The implementation: */
208 GFileInfo* FileInfo::gobj_copy()
214 FileInfo::FileInfo(const Glib::ConstructParams& construct_params)
216 Glib::Object(construct_params)
221 FileInfo::FileInfo(GFileInfo* castitem)
223 Glib::Object((GObject*)(castitem))
227 FileInfo::~FileInfo()
231 FileInfo::CppClassType FileInfo::fileinfo_class_; // initialize static member
233 GType FileInfo::get_type()
235 return fileinfo_class_.init().get_type();
238 GType FileInfo::get_base_type()
240 return g_file_info_get_type();
245 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
247 Glib::Object(Glib::ConstructParams(fileinfo_class_.init()))
253 Glib::RefPtr<FileInfo> FileInfo::dup() const
255 return Glib::wrap(g_file_info_dup(const_cast<GFileInfo*>(gobj())));
258 void FileInfo::copy_into(Glib::RefPtr<FileInfo>& dest) const
260 g_file_info_copy_into(const_cast<GFileInfo*>(gobj()), Glib::unwrap(dest));
263 bool FileInfo::has_attribute(const std::string& attribute) const
265 return g_file_info_has_attribute(const_cast<GFileInfo*>(gobj()), attribute.c_str());
268 Glib::StringArrayHandle FileInfo::list_attributes(const std::string& name_space) const
270 return Glib::StringArrayHandle(g_file_info_list_attributes(const_cast<GFileInfo*>(gobj()), name_space.c_str()));
273 FileAttributeType FileInfo::get_attribute_type(const std::string& attribute) const
275 return ((FileAttributeType)(g_file_info_get_attribute_type(const_cast<GFileInfo*>(gobj()), attribute.c_str())));
278 void FileInfo::remove_attribute(const std::string& attribute)
280 g_file_info_remove_attribute(gobj(), attribute.c_str());
283 std::string FileInfo::get_attribute_string(const std::string& attribute) const
285 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_attribute_string(const_cast<GFileInfo*>(gobj()), attribute.c_str()));
288 Glib::ustring FileInfo::get_attribute_as_string(const std::string& attribute) const
290 return Glib::convert_return_gchar_ptr_to_ustring(g_file_info_get_attribute_as_string(const_cast<GFileInfo*>(gobj()), attribute.c_str()));
293 std::string FileInfo::get_attribute_byte_string(const std::string& attribute) const
295 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_attribute_byte_string(const_cast<GFileInfo*>(gobj()), attribute.c_str()));
298 bool FileInfo::get_attribute_boolean(const std::string& attribute) const
300 return g_file_info_get_attribute_boolean(const_cast<GFileInfo*>(gobj()), attribute.c_str());
303 guint32 FileInfo::get_attribute_uint32(const std::string& attribute) const
305 return g_file_info_get_attribute_uint32(const_cast<GFileInfo*>(gobj()), attribute.c_str());
308 gint32 FileInfo::get_attribute_int32(const std::string& attribute) const
310 return g_file_info_get_attribute_int32(const_cast<GFileInfo*>(gobj()), attribute.c_str());
313 guint64 FileInfo::get_attribute_uint64(const std::string& attribute) const
315 return g_file_info_get_attribute_uint64(const_cast<GFileInfo*>(gobj()), attribute.c_str());
318 gint64 FileInfo::get_attribute_int64(const std::string& attribute) const
320 return g_file_info_get_attribute_int64(const_cast<GFileInfo*>(gobj()), attribute.c_str());
323 Glib::RefPtr<Glib::Object> FileInfo::get_attribute_object(const std::string& attribute) const
325 return Glib::wrap(g_file_info_get_attribute_object(const_cast<GFileInfo*>(gobj()), attribute.c_str()));
328 void FileInfo::set_attribute_string(const std::string& attribute, const std::string& value)
330 g_file_info_set_attribute_string(gobj(), attribute.c_str(), value.c_str());
333 void FileInfo::set_attribute_byte_string(const std::string& attribute, const std::string& value)
335 g_file_info_set_attribute_byte_string(gobj(), attribute.c_str(), value.c_str());
338 void FileInfo::set_attribute_boolean(const std::string& attribute, bool value)
340 g_file_info_set_attribute_boolean(gobj(), attribute.c_str(), static_cast<int>(value));
343 void FileInfo::set_attribute_uint32(const std::string& attribute, guint32 value)
345 g_file_info_set_attribute_uint32(gobj(), attribute.c_str(), value);
348 void FileInfo::set_attribute_int32(const std::string& attribute, gint32 value)
350 g_file_info_set_attribute_int32(gobj(), attribute.c_str(), value);
353 void FileInfo::set_attribute_uint64(const std::string& attribute, guint64 value)
355 g_file_info_set_attribute_uint64(gobj(), attribute.c_str(), value);
358 void FileInfo::set_attribute_int64(const std::string& attribute, gint64 value)
360 g_file_info_set_attribute_int64(gobj(), attribute.c_str(), value);
363 void FileInfo::set_attribute_object(const std::string& attribute, const Glib::RefPtr<Glib::Object>& object)
365 g_file_info_set_attribute_object(gobj(), attribute.c_str(), Glib::unwrap(object));
368 void FileInfo::clear_status()
370 g_file_info_clear_status(gobj());
373 FileType FileInfo::get_file_type() const
375 return ((FileType)(g_file_info_get_file_type(const_cast<GFileInfo*>(gobj()))));
378 bool FileInfo::is_hidden() const
380 return g_file_info_get_is_hidden(const_cast<GFileInfo*>(gobj()));
383 bool FileInfo::is_backup() const
385 return g_file_info_get_is_backup(const_cast<GFileInfo*>(gobj()));
388 bool FileInfo::is_symlink() const
390 return g_file_info_get_is_symlink(const_cast<GFileInfo*>(gobj()));
393 std::string FileInfo::get_name() const
395 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_name(const_cast<GFileInfo*>(gobj())));
398 std::string FileInfo::get_display_name() const
400 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_display_name(const_cast<GFileInfo*>(gobj())));
403 std::string FileInfo::get_edit_name() const
405 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_edit_name(const_cast<GFileInfo*>(gobj())));
408 Glib::RefPtr<Icon> FileInfo::get_icon()
411 Glib::RefPtr<Icon> retvalue = Glib::wrap(g_file_info_get_icon(gobj()));
413 retvalue->reference(); //The function does not do a ref for us.
418 Glib::RefPtr<const Icon> FileInfo::get_icon() const
420 return const_cast<FileInfo*>(this)->get_icon();
423 std::string FileInfo::get_content_type() const
425 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_content_type(const_cast<GFileInfo*>(gobj())));
428 goffset FileInfo::get_size() const
430 return g_file_info_get_size(const_cast<GFileInfo*>(gobj()));
433 std::string FileInfo::get_symlink_target() const
435 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_symlink_target(const_cast<GFileInfo*>(gobj())));
438 std::string FileInfo::get_etag() const
440 return Glib::convert_const_gchar_ptr_to_stdstring(g_file_info_get_etag(const_cast<GFileInfo*>(gobj())));
443 gint32 FileInfo::get_sort_order() const
445 return g_file_info_get_sort_order(const_cast<GFileInfo*>(gobj()));
448 void FileInfo::set_attribute_mask(const Glib::RefPtr<FileAttributeMatcher>& mask)
450 g_file_info_set_attribute_mask(gobj(), const_cast<GFileAttributeMatcher*>(Glib::unwrap(mask)));
453 void FileInfo::unset_attribute_mask()
455 g_file_info_unset_attribute_mask(gobj());
458 void FileInfo::set_file_type(FileType type)
460 g_file_info_set_file_type(gobj(), ((GFileType)(type)));
463 void FileInfo::set_is_hidden(bool is_hidden)
465 g_file_info_set_is_hidden(gobj(), static_cast<int>(is_hidden));
468 void FileInfo::set_is_symlink(bool is_symlink)
470 g_file_info_set_is_symlink(gobj(), static_cast<int>(is_symlink));
473 void FileInfo::set_name(const std::string& name)
475 g_file_info_set_name(gobj(), name.c_str());
478 void FileInfo::set_display_name(const std::string& display_name)
480 g_file_info_set_display_name(gobj(), display_name.c_str());
483 void FileInfo::set_edit_name(const std::string& edit_name)
485 g_file_info_set_edit_name(gobj(), edit_name.c_str());
488 void FileInfo::set_icon(const Glib::RefPtr<Icon>& icon)
490 g_file_info_set_icon(gobj(), const_cast<GIcon*>(Glib::unwrap(icon)));
493 void FileInfo::set_content_type(const std::string& content_type)
495 g_file_info_set_content_type(gobj(), content_type.c_str());
498 void FileInfo::set_size(goffset size)
500 g_file_info_set_size(gobj(), size);
503 void FileInfo::set_modification_time(const Glib::TimeVal& mtime)
505 g_file_info_set_modification_time(gobj(), const_cast<GTimeVal*>(static_cast<const GTimeVal*>(&mtime)));
508 void FileInfo::set_symlink_target(const std::string& symlink_target)
510 g_file_info_set_symlink_target(gobj(), symlink_target.c_str());
513 void FileInfo::set_sort_order(gint32 sort_order)
515 g_file_info_set_sort_order(gobj(), sort_order);
519 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
520 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
522 #ifdef GLIBMM_VFUNCS_ENABLED
523 #endif //GLIBMM_VFUNCS_ENABLED