QxConvert_FromString.inl 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. /****************************************************************************
  2. **
  3. ** https://www.qxorm.com/
  4. ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
  5. **
  6. ** This file is part of the QxOrm library
  7. **
  8. ** This software is provided 'as-is', without any express or implied
  9. ** warranty. In no event will the authors be held liable for any
  10. ** damages arising from the use of this software
  11. **
  12. ** Commercial Usage
  13. ** Licensees holding valid commercial QxOrm licenses may use this file in
  14. ** accordance with the commercial license agreement provided with the
  15. ** Software or, alternatively, in accordance with the terms contained in
  16. ** a written agreement between you and Lionel Marty
  17. **
  18. ** GNU General Public License Usage
  19. ** Alternatively, this file may be used under the terms of the GNU
  20. ** General Public License version 3.0 as published by the Free Software
  21. ** Foundation and appearing in the file 'license.gpl3.txt' included in the
  22. ** packaging of this file. Please review the following information to
  23. ** ensure the GNU General Public License version 3.0 requirements will be
  24. ** met : http://www.gnu.org/copyleft/gpl.html
  25. **
  26. ** If you are unsure which license is appropriate for your use, or
  27. ** if you have questions regarding the use of this file, please contact :
  28. ** contact@qxorm.com
  29. **
  30. ****************************************************************************/
  31. namespace qx {
  32. namespace cvt {
  33. namespace detail {
  34. template <> struct QxConvert_FromString< qx::trait::no_type > {
  35. static inline qx_bool fromString(const QString & s, qx::trait::no_type & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  36. { Q_UNUSED(s); Q_UNUSED(t); Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return qx_bool(true); } };
  37. template <> struct QxConvert_FromString< QString > {
  38. static inline qx_bool fromString(const QString & s, QString & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  39. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = s; return qx_bool(true); } };
  40. template <> struct QxConvert_FromString< QUuid > {
  41. static inline qx_bool fromString(const QString & s, QUuid & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  42. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = QUuid(s); return qx_bool(true); } };
  43. template <> struct QxConvert_FromString< QDate > {
  44. static inline qx_bool fromString(const QString & s, QDate & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  45. { Q_UNUSED(index); Q_UNUSED(ctx); t = QDate::fromString(s, (format.isEmpty() ? QString(QX_STR_CVT_QDATE_FORMAT) : format)); return t.isValid(); } };
  46. template <> struct QxConvert_FromString< QTime > {
  47. static inline qx_bool fromString(const QString & s, QTime & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  48. { Q_UNUSED(index); Q_UNUSED(ctx); t = QTime::fromString(s, (format.isEmpty() ? QString(QX_STR_CVT_QTIME_FORMAT) : format)); return t.isValid(); } };
  49. template <> struct QxConvert_FromString< QDateTime > {
  50. static inline qx_bool fromString(const QString & s, QDateTime & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  51. { Q_UNUSED(index); Q_UNUSED(ctx); t = QDateTime::fromString(s, (format.isEmpty() ? QString(QX_STR_CVT_QDATETIME_FORMAT) : format)); return t.isValid(); } };
  52. template <> struct QxConvert_FromString< QByteArray > {
  53. static inline qx_bool fromString(const QString & s, QByteArray & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  54. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = s.toLatin1(); return qx_bool(true); } };
  55. template <>
  56. struct QxConvert_FromString< QVariant >
  57. {
  58. static inline qx_bool fromString(const QString & s, QVariant & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  59. {
  60. Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx);
  61. #ifndef _QX_NO_JSON
  62. if (s.startsWith("$$JSON$$"))
  63. {
  64. QJsonParseError err;
  65. QString stream = s.right(s.size() - 16); // $$JSON$$0000XX$$
  66. QJsonDocument doc = QJsonDocument::fromJson(stream.toUtf8(), (& err));
  67. if (err.error == QJsonParseError::NoError)
  68. {
  69. QJsonValue json = (doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object()));
  70. t = json.toVariant(); return qx_bool(true);
  71. }
  72. }
  73. #endif // _QX_NO_JSON
  74. t = QVariant(s);
  75. return qx_bool(true);
  76. }
  77. };
  78. template <> struct QxConvert_FromString< qx_bool > {
  79. static inline qx_bool fromString(const QString & s, qx_bool & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  80. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t.fromString(s); return qx_bool(true); } };
  81. template <> struct QxConvert_FromString< bool > {
  82. static inline qx_bool fromString(const QString & s, bool & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  83. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = (((s == "0") || s.trimmed().isEmpty()) ? false : true); return qx_bool(true); } };
  84. template <> struct QxConvert_FromString< char > {
  85. static inline qx_bool fromString(const QString & s, char & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  86. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = (s.isEmpty() ? ' ' : s.toLatin1().at(0)); return (! s.isEmpty()); } };
  87. template <> struct QxConvert_FromString< short > {
  88. static inline qx_bool fromString(const QString & s, short & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  89. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = s.toShort(& bOk); return bOk; } };
  90. template <> struct QxConvert_FromString< int > {
  91. static inline qx_bool fromString(const QString & s, int & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  92. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = s.toInt(& bOk); return bOk; } };
  93. template <> struct QxConvert_FromString< long > {
  94. static inline qx_bool fromString(const QString & s, long & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  95. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<long>(s.toLongLong(& bOk)); return bOk; } };
  96. template <> struct QxConvert_FromString< long long > {
  97. static inline qx_bool fromString(const QString & s, long long & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  98. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<long long>(s.toLongLong(& bOk)); return bOk; } };
  99. template <> struct QxConvert_FromString< float > {
  100. static inline qx_bool fromString(const QString & s, float & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  101. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<float>(s.toDouble(& bOk)); return bOk; } };
  102. template <> struct QxConvert_FromString< double > {
  103. static inline qx_bool fromString(const QString & s, double & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  104. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = s.toDouble(& bOk); return bOk; } };
  105. template <> struct QxConvert_FromString< unsigned short > {
  106. static inline qx_bool fromString(const QString & s, unsigned short & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  107. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<unsigned short>(s.toUShort(& bOk)); return bOk; } };
  108. template <> struct QxConvert_FromString< unsigned int > {
  109. static inline qx_bool fromString(const QString & s, unsigned int & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  110. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<unsigned int>(s.toUInt(& bOk)); return bOk; } };
  111. template <> struct QxConvert_FromString< unsigned long > {
  112. static inline qx_bool fromString(const QString & s, unsigned long & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  113. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<unsigned long>(s.toULongLong(& bOk)); return bOk; } };
  114. template <> struct QxConvert_FromString< unsigned long long > {
  115. static inline qx_bool fromString(const QString & s, unsigned long long & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  116. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); bool bOk = false; t = static_cast<unsigned long long>(s.toULongLong(& bOk)); return bOk; } };
  117. template <> struct QxConvert_FromString< qx::QxDateNeutral > {
  118. static inline qx_bool fromString(const QString & s, qx::QxDateNeutral & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  119. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = qx::QxDateNeutral::fromNeutral(s); return qx_bool(true); } };
  120. template <> struct QxConvert_FromString< qx::QxTimeNeutral > {
  121. static inline qx_bool fromString(const QString & s, qx::QxTimeNeutral & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  122. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = qx::QxTimeNeutral::fromNeutral(s); return qx_bool(true); } };
  123. template <> struct QxConvert_FromString< qx::QxDateTimeNeutral > {
  124. static inline qx_bool fromString(const QString & s, qx::QxDateTimeNeutral & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  125. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = qx::QxDateTimeNeutral::fromNeutral(s); return qx_bool(true); } };
  126. template <> struct QxConvert_FromString< std::string > {
  127. static inline qx_bool fromString(const QString & s, std::string & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  128. #ifndef QT_NO_STL
  129. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = s.toStdString(); return qx_bool(true); } };
  130. #else // QT_NO_STL
  131. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = s.toLatin1().constData(); return qx_bool(true); } };
  132. #endif // QT_NO_STL
  133. template <> struct QxConvert_FromString< std::wstring > {
  134. static inline qx_bool fromString(const QString & s, std::wstring & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  135. #if ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
  136. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = s.toStdWString(); return qx_bool(true); } };
  137. #else // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
  138. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); Q_UNUSED(t); Q_UNUSED(s); qAssert(false); /* Need STL compatibility ! */ return qx_bool(true); } };
  139. #endif // ((! defined(QT_NO_STL)) && (! defined(QT_NO_STL_WCHAR)))
  140. #ifndef _QX_NO_JSON
  141. template <>
  142. struct QxConvert_FromString< QJsonValue >
  143. {
  144. static inline qx_bool fromString(const QString & s, QJsonValue & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  145. {
  146. Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx);
  147. QJsonParseError jsonError;
  148. QByteArray dataAsByteArray = s.toUtf8();
  149. QJsonDocument doc = QJsonDocument::fromJson(dataAsByteArray, (& jsonError));
  150. if (jsonError.error != QJsonParseError::NoError) { return qx_bool(static_cast<long>(jsonError.error), jsonError.errorString()); }
  151. t = (doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object()));
  152. return qx_bool(true);
  153. }
  154. };
  155. #endif // _QX_NO_JSON
  156. #ifdef _QX_ENABLE_BOOST
  157. template <typename T> struct QxConvert_FromString< boost::optional<T> > {
  158. static inline qx_bool fromString(const QString & s, boost::optional<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  159. { if (! t) { t = T(); }; return qx::cvt::from_string(s, (* t), format, index, ctx); } };
  160. #endif // _QX_ENABLE_BOOST
  161. template <typename T1, typename T2> struct QxConvert_FromString< std::pair<T1, T2> > {
  162. static inline qx_bool fromString(const QString & s, std::pair<T1, T2> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  163. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  164. template <typename T1, typename T2> struct QxConvert_FromString< QPair<T1, T2> > {
  165. static inline qx_bool fromString(const QString & s, QPair<T1, T2> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  166. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  167. template <typename T> struct QxConvert_FromString< std::vector<T> > {
  168. static inline qx_bool fromString(const QString & s, std::vector<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  169. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  170. template <typename T> struct QxConvert_FromString< std::list<T> > {
  171. static inline qx_bool fromString(const QString & s, std::list<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  172. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  173. template <typename T> struct QxConvert_FromString< std::set<T> > {
  174. static inline qx_bool fromString(const QString & s, std::set<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  175. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  176. #ifdef _QX_ENABLE_BOOST
  177. template <typename T> struct QxConvert_FromString< boost::unordered_set<T> > {
  178. static inline qx_bool fromString(const QString & s, boost::unordered_set<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  179. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  180. template <typename T> struct QxConvert_FromString< boost::unordered_multiset<T> > {
  181. static inline qx_bool fromString(const QString & s, boost::unordered_multiset<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  182. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  183. #endif // _QX_ENABLE_BOOST
  184. template <typename T> struct QxConvert_FromString< std::unordered_set<T> > {
  185. static inline qx_bool fromString(const QString & s, std::unordered_set<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  186. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  187. template <typename T> struct QxConvert_FromString< std::unordered_multiset<T> > {
  188. static inline qx_bool fromString(const QString & s, std::unordered_multiset<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  189. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  190. template <typename T> struct QxConvert_FromString< QVector<T> > {
  191. static inline qx_bool fromString(const QString & s, QVector<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  192. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  193. template <typename T> struct QxConvert_FromString< QList<T> > {
  194. static inline qx_bool fromString(const QString & s, QList<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  195. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  196. template <typename T> struct QxConvert_FromString< QLinkedList<T> > {
  197. static inline qx_bool fromString(const QString & s, QLinkedList<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  198. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  199. template <typename T> struct QxConvert_FromString< QFlags<T> > {
  200. static inline qx_bool fromString(const QString & s, QFlags<T> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  201. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); t = QFlags<T>(QFlag(s.toInt())); return true; } };
  202. template <typename Key, typename Value> struct QxConvert_FromString< std::map<Key, Value> > {
  203. static inline qx_bool fromString(const QString & s, std::map<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  204. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  205. #ifdef _QX_ENABLE_BOOST
  206. template <typename Key, typename Value> struct QxConvert_FromString< boost::unordered_map<Key, Value> > {
  207. static inline qx_bool fromString(const QString & s, boost::unordered_map<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  208. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  209. template <typename Key, typename Value> struct QxConvert_FromString< boost::unordered_multimap<Key, Value> > {
  210. static inline qx_bool fromString(const QString & s, boost::unordered_multimap<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  211. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  212. #endif // _QX_ENABLE_BOOST
  213. template <typename Key, typename Value> struct QxConvert_FromString< std::unordered_map<Key, Value> > {
  214. static inline qx_bool fromString(const QString & s, std::unordered_map<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  215. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  216. template <typename Key, typename Value> struct QxConvert_FromString< std::unordered_multimap<Key, Value> > {
  217. static inline qx_bool fromString(const QString & s, std::unordered_multimap<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  218. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  219. template <typename Key, typename Value> struct QxConvert_FromString< QHash<Key, Value> > {
  220. static inline qx_bool fromString(const QString & s, QHash<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  221. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  222. template <typename Key, typename Value> struct QxConvert_FromString< QMultiHash<Key, Value> > {
  223. static inline qx_bool fromString(const QString & s, QMultiHash<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  224. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  225. template <typename Key, typename Value> struct QxConvert_FromString< QMap<Key, Value> > {
  226. static inline qx_bool fromString(const QString & s, QMap<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  227. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  228. template <typename Key, typename Value> struct QxConvert_FromString< QMultiMap<Key, Value> > {
  229. static inline qx_bool fromString(const QString & s, QMultiMap<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  230. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  231. template <typename Key, typename Value> struct QxConvert_FromString< qx::QxCollection<Key, Value> > {
  232. static inline qx_bool fromString(const QString & s, qx::QxCollection<Key, Value> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  233. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  234. #ifdef _QX_ENABLE_BOOST
  235. template <typename T1> struct QxConvert_FromString< boost::tuple<T1> > {
  236. static inline qx_bool fromString(const QString & s, boost::tuple<T1> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  237. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  238. template <typename T1, typename T2> struct QxConvert_FromString< boost::tuple<T1, T2> > {
  239. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  240. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  241. template <typename T1, typename T2, typename T3> struct QxConvert_FromString< boost::tuple<T1, T2, T3> > {
  242. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  243. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  244. template <typename T1, typename T2, typename T3, typename T4> struct QxConvert_FromString< boost::tuple<T1, T2, T3, T4> > {
  245. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3, T4> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  246. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  247. template <typename T1, typename T2, typename T3, typename T4, typename T5> struct QxConvert_FromString< boost::tuple<T1, T2, T3, T4, T5> > {
  248. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3, T4, T5> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  249. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  250. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct QxConvert_FromString< boost::tuple<T1, T2, T3, T4, T5, T6> > {
  251. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3, T4, T5, T6> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  252. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  253. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct QxConvert_FromString< boost::tuple<T1, T2, T3, T4, T5, T6, T7> > {
  254. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3, T4, T5, T6, T7> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  255. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  256. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct QxConvert_FromString< boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8> > {
  257. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  258. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  259. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> struct QxConvert_FromString< boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> > {
  260. static inline qx_bool fromString(const QString & s, boost::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  261. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  262. #endif // _QX_ENABLE_BOOST
  263. template <typename T1> struct QxConvert_FromString< std::tuple<T1> > {
  264. static inline qx_bool fromString(const QString & s, std::tuple<T1> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  265. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  266. template <typename T1, typename T2> struct QxConvert_FromString< std::tuple<T1, T2> > {
  267. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  268. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  269. template <typename T1, typename T2, typename T3> struct QxConvert_FromString< std::tuple<T1, T2, T3> > {
  270. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  271. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  272. template <typename T1, typename T2, typename T3, typename T4> struct QxConvert_FromString< std::tuple<T1, T2, T3, T4> > {
  273. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3, T4> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  274. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  275. template <typename T1, typename T2, typename T3, typename T4, typename T5> struct QxConvert_FromString< std::tuple<T1, T2, T3, T4, T5> > {
  276. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3, T4, T5> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  277. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  278. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct QxConvert_FromString< std::tuple<T1, T2, T3, T4, T5, T6> > {
  279. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3, T4, T5, T6> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  280. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  281. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct QxConvert_FromString< std::tuple<T1, T2, T3, T4, T5, T6, T7> > {
  282. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3, T4, T5, T6, T7> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  283. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  284. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct QxConvert_FromString< std::tuple<T1, T2, T3, T4, T5, T6, T7, T8> > {
  285. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3, T4, T5, T6, T7, T8> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  286. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  287. template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> struct QxConvert_FromString< std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> > {
  288. static inline qx_bool fromString(const QString & s, std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> & t, const QString & format, int index, qx::cvt::context::ctx_type ctx)
  289. { Q_UNUSED(format); Q_UNUSED(index); Q_UNUSED(ctx); return QX_CVT_DEFAULT_ARCHIVE::from_string(t, s); } };
  290. } // namespace detail
  291. } // namespace cvt
  292. } // namespace qx