DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DAPyDType.h
1#ifndef DAPYDTYPE_H
2#define DAPYDTYPE_H
3#include "DAPyBindQtGlobal.h"
4#include "DAPyObjectWrapper.h"
5#include <QVariant>
6#include <QDebug>
7#include "DAPybind11InQt.h"
8namespace DA
9{
36class DAPYBINDQT_API DAPyDType : public DAPyObjectWrapper
37{
38public:
39 DAPyDType() = default;
40 DAPyDType(const DAPyDType& s);
42 DAPyDType(const pybind11::object& obj);
43 DAPyDType(pybind11::object&& obj);
44 DAPyDType(const pybind11::dtype& obj);
45 DAPyDType(pybind11::dtype&& obj);
46 DAPyDType(const QString& dtypename);
47 ~DAPyDType();
48 static bool isDtypeObj(const pybind11::object& obj);
49 DAPyDType& operator=(const pybind11::dtype& obj);
50 DAPyDType& operator=(const pybind11::object& obj);
51 DAPyDType& operator=(const DAPyDType& obj);
52 DAPyDType& operator=(const DAPyObjectWrapper& obj);
53 bool operator==(const DAPyDType& other) const;
54 bool operator!=(const DAPyDType& other) const;
55
56public:
57 //创建变量
58 pybind11::object type(const QVariant& v) const;
59 // dtype.name
60 QString name() const;
61 // dtype.kind
62 char kind() const;
63 // dtype.char
64 char char_() const;
65 // dtype.num
66 int num() const;
67
68public:
69 bool isInt() const;
70 bool isUInt() const;
71 bool isFloat() const;
72 bool isTimedelta() const;
73 bool isDatetime() const;
74 bool isComplex() const;
75 bool isBool() const;
76 bool isStr() const;
77 bool isNumeral() const;
78
79public:
80 //获取所有的dtype类型名称
81 static QStringList dtypeNames();
82
83protected:
84 //检测是否为numpy.dtype,如果不是将会设置为none
85 void checkObjectValid();
86};
87} // namespace DA
88Q_DECLARE_METATYPE(DA::DAPyDType)
89DAPYBINDQT_API QDebug operator<<(QDebug dbg, const DA::DAPyDType& d);
90#endif // DAPYDTYPE_H
对numpy.dtype的封装
Definition DAPyDType.h:37
这是针对pubind11::object的封装
Definition DAPyObjectWrapper.h:15
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44