2 #ifndef _GLIBMM_QUARK_H
3 #define _GLIBMM_QUARK_H
4 /* $Id: quark.h 2 2003-01-07 16:59:16Z murrayc $ */
8 * Copyright 2002 The gtkmm Development Team
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public
21 * License along with this library; if not, write to the Free
22 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <glib/gquark.h>
26 #include <glibmm/ustring.h>
32 /** Quarks are unique IDs in Glib for strings for use in
33 * hash table lookups. Each Quark is unique but may change
36 * QueryQuark is a converter class for looking up but not
37 * allocating an ID. An id means the quark lookup failed.
39 * Quark is used for actions for which the id should live on
40 * While QueryQuark should be used for queries.
42 * void set_data (const Quark&, void * data);
43 * void* get_data (const QueryQuark&);
48 QueryQuark(const GQuark& q);
49 QueryQuark(const ustring& s);
50 QueryQuark(const char*s);
52 QueryQuark& operator=(const QueryQuark& q);
53 operator ustring() const;
55 operator GQuark() const {return quark_;}
56 GQuark id() const {return quark_;}
62 class Quark: public QueryQuark
65 Quark(const ustring& s);
70 /** @relates Glib::QueryQuark */
71 inline bool operator==(const QueryQuark& a, const QueryQuark& b)
72 { return a.id() == b.id(); }
74 /** @relates Glib::QueryQuark */
75 inline bool operator!=(const QueryQuark& a, const QueryQuark& b)
76 { return a.id() != b.id(); }
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79 // TODO: Put this somewhere else.
80 // (internal) The quark for C++ wrappers.
81 extern GLIBMM_API GQuark quark_;
82 extern GLIBMM_API GQuark quark_cpp_wrapper_deleted_;
85 } /* namespace Glib */
87 #endif /* _GLIBMM_QUARK_H */