QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
quark.h
00001 /*
00002     Copyright (C) 2009-2010  George Kiagiadakis <kiagiadakis.george@gmail.com>
00003     Copyright (C) 2010 Collabora Ltd.
00004       @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
00005 
00006     This library is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU Lesser General Public License as published
00008     by the Free Software Foundation; either version 2.1 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public License
00017     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 #ifndef QGLIB_QUARK_H
00020 #define QGLIB_QUARK_H
00021 
00022 #include "global.h"
00023 #include <QtCore/QString>
00024 
00025 namespace QGlib {
00026 
00042 class QTGLIB_EXPORT Quark
00043 {
00044 public:
00045     inline Quark(quint32 gquark = 0) : m_quark(gquark) {}
00046 
00048     static Quark fromString(const char *str);
00049     static inline Quark fromString(const QString & str); 
00050 
00053     static Quark tryString(const char *str);
00054     static inline Quark tryString(const QString & str); 
00055 
00057     QString toString() const;
00058 
00059     inline operator quint32() const { return m_quark; }
00060 
00061 private:
00062     quint32 m_quark;
00063 };
00064 
00065 //static
00066 inline Quark Quark::fromString(const QString & str)
00067 {
00068     return fromString(str.toUtf8().constData());
00069 }
00070 
00071 //static
00072 inline Quark Quark::tryString(const QString & str)
00073 {
00074     return tryString(str.toUtf8().constData());
00075 }
00076 
00077 } //namespace QGlib
00078 
00079 #endif // QGLIB_QUARK_H