Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / glibmm2 / gio / giomm / fileattributeinfolist.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <giomm/fileattributeinfolist.h>
5 #include <giomm/private/fileattributeinfolist_p.h>
6
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
8
9 /* Copyright (C) 2007 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <gio/gio.h>
27
28 namespace Gio
29 {
30
31 FileAttributeInfoList::operator bool() const
32 {
33   return !empty();
34 }
35
36 bool FileAttributeInfoList::empty() const
37 {
38   return gobj() == 0;
39 }
40
41 FileAttributeInfo
42 FileAttributeInfoList::lookup(const std::string& name) const
43 {
44   GFileAttributeInfoList* cobject = const_cast<GFileAttributeInfoList*>(gobj());
45   const GFileAttributeInfo* cinfo =
46     g_file_attribute_info_list_lookup (cobject, name.c_str());
47
48   FileAttributeInfo info(cinfo);
49   return info;
50 }
51
52 } // namespace Gio
53
54 namespace
55 {
56 } // anonymous namespace
57
58
59 /* Why reinterpret_cast<FileAttributeInfoList*>(gobject) is needed:
60  *
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.
66  *
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.
71  */
72
73 namespace Glib
74 {
75
76 Glib::RefPtr<Gio::FileAttributeInfoList> wrap(GFileAttributeInfoList* object, bool take_copy)
77 {
78   if(take_copy && object)
79     g_file_attribute_info_list_ref(object);
80
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));
83 }
84
85 } // namespace Glib
86
87
88 namespace Gio
89 {
90
91
92 // static
93 Glib::RefPtr<FileAttributeInfoList> FileAttributeInfoList::create()
94 {
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()));
97 }
98
99 void FileAttributeInfoList::reference() const
100 {
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)));
103 }
104
105 void FileAttributeInfoList::unreference() const
106 {
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)));
109 }
110
111 GFileAttributeInfoList* FileAttributeInfoList::gobj()
112 {
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);
115 }
116
117 const GFileAttributeInfoList* FileAttributeInfoList::gobj() const
118 {
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);
121 }
122
123 GFileAttributeInfoList* FileAttributeInfoList::gobj_copy() const
124 {
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);
128   return gobject;
129 }
130
131
132 Glib::RefPtr<FileAttributeInfoList> FileAttributeInfoList::dup() const
133 {
134   return Glib::wrap(g_file_attribute_info_list_dup(const_cast<GFileAttributeInfoList*>(gobj())));
135 }
136
137 void FileAttributeInfoList::add(const std::string& name, FileAttributeType type, FileAttributeInfoFlags flags)
138 {
139 g_file_attribute_info_list_add(gobj(), name.c_str(), ((GFileAttributeType)(type)), ((GFileAttributeInfoFlags)(flags))); 
140 }
141
142
143 } // namespace Gio
144
145