<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Soprano: /builddir/build/BUILD/soprano-2.5.2/soprano/languagetag.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.1 --> <script type="text/javascript"> function hasClass(ele,cls) { return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); } function addClass(ele,cls) { if (!this.hasClass(ele,cls)) ele.className += " "+cls; } function removeClass(ele,cls) { if (hasClass(ele,cls)) { var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)'); ele.className=ele.className.replace(reg,' '); } } function toggleVisibility(linkObj) { var base = linkObj.getAttribute('id'); var summary = document.getElementById(base + '-summary'); var content = document.getElementById(base + '-content'); var trigger = document.getElementById(base + '-trigger'); if ( hasClass(linkObj,'closed') ) { summary.style.display = 'none'; content.style.display = 'block'; trigger.src = 'open.png'; removeClass(linkObj,'closed'); addClass(linkObj,'opened'); } else if ( hasClass(linkObj,'opened') ) { summary.style.display = 'block'; content.style.display = 'none'; trigger.src = 'closed.png'; removeClass(linkObj,'opened'); addClass(linkObj,'closed'); } return false; } </script> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <h1>/builddir/build/BUILD/soprano-2.5.2/soprano/languagetag.h</h1> </div> </div> <div class="contents"> <a href="languagetag_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * This file is part of Soprano Project.</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2009 Greg Beauchesne <greg_b@vision-play.com></span> <a name="l00005"></a>00005 <span class="comment"> *</span> <a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span> <a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the GNU Library General Public</span> <a name="l00008"></a>00008 <span class="comment"> * License as published by the Free Software Foundation; either</span> <a name="l00009"></a>00009 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * This library is distributed in the hope that it will be useful,</span> <a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00014"></a>00014 <span class="comment"> * Library General Public License for more details.</span> <a name="l00015"></a>00015 <span class="comment"> *</span> <a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU Library General Public License</span> <a name="l00017"></a>00017 <span class="comment"> * along with this library; see the file COPYING.LIB. If not, write to</span> <a name="l00018"></a>00018 <span class="comment"> * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span> <a name="l00019"></a>00019 <span class="comment"> * Boston, MA 02110-1301, USA.</span> <a name="l00020"></a>00020 <span class="comment"> */</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef SOPRANO_LANGUAGETAG_H</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define SOPRANO_LANGUAGETAG_H</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <QtCore/QSharedDataPointer></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <QtCore/QTextStream></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <QtCore/QLocale></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <QtCore/QFlags></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <QtCore/QMetaType></span> <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="soprano__export_8h.html">soprano_export.h</a>"</span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">namespace </span>Soprano <a name="l00034"></a>00034 { <a name="l00044"></a><a class="code" href="classSoprano_1_1LanguageTag.html">00044</a> <span class="keyword">class </span><a class="code" href="soprano__export_8h.html#a4f040b77f4fdd45fda0c3d6ced1e3776">SOPRANO_EXPORT</a> <a class="code" href="classSoprano_1_1LanguageTag.html" title="A LanguageTag represents a language according to RFC 3066 and RFC 4646.">LanguageTag</a> <a name="l00045"></a>00045 { <a name="l00046"></a>00046 <span class="keyword">public</span>: <a name="l00047"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a4377c0c2e9e66fa866ac61a3aef7bc7f">00047</a> <span class="keyword">enum</span> <a class="code" href="classSoprano_1_1LanguageTag.html#a4377c0c2e9e66fa866ac61a3aef7bc7f">MatchFilter</a> { <a name="l00055"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a4377c0c2e9e66fa866ac61a3aef7bc7faeaaf7a366ad54e5aa9e661ab70875c2e">00055</a> MatchFilterBasic = 0, <a name="l00056"></a>00056 <a name="l00062"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a4377c0c2e9e66fa866ac61a3aef7bc7fab54d2235f49801dd112ed49b6ea76ca7">00062</a> MatchFilterExtended = 1 <a name="l00063"></a>00063 }; <a name="l00064"></a>00064 <a name="l00070"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a71b32f74e4aaf912ef15ec3fabfc6a4d">00070</a> <span class="keyword">enum</span> <a class="code" href="classSoprano_1_1LanguageTag.html#a71b32f74e4aaf912ef15ec3fabfc6a4d">LookupFlag</a> { <a name="l00071"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a71b32f74e4aaf912ef15ec3fabfc6a4daad408cf64b3a2e3cf6a34bed56f6b856">00071</a> LookupFlagNone = 0, <a name="l00073"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a71b32f74e4aaf912ef15ec3fabfc6a4da93c5afa00b97db26eb14a6e085a80f4c">00073</a> LookupFlagNoFallback = 1 <a name="l00074"></a>00074 }; <a name="l00075"></a>00075 Q_DECLARE_FLAGS(LookupFlags, LookupFlag) <a name="l00076"></a>00076 <a name="l00077"></a>00077 public: <a name="l00086"></a>00086 <a class="code" href="classSoprano_1_1LanguageTag.html" title="A LanguageTag represents a language according to RFC 3066 and RFC 4646.">LanguageTag</a>(); <a name="l00087"></a>00087 <a name="l00093"></a>00093 LanguageTag( const LanguageTag &other ); <a name="l00094"></a>00094 <a name="l00100"></a>00100 LanguageTag( const <span class="keywordtype">char</span> * tag ); <a name="l00101"></a>00101 <a name="l00107"></a>00107 LanguageTag( const <a class="codeRef" href="qlatin1string.html">QLatin1String</a> &tag ); <a name="l00108"></a>00108 <a name="l00114"></a>00114 LanguageTag( const <a class="codeRef" href="qstring.html">QString</a> &tag ); <a name="l00115"></a>00115 <a name="l00122"></a>00122 explicit LanguageTag( const <a class="codeRef" href="qlocale.html">QLocale</a> &locale ); <a name="l00123"></a>00123 <a name="l00131"></a>00131 LanguageTag( <a class="codeRef" href="qlocale.html">QLocale</a>::Language lang, <a class="codeRef" href="qlocale.html">QLocale</a>::Country country = <a class="codeRef" href="qlocale.html">QLocale</a>::AnyCountry ); <a name="l00132"></a>00132 <a name="l00136"></a>00136 ~LanguageTag(); <a name="l00138"></a>00138 <a name="l00146"></a>00146 LanguageTag& operator=( const LanguageTag& other ); <a name="l00147"></a>00147 <a name="l00154"></a>00154 <span class="keywordtype">bool</span> operator==( const LanguageTag& other ) const; <a name="l00155"></a>00155 <a name="l00161"></a>00161 <span class="keywordtype">bool</span> operator!=( const LanguageTag& other ) const; <a name="l00162"></a>00162 <a name="l00167"></a>00167 <span class="keywordtype">bool</span> operator<( const LanguageTag& other ) const; <a name="l00168"></a>00168 <a name="l00173"></a>00173 <span class="keywordtype">bool</span> operator<=( const LanguageTag& other ) const; <a name="l00174"></a>00174 <a name="l00179"></a>00179 <span class="keywordtype">bool</span> operator>( const LanguageTag& other ) const; <a name="l00180"></a>00180 <a name="l00185"></a>00185 <span class="keywordtype">bool</span> operator>=( const LanguageTag& other ) const; <a name="l00186"></a>00186 <a name="l00196"></a>00196 <span class="keywordtype">bool</span> matches( const LanguageTag& <a class="code" href="namespaceSoprano_1_1Vocabulary_1_1RDFS.html#a5d239af5cd4f9a14d6f9a8ba51d3d130">range</a>, MatchFilter scheme = MatchFilterBasic ) const; <a name="l00198"></a>00198 <a name="l00203"></a>00203 <a name="l00207"></a>00207 <span class="keywordtype">bool</span> isEmpty() const; <a name="l00208"></a>00208 <a name="l00224"></a>00224 <span class="keywordtype">bool</span> isValid() const; <a name="l00225"></a>00225 <a name="l00229"></a>00229 <a class="codeRef" href="qstringlist.html">QStringList</a> subTags() const; <a name="l00230"></a>00230 <a name="l00232"></a>00232 <a name="l00242"></a>00242 <a class="codeRef" href="qstring.html">QString</a> toString() const; <a name="l00243"></a>00243 <a name="l00250"></a>00250 <a class="codeRef" href="qstring.html">QString</a> toPrettyString() const; <a name="l00251"></a>00251 <a name="l00268"></a>00268 <a class="codeRef" href="qlocale.html">QLocale</a> toLocale() const; <a name="l00269"></a>00269 <a name="l00277"></a><a class="code" href="classSoprano_1_1LanguageTag.html#a2dfebb028dcbb1f04d0db6d4e347ee6e">00277</a> inline operator <a class="codeRef" href="qstring.html">QString</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> toString(); } <a name="l00279"></a>00279 <a name="l00280"></a>00280 <a name="l00321"></a>00321 <span class="keyword">static</span> <span class="keywordtype">int</span> lookup( <a name="l00322"></a>00322 <span class="keyword">const</span> <a class="codeRef" href="qlist.html">QList<LanguageTag></a> & choices, <a name="l00323"></a>00323 <span class="keyword">const</span> <a class="codeRef" href="qlist.html">QList<LanguageTag></a> & priority, <a name="l00324"></a>00324 LookupFlags flags = LookupFlagNone, <a name="l00325"></a>00325 MatchFilter scheme = MatchFilterBasic <a name="l00326"></a>00326 ); <a name="l00327"></a>00327 <a name="l00344"></a>00344 <span class="keyword">static</span> <span class="keywordtype">int</span> lookup( <a name="l00345"></a>00345 <span class="keyword">const</span> <a class="codeRef" href="qlist.html">QList<LanguageTag></a> & choices, <a name="l00346"></a>00346 <span class="keyword">const</span> <a class="code" href="classSoprano_1_1LanguageTag.html" title="A LanguageTag represents a language according to RFC 3066 and RFC 4646.">LanguageTag</a> & priority, <a name="l00347"></a>00347 LookupFlags flags = LookupFlagNone, <a name="l00348"></a>00348 MatchFilter scheme = MatchFilterBasic <a name="l00349"></a>00349 ); <a name="l00350"></a>00350 <a name="l00351"></a>00351 <span class="keyword">private</span>: <a name="l00352"></a>00352 <span class="keyword">class </span>Private; <a name="l00353"></a>00353 <a class="codeRef" href="qshareddatapointer.html">QSharedDataPointer<Private></a> d; <a name="l00354"></a>00354 }; <a name="l00355"></a>00355 <a name="l00356"></a>00356 <a class="code" href="soprano__export_8h.html#a4f040b77f4fdd45fda0c3d6ced1e3776">SOPRANO_EXPORT</a> uint <a class="code" href="namespaceSoprano.html#ad6ab842f23f336a1514d9ed0a96d9a91">qHash</a>( <span class="keyword">const</span> LanguageTag& node ); <a name="l00357"></a>00357 } <a name="l00358"></a>00358 <a name="l00359"></a>00359 Q_DECLARE_METATYPE( <a class="code" href="classSoprano_1_1LanguageTag.html" title="A LanguageTag represents a language according to RFC 3066 and RFC 4646.">Soprano::LanguageTag</a> ) <a name="l00360"></a>00360 <a class="code" href="languagetag_8h.html#ad16aa666c2bd1cd937a719392d7186dc">Q_DECLARE_TYPEINFO</a>( Soprano::LanguageTag, Q_MOVABLE_TYPE ); <a name="l00361"></a>00361 <a name="l00362"></a>00362 Q_DECLARE_OPERATORS_FOR_FLAGS(Soprano::LanguageTag::LookupFlags) <a name="l00363"></a>00363 <a name="l00364"></a>00364 <a class="code" href="soprano__export_8h.html#a4f040b77f4fdd45fda0c3d6ced1e3776">SOPRANO_EXPORT</a> QDebug operator<<( QDebug s, const Soprano::LanguageTag& ); <a name="l00365"></a>00365 <a class="code" href="soprano__export_8h.html#a4f040b77f4fdd45fda0c3d6ced1e3776">SOPRANO_EXPORT</a> <a class="codeRef" href="qtextstream.html">QTextStream</a>& operator<<( <a class="codeRef" href="qtextstream.html">QTextStream</a>& s, const Soprano::LanguageTag& ); <a name="l00366"></a>00366 <a name="l00367"></a>00367 <span class="preprocessor">#endif // SOPRANO_LANGUAGETAG_H</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Thu Oct 21 2010 for Soprano by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address> </body> </html>