1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <giomm/fileattributeinfolist.h>
5 #include <giomm/private/fileattributeinfolist_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.
31 FileAttributeInfoList::operator bool() const
36 bool FileAttributeInfoList::empty() const
42 FileAttributeInfoList::lookup(const std::string& name) const
44 GFileAttributeInfoList* cobject = const_cast<GFileAttributeInfoList*>(gobj());
45 const GFileAttributeInfo* cinfo =
46 g_file_attribute_info_list_lookup (cobject, name.c_str());
48 FileAttributeInfo info(cinfo);
56 } // anonymous namespace
59 /* Why reinterpret_cast<FileAttributeInfoList*>(gobject) is needed:
61 * A FileAttributeInfoList instance is in fact always a GFileAttributeInfoList instance.
62 * Unfortunately, GFileAttributeInfoList cannot be a member of FileAttributeInfoList,
63 * because it is an opaque struct. Also, the C interface does not provide
64 * any hooks to install a destroy notification handler, thus we cannot
65 * wrap it dynamically either.
67 * The cast works because FileAttributeInfoList does not have any member data, and
68 * it is impossible to derive from it. This is ensured by not implementing
69 * the (protected) default constructor. The ctor is protected rather than
70 * private just to avoid a compile warning.
76 Glib::RefPtr<Gio::FileAttributeInfoList> wrap(GFileAttributeInfoList* object, bool take_copy)
78 if(take_copy && object)
79 g_file_attribute_info_list_ref(object);
81 // See the comment at the top of this file, if you want to know why the cast works.
82 return Glib::RefPtr<Gio::FileAttributeInfoList>(reinterpret_cast<Gio::FileAttributeInfoList*>(object));
93 Glib::RefPtr<FileAttributeInfoList> FileAttributeInfoList::create()
95 // See the comment at the top of this file, if you want to know why the cast works.
96 return Glib::RefPtr<FileAttributeInfoList>(reinterpret_cast<FileAttributeInfoList*>(g_file_attribute_info_list_new()));
99 void FileAttributeInfoList::reference() const
101 // See the comment at the top of this file, if you want to know why the cast works.
102 g_file_attribute_info_list_ref(reinterpret_cast<GFileAttributeInfoList*>(const_cast<FileAttributeInfoList*>(this)));
105 void FileAttributeInfoList::unreference() const
107 // See the comment at the top of this file, if you want to know why the cast works.
108 g_file_attribute_info_list_unref(reinterpret_cast<GFileAttributeInfoList*>(const_cast<FileAttributeInfoList*>(this)));
111 GFileAttributeInfoList* FileAttributeInfoList::gobj()
113 // See the comment at the top of this file, if you want to know why the cast works.
114 return reinterpret_cast<GFileAttributeInfoList*>(this);
117 const GFileAttributeInfoList* FileAttributeInfoList::gobj() const
119 // See the comment at the top of this file, if you want to know why the cast works.
120 return reinterpret_cast<const GFileAttributeInfoList*>(this);
123 GFileAttributeInfoList* FileAttributeInfoList::gobj_copy() const
125 // See the comment at the top of this file, if you want to know why the cast works.
126 GFileAttributeInfoList *const gobject = reinterpret_cast<GFileAttributeInfoList*>(const_cast<FileAttributeInfoList*>(this));
127 g_file_attribute_info_list_ref(gobject);
132 Glib::RefPtr<FileAttributeInfoList> FileAttributeInfoList::dup() const
134 return Glib::wrap(g_file_attribute_info_list_dup(const_cast<GFileAttributeInfoList*>(gobj())));
137 void FileAttributeInfoList::add(const std::string& name, FileAttributeType type, FileAttributeInfoFlags flags)
139 g_file_attribute_info_list_add(gobj(), name.c_str(), ((GFileAttributeType)(type)), ((GFileAttributeInfoFlags)(flags)));