Debian Codegraph @

gtk/gtkmm/stockid.cc

raw symbols SCIP
1 #include <gtkmmconfig.h>
2 #ifndef GTKMM_DISABLE_DEPRECATED // This whole file is deprecated.
3
4 /* stockid.cc
5 *
6 * Copyright (C) 1998-2002 The gtkmm Development Team
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #include <gtkmm/stockid.h>
23 #include <gtkmm/stock.h>
24
25
26 namespace Gtk
27 {
28
29 StockID::StockID()
30 {}
31
32 StockID::StockID(const BuiltinStockID& id)
33 :
34 id_ (id.id)
35 {}
36
37 StockID::StockID(const Glib::ustring& id)
38 :
39 id_ (id)
40 {}
41
42 StockID::StockID(const char* id)
43 :
44 id_ ((id) ? id : "")
45 {}
46
47 StockID::~StockID() noexcept
48 {}
49
50 StockID::StockID(const StockID& other)
51 :
52 id_ (other.id_)
53 {}
54
55 StockID& StockID::operator=(const StockID& other)
56 {
57 id_ = other.id_;
58 return *this;
59 }
60
61 StockID::operator const void*() const
62 {
63 return !(id_.empty()) ? GINT_TO_POINTER(1) : nullptr ;
64 }
65
66 bool StockID::equal(const StockID& rhs) const
67 {
68 // Do an exact per-byte comparison:
69 // Locale-dependent collation is probably not appropriate for stock IDs.
70 return (id_.raw() == rhs.id_.raw());
71 }
72
73 Glib::ustring StockID::get_string() const
74 {
75 return id_;
76 }
77
78 const char* StockID::get_c_str() const
79 {
80 return id_.c_str();
81 }
82
83 } // namespace Gtk
84
85 #endif // GTKMM_DISABLE_DEPRECATED