Tianchi  v0.0.2 build 20130701
C++ library for Qt with VC & mingW
tcutils.h
1 // **************************************************************************
2 // Tianchi C++ library for Qt (open source)
3 // 天池共享源码库
4 // 版权所有 (C) 天池共享源码库开发组
5 // 授权协议:请阅读天池共享源码库附带的授权协议
6 // **************************************************************************
7 // 文档说明:常用功能函数
8 // ==========================================================================
9 // 开发日志:
10 // 日期 人员 说明
11 // --------------------------------------------------------------------------
12 // 2013.04.10 圣域天子 建立
13 //
14 // ==========================================================================
16 // ==========================================================================
17 #ifndef TIANCHI_TCUTILS_H
18 #define TIANCHI_TCUTILS_H
19 
20 #include <tianchi/tcglobal.h>
21 
22 #ifdef QT_WIDGETS_LIB
23  #include <QMessageBox>
24 #endif
25 
26 #include <QTextCodec>
27 #include <QVariant>
28 
29 #include <QDateTime>
30 
31 #include <QString>
32 #include <QStringList>
33 #include <QByteArray>
34 #include <QComboBox>
35 
36 #include <QThread>
37 
39 struct TcOperMode
40 {
41 const static int Append = 1;
42 const static int Change = 2;
43 const static int Delete = 4;
44 
45 const static int CopyCell = 301;
46 const static int CopyCells = 302;
47 const static int CopyColumn = 303;
48 const static int CopyLine = 304;
49 const static int CopyTable = 305;
50 };
51 
55 class TIANCHI_API TcUtils
56 {
57 public:
59  static QHash<QString, QString> StringToMap(const QString& mapStrings);
61  static QHash<QString, QString> StringToMap(const QStringList& mapStrings);
62 
64  static char typeFrom(QVariant::Type type);
66  static char typeFrom(const QVariant& v)
67  {
68  return typeFrom(v.type());
69  }
70 
71  const static qint64 JULIAN_DAY = 2415019;
73  static QDateTime toDateTime(const QString& text);
75  static QDateTime toDateTime(double timeDouble);
76 
78  static char getIDCardVerifyCode(const QByteArray& id);
79 
81  static QDateTime complieDateTime(const QString& complieDate, const QString& complieTime);
82 
83  static QByteArray addField(const QString& key, const QVariant& value);
84  static QHash<QString, QByteArray> byFields(const QByteArray& fieldBytes);
85 
86 };
87 
88 #endif // TIANCHI_UTILS_H