├── .gitignore
├── QAF.pro
├── README.MD
├── bin
├── conf
│ └── run.xml
└── qtplugins
│ ├── sqlitecipher.dll
│ └── sqlitecipherd.dll
├── docs
└── 设计文档.docx
├── include
├── DBManager
│ ├── dbmanager.h
│ └── dbmanager_global.h
├── NetWork
│ ├── Handler.h
│ ├── Package.h
│ ├── Protocol.h
│ ├── TCPServer.h
│ ├── TcpClient.h
│ ├── UDPClient.h
│ ├── UDPServer.h
│ └── network_global.h
├── QAFCore
│ ├── AbstractObject.h
│ ├── AbstractPlugin.h
│ ├── AbstractSystem.h
│ ├── AbstractTreeModel.h
│ ├── CommonTreeModel.h
│ ├── ConfigModel.h
│ ├── ConfigSystem.h
│ ├── LogModel.h
│ ├── Logger.h
│ ├── ModelItem.h
│ ├── ObjectModel.h
│ ├── ObjectProxy.h
│ ├── ObjectPtr.h
│ ├── ObjectSystem.h
│ ├── PluginSystem.h
│ ├── QAFContext.h
│ ├── QAFCore.h
│ ├── QAFDirs.h
│ ├── QAFException.h
│ ├── QAFGlobal.h
│ ├── QAFLogger.h
│ ├── Serializable.h
│ ├── UIInterface.h
│ ├── qafcore_global.h
│ └── resource.h
├── QtAwesome
│ ├── QtAwesome.h
│ ├── QtAwesomeAnim.h
│ └── qtawesome_global.h
├── QtPropertyBrowser
│ ├── qtbuttonpropertybrowser.h
│ ├── qteditorfactory.h
│ ├── qtgroupboxpropertybrowser.h
│ ├── qtpropertybrowser.h
│ ├── qtpropertybrowserutils_p.h
│ ├── qtpropertymanager.h
│ ├── qttreepropertybrowser.h
│ └── qtvariantproperty.h
├── Utils
│ ├── BaseException.h
│ ├── Ensure.h
│ ├── Singleton.h
│ ├── utils.h
│ └── utils_global.h
├── google
│ └── protobuf
│ │ ├── any.h
│ │ ├── any.pb.h
│ │ ├── any.proto
│ │ ├── api.pb.h
│ │ ├── api.proto
│ │ ├── arena.h
│ │ ├── arenastring.h
│ │ ├── compiler
│ │ ├── code_generator.h
│ │ ├── command_line_interface.h
│ │ ├── cpp
│ │ │ └── cpp_generator.h
│ │ ├── csharp
│ │ │ ├── csharp_generator.h
│ │ │ └── csharp_names.h
│ │ ├── importer.h
│ │ ├── java
│ │ │ ├── java_generator.h
│ │ │ └── java_names.h
│ │ ├── javanano
│ │ │ └── javanano_generator.h
│ │ ├── js
│ │ │ └── js_generator.h
│ │ ├── objectivec
│ │ │ ├── objectivec_generator.h
│ │ │ └── objectivec_helpers.h
│ │ ├── parser.h
│ │ ├── php
│ │ │ └── php_generator.h
│ │ ├── plugin.h
│ │ ├── plugin.pb.h
│ │ ├── plugin.proto
│ │ ├── python
│ │ │ └── python_generator.h
│ │ └── ruby
│ │ │ └── ruby_generator.h
│ │ ├── descriptor.h
│ │ ├── descriptor.pb.h
│ │ ├── descriptor.proto
│ │ ├── descriptor_database.h
│ │ ├── duration.pb.h
│ │ ├── duration.proto
│ │ ├── dynamic_message.h
│ │ ├── empty.pb.h
│ │ ├── empty.proto
│ │ ├── extension_set.h
│ │ ├── field_mask.pb.h
│ │ ├── field_mask.proto
│ │ ├── generated_enum_reflection.h
│ │ ├── generated_enum_util.h
│ │ ├── generated_message_reflection.h
│ │ ├── generated_message_util.h
│ │ ├── has_bits.h
│ │ ├── io
│ │ ├── coded_stream.h
│ │ ├── gzip_stream.h
│ │ ├── printer.h
│ │ ├── strtod.h
│ │ ├── tokenizer.h
│ │ ├── zero_copy_stream.h
│ │ ├── zero_copy_stream_impl.h
│ │ └── zero_copy_stream_impl_lite.h
│ │ ├── map.h
│ │ ├── map_entry.h
│ │ ├── map_entry_lite.h
│ │ ├── map_field.h
│ │ ├── map_field_inl.h
│ │ ├── map_field_lite.h
│ │ ├── map_type_handler.h
│ │ ├── message.h
│ │ ├── message_lite.h
│ │ ├── metadata.h
│ │ ├── reflection.h
│ │ ├── reflection_ops.h
│ │ ├── repeated_field.h
│ │ ├── service.h
│ │ ├── source_context.pb.h
│ │ ├── source_context.proto
│ │ ├── struct.pb.h
│ │ ├── struct.proto
│ │ ├── stubs
│ │ ├── atomic_sequence_num.h
│ │ ├── atomicops.h
│ │ ├── atomicops_internals_arm64_gcc.h
│ │ ├── atomicops_internals_arm_gcc.h
│ │ ├── atomicops_internals_arm_qnx.h
│ │ ├── atomicops_internals_atomicword_compat.h
│ │ ├── atomicops_internals_generic_gcc.h
│ │ ├── atomicops_internals_macosx.h
│ │ ├── atomicops_internals_mips_gcc.h
│ │ ├── atomicops_internals_pnacl.h
│ │ ├── atomicops_internals_power.h
│ │ ├── atomicops_internals_ppc_gcc.h
│ │ ├── atomicops_internals_solaris.h
│ │ ├── atomicops_internals_tsan.h
│ │ ├── atomicops_internals_x86_gcc.h
│ │ ├── atomicops_internals_x86_msvc.h
│ │ ├── bytestream.h
│ │ ├── callback.h
│ │ ├── casts.h
│ │ ├── common.h
│ │ ├── fastmem.h
│ │ ├── hash.h
│ │ ├── logging.h
│ │ ├── macros.h
│ │ ├── mutex.h
│ │ ├── once.h
│ │ ├── platform_macros.h
│ │ ├── port.h
│ │ ├── scoped_ptr.h
│ │ ├── shared_ptr.h
│ │ ├── singleton.h
│ │ ├── status.h
│ │ ├── stl_util.h
│ │ ├── stringpiece.h
│ │ ├── template_util.h
│ │ └── type_traits.h
│ │ ├── text_format.h
│ │ ├── timestamp.pb.h
│ │ ├── timestamp.proto
│ │ ├── type.pb.h
│ │ ├── type.proto
│ │ ├── unknown_field_set.h
│ │ ├── util
│ │ ├── field_comparator.h
│ │ ├── field_mask_util.h
│ │ ├── json_util.h
│ │ ├── message_differencer.h
│ │ ├── time_util.h
│ │ ├── type_resolver.h
│ │ └── type_resolver_util.h
│ │ ├── wire_format.h
│ │ ├── wire_format_lite.h
│ │ ├── wire_format_lite_inl.h
│ │ ├── wrappers.pb.h
│ │ └── wrappers.proto
└── log4qt
│ ├── appender.h
│ ├── appenderskeleton.h
│ ├── basicconfigurator.h
│ ├── consoleappender.h
│ ├── dailyrollingfileappender.h
│ ├── fileappender.h
│ ├── helpers
│ ├── classlogger.h
│ ├── configuratorhelper.h
│ ├── datetime.h
│ ├── factory.h
│ ├── initialisationhelper.h
│ ├── logerror.h
│ ├── logobject.h
│ ├── logobjectptr.h
│ ├── optionconverter.h
│ ├── patternformatter.h
│ └── properties.h
│ ├── hierarchy.h
│ ├── layout.h
│ ├── level.h
│ ├── log4qt.h
│ ├── log4qt_global.h
│ ├── logger.h
│ ├── loggerrepository.h
│ ├── loggingevent.h
│ ├── logmanager.h
│ ├── mdc.h
│ ├── ndc.h
│ ├── patternlayout.h
│ ├── propertyconfigurator.h
│ ├── rollingfileappender.h
│ ├── simplelayout.h
│ ├── ttcclayout.h
│ └── writerappender.h
└── src
├── DBManager
├── DBManager.pri
├── DBManager.pro
├── DBManager.vcxproj
├── DBManager.vcxproj.filters
├── dbmanager.cpp
├── dbmanager.h
└── dbmanager_global.h
├── NetWork
├── Handler.h
├── NetWork.pri
├── NetWork.pro
├── NetWork.vcxproj
├── NetWork.vcxproj.filters
├── Package.cpp
├── Package.h
├── Protocol.cpp
├── Protocol.h
├── TCPServer.cpp
├── TCPServer.h
├── TcpClient.cpp
├── TcpClient.h
├── UDPClient.cpp
├── UDPClient.h
├── UDPServer.cpp
├── UDPServer.h
└── network_global.h
├── QAF
├── QAF.ico
├── QAF.pri
├── QAF.pro
├── QAF.rc
├── QAF.vcxproj
├── QAF.vcxproj.filters
├── Resources
│ ├── folder.png
│ ├── gear.png
│ └── startup.png
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── qaf.qrc
├── qafapplication.cpp
├── qafapplication.h
├── rc
│ ├── Hmovetoolbar.png
│ ├── Hsepartoolbar.png
│ ├── Vmovetoolbar.png
│ ├── Vsepartoolbar.png
│ ├── branch_closed-on.png
│ ├── branch_closed.png
│ ├── branch_open-on.png
│ ├── branch_open.png
│ ├── checkbox_checked.png
│ ├── checkbox_checked_disabled.png
│ ├── checkbox_checked_focus.png
│ ├── checkbox_indeterminate.png
│ ├── checkbox_indeterminate_disabled.png
│ ├── checkbox_indeterminate_focus.png
│ ├── checkbox_unchecked.png
│ ├── checkbox_unchecked_disabled.png
│ ├── checkbox_unchecked_focus.png
│ ├── close-hover.png
│ ├── close-pressed.png
│ ├── close.png
│ ├── down_arrow.png
│ ├── down_arrow_disabled.png
│ ├── left_arrow.png
│ ├── left_arrow_disabled.png
│ ├── radio_checked.png
│ ├── radio_checked_disabled.png
│ ├── radio_checked_focus.png
│ ├── radio_unchecked.png
│ ├── radio_unchecked_disabled.png
│ ├── radio_unchecked_focus.png
│ ├── right_arrow.png
│ ├── right_arrow_disabled.png
│ ├── sizegrip.png
│ ├── stylesheet-branch-end.png
│ ├── stylesheet-branch-more.png
│ ├── stylesheet-vline.png
│ ├── transparent.png
│ ├── undock.png
│ ├── up_arrow.png
│ └── up_arrow_disabled.png
├── stdafx.cpp
├── stdafx.h
├── style.qrc
└── style.qss
├── QAFCore
├── AbstractObject.cpp
├── AbstractObject.h
├── AbstractPlugin.h
├── AbstractSystem.h
├── ConfigModel.cpp
├── ConfigModel.h
├── ConfigSystem.cpp
├── ConfigSystem.h
├── LogModel.cpp
├── LogModel.h
├── ObjectModel.cpp
├── ObjectModel.h
├── ObjectProxy.cpp
├── ObjectProxy.h
├── ObjectPtr.h
├── ObjectSystem.cpp
├── ObjectSystem.h
├── PluginSystem.cpp
├── PluginSystem.h
├── QAFContext.cpp
├── QAFContext.h
├── QAFCore.cpp
├── QAFCore.h
├── QAFCore.pri
├── QAFCore.pro
├── QAFCore.qrc
├── QAFCore.rc
├── QAFCore.vcxproj
├── QAFCore.vcxproj.filters
├── QAFGlobal.h
├── QAFLogger.cpp
├── QAFLogger.h
├── Resources
│ ├── folder.png
│ ├── gear.png
│ ├── xml_attr.png
│ └── xml_text.png
├── Serializable.cpp
├── Serializable.h
├── UIInterface.h
├── qafcore_global.h
└── resource.h
├── QtAwesome
├── QtAwesome.cpp
├── QtAwesome.h
├── QtAwesome.pri
├── QtAwesome.pro
├── QtAwesome.qrc
├── QtAwesome.vcxproj
├── QtAwesome.vcxproj.filters
├── QtAwesomeAnim.cpp
├── QtAwesomeAnim.h
├── fonts
│ └── fontawesome-4.6.1.ttf
└── qtawesome_global.h
├── QtCommonModel
├── ModelItem.cpp
├── ModelItem.h
├── QtCommonModel.cpp
├── QtCommonModel.h
├── QtCommonModel.pri
├── QtCommonModel.pro
├── QtCommonModel.vcxproj
├── QtCommonModel.vcxproj.filters
├── QtRowTableModel.h
└── qtcommonmodel_global.h
├── QtCustomWidgets
├── QNoTitleWidget.cpp
├── QNoTitleWidget.h
├── QtCustomWidgets.vcxproj
└── qtcustomwidgets_global.h
├── UIPlugin
├── ConfigDialog.cpp
├── ConfigDialog.h
├── ConfigDialog.ui
├── ConsoleWidget.cpp
├── ConsoleWidget.h
├── ConsoleWidget.ui
├── PropertyEditerWidget.cpp
├── PropertyEditerWidget.h
├── UIPlugin.cpp
├── UIPlugin.h
├── UIPlugin.pri
├── UIPlugin.pro
├── UIPlugin.qrc
├── UIPlugin.vcxproj
├── UIPlugin.vcxproj.filters
└── uiplugin_global.h
├── Utils
├── BaseException.h
├── Ensure.h
├── Singleton.h
├── Utils.pri
├── Utils.pro
├── utils.h
└── utils_global.h
├── counter.py
├── examples
└── testPlugin
│ ├── TestUI.cpp
│ ├── TestUI.h
│ ├── TestUI.ui
│ ├── testPlugin.pri
│ ├── testPlugin.pro
│ ├── testPlugin.vcxproj
│ ├── testPlugin.vcxproj.filters
│ ├── testplugin.cpp
│ ├── testplugin.h
│ └── testplugin_global.h
└── tests
└── testNetWork
├── TestUtils.cpp
├── TestUtils.h
├── Test_Network.cpp
├── Test_Network.h
├── testNetWork.pri
├── testNetWork.pro
├── testNetWork.vcxproj
└── testNetWork.vcxproj.filters
/QAF.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | #message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 | TEMPLATE = subdirs
10 |
11 | CONFIG += ordered
12 |
13 | SUBDIRS += src/NetWork/NetWork.pro \
14 | src/DBManager/DBManager.pro \
15 | src/QtAwesome/QtAwesome.pro \
16 | src/QtCommonModel/QtCommonModel.pro \
17 | #src/Utils/Utils.pro \
18 | src/QAFCore/QAFCore.pro \
19 | src/QAF/QAF.pro \
20 | src/UIPlugin/UIPlugin.pro \
21 | src/tests/testNetWork/testNetWork.pro \
22 | src/examples/testPlugin/testPlugin.pro
23 |
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 | 基于Qt应用程序开发的通用软件实例、提供日志管理、对象管理、属性编辑、运行配置等常用功能
2 | ,框架采用插件式开发,降低模块间耦合性,未来还会加入python脚本的支持,以方便应用灵活拓展,
3 | 本人水平有限,欢迎批评指正。
4 |
5 | ## 1、开发环境
6 | Qt5.5.1+msvc2013
7 |
8 | ## 2、工程配置
9 | 输出目录 $(SolutionDir)bin\$(Configuration)\
10 | 中间目录 $(SolutionDir)temp\$(ProjectName)\$(Configuration)\
11 | 目标文件名 $(ProjectName)d
12 | 目标文件扩展名 .dll
13 | 输出文件 $(OutDir)\$(TargetName)$(TargetExt)
14 | 附加库目录 $(SolutionDir)lib
15 | 附加包含目录 $(SolutionDir)xxx
16 |
17 | 某些项目需添加生成后事件:
18 | copy $(TargetPath) $(SolutionDir)bin\$(Configuration)
19 | copy $(OutDir)$(TargetName).pdb $(SolutionDir)bin\$(Configuration)
20 | copy $(ProjectDir)*.h $(SolutionDir)include\$(ProjectName)
21 |
22 | ## 3、输出目录结果说明:
23 | conf 配置文件
24 | log 日志文件
25 | lang 翻译文件
26 | style 样式
27 | data 公用数据文件
28 | $(Configuration) 主程序目录
29 | $(Configuration)/plugin 插件目录
30 |
31 | ## 4、运行环境:
32 | 第三方依赖库放在./lib下,需要拷贝到对应应用程序目录
33 |
34 | ## 5、预处理器定义
35 | SINGLETON_APPLICTION 应用程序单实例
36 | WITHOUT_LOG 消除日志
37 |
38 | ## 6、功能列表
39 | 内存托管
40 | 常用Qt扩展类
41 | AwesomeFont支持
42 | 网络传输
43 | 配置文件管理
44 | 插件管理
45 | 界面可定制化
46 | 日志管理
47 |
48 | ## 7、更新日志
49 |
--------------------------------------------------------------------------------
/bin/conf/run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/bin/qtplugins/sqlitecipher.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/bin/qtplugins/sqlitecipher.dll
--------------------------------------------------------------------------------
/bin/qtplugins/sqlitecipherd.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/bin/qtplugins/sqlitecipherd.dll
--------------------------------------------------------------------------------
/docs/设计文档.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/docs/设计文档.docx
--------------------------------------------------------------------------------
/include/DBManager/dbmanager.h:
--------------------------------------------------------------------------------
1 | #ifndef DBMANAGER_H
2 | #define DBMANAGER_H
3 |
4 | #include "dbmanager_global.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | class QSqlDatabase;
13 |
14 | class DBMANAGER_EXPORT DBManager : public QObject
15 | {
16 | public:
17 | DBManager(const QString& dbType,QObject *parent = 0);
18 | ~DBManager();
19 |
20 | inline bool isOpened() const;
21 |
22 | bool open(const QString& dbName,const QString& user, const QString& psw, const QString& address,int port);
23 |
24 | bool execSql(const QString& sql);
25 |
26 | bool update(const QString& table,const QMap& values,const QString& _where = "");
27 |
28 | bool remove(const QString& table,const QString& _where = "");
29 |
30 | bool add(const QString& table,const QMap& values);
31 |
32 | QList> query(const QString& table,/*[Output]*/QStringList& columns=QStringList(),const QString& _where = "");
33 |
34 | void close();
35 |
36 | private:
37 | QSqlDatabase* mDB;
38 | };
39 |
40 | #endif // DBMANAGER_H
41 |
--------------------------------------------------------------------------------
/include/DBManager/dbmanager_global.h:
--------------------------------------------------------------------------------
1 | #ifndef DBMANAGER_GLOBAL_H
2 | #define DBMANAGER_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef DBMANAGER_LIB
7 | # define DBMANAGER_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define DBMANAGER_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // DBMANAGER_GLOBAL_H
--------------------------------------------------------------------------------
/include/NetWork/Handler.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class Package;
4 |
5 | struct ReqeustContext
6 | {
7 | QHostAddress Address;
8 | quint16 Port;
9 | };
10 |
11 | class Handler
12 | {
13 | public:
14 | virtual QSharedPointer doHandle(const ReqeustContext&,QSharedPointer) = 0;
15 | };
16 |
17 |
--------------------------------------------------------------------------------
/include/NetWork/Package.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "network_global.h"
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #ifndef PACKAGE_VERSION
12 | #define PACKAGE_VERSION 1
13 | #endif // !PACKAGE_VERSION
14 |
15 | #define DECLARE_CLASS_NAME(class_name) static QByteArray className() { return #class_name;} \
16 | virtual QByteArray packageType() { return class_name::className(); }
17 |
18 | struct PackageHeader
19 | {
20 | qint16 Version;
21 |
22 | PackageHeader() : Version(PACKAGE_VERSION){}
23 | };
24 |
25 | class Package
26 | {
27 | public:
28 | Package(){}
29 | virtual ~Package(){}
30 |
31 | DECLARE_CLASS_NAME(Package)
32 |
33 | virtual bool pack(QDataStream& stream) = 0
34 | {
35 | stream << packageType() << mHeader.Version;
36 | return true;
37 | }
38 |
39 | virtual bool unpack(QDataStream& stream) = 0
40 | {
41 | stream >> mHeader.Version;
42 | return true;
43 | }
44 |
45 | qint16 version() const { return mHeader.Version; }
46 |
47 | void setVersion(qint16 version_) { mHeader.Version = version_; }
48 |
49 | protected:
50 | PackageHeader mHeader;
51 | };
52 |
53 | class NETWORK_EXPORT ObjectFactory
54 | {
55 | public:
56 | template
57 | static void registerClass()
58 | {
59 | constructors().insert(T::className(), &constructorHelper);
60 | }
61 |
62 | static QSharedPointer createObject(const QByteArray& className);
63 |
64 | private:
65 | typedef Package* (*Constructor)();
66 |
67 | template
68 | static Package* constructorHelper()
69 | {
70 | return new T();
71 | }
72 |
73 | static QHash& constructors();
74 | };
75 |
--------------------------------------------------------------------------------
/include/NetWork/Protocol.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/NetWork/Protocol.h
--------------------------------------------------------------------------------
/include/NetWork/TCPServer.h:
--------------------------------------------------------------------------------
1 | #ifndef TCPSERVER_H
2 | #define TCPSERVER_H
3 |
4 | #include "network_global.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "Handler.h"
12 | #include "network_global.h"
13 |
14 | class QTcpServer;
15 | class QTcpSocket;
16 | class TCPServer;
17 |
18 | struct ClientEntity{
19 | QTcpSocket* Socket;
20 | quint64 TotalReadLength;
21 | quint64 ReadLength;
22 | quint64 TotalWriteLength;
23 | quint64 WriteLength;
24 |
25 | QByteArray ReadBuffer;
26 | QByteArray WriteBuffer;
27 |
28 | ClientEntity(){
29 | reset();
30 | }
31 |
32 | void reset(){
33 | TotalReadLength = 0;
34 | ReadLength = 0;
35 | TotalWriteLength = 0;
36 | WriteLength = 0;
37 |
38 | ReadBuffer.clear();
39 | WriteBuffer.clear();
40 | }
41 | };
42 |
43 | class NETWORK_EXPORT TCPReceiver :public QObject
44 | {
45 | Q_OBJECT
46 |
47 | public:
48 | TCPReceiver(TCPServer* server, QObject* parent = nullptr)
49 | :QObject(parent), mServer(server){}
50 |
51 | public slots :
52 | void new_connection();
53 | void on_ready_read();
54 | void on_bytes_written(qint64);
55 | void on_disconnected();
56 | void on_error(QAbstractSocket::SocketError);
57 |
58 | private:
59 | TCPServer* mServer;
60 | };
61 |
62 | class NETWORK_EXPORT TCPServer : public QThread,public Handler
63 | {
64 | Q_OBJECT
65 | friend class TCPReceiver;
66 | public:
67 | TCPServer(qint16 port,QObject *parent = nullptr);
68 | ~TCPServer();
69 |
70 | void setHandler(Handler*);
71 |
72 | quint32 requestNum() const;
73 |
74 | protected:
75 | void run();
76 |
77 | void handle(ClientEntity* entity);
78 |
79 | virtual QSharedPointer doHandle(const ReqeustContext& context, QSharedPointer package);
80 |
81 | private:
82 | QTcpServer* mTcpServer;
83 | Handler* mHandler;
84 | qint16 mPort;
85 |
86 | QHash mClients;
87 | quint32 mRequestNum;
88 | };
89 |
90 | #endif // TCPSERVER_H
91 |
--------------------------------------------------------------------------------
/include/NetWork/TcpClient.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/NetWork/TcpClient.h
--------------------------------------------------------------------------------
/include/NetWork/UDPClient.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "network_global.h"
4 |
5 | #include
6 |
7 | class Package;
8 |
9 | class NETWORK_EXPORT UDPClient
10 | {
11 | public:
12 | UDPClient();
13 | ~UDPClient();
14 |
15 | static void send(Package& package, const QHostAddress& address, int port);
16 |
17 | private:
18 |
19 | };
20 |
21 |
--------------------------------------------------------------------------------
/include/NetWork/UDPServer.h:
--------------------------------------------------------------------------------
1 | #ifndef UDPSERVER_H
2 | #define UDPSERVER_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "network_global.h"
9 |
10 | #include "Handler.h"
11 |
12 | class QUdpSocket;
13 | class Package;
14 | class UDPServer;
15 |
16 | class UDPReceiver :public QObject
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | UDPReceiver(UDPServer* server, QObject* parent = nullptr)
22 | :QObject(parent), mServer(server){}
23 |
24 | public slots :
25 | void readPendingDatagrams();
26 |
27 | private:
28 | UDPServer* mServer;
29 | };
30 |
31 | class NETWORK_EXPORT UDPServer : public QThread,public Handler
32 | {
33 | Q_OBJECT
34 |
35 | friend class UDPReceiver;
36 | public:
37 | UDPServer(int port,QObject *parent = nullptr);
38 | ~UDPServer();
39 |
40 | void setHandler(Handler*);
41 |
42 | quint32 requestNum() const;
43 |
44 | protected:
45 | void run();
46 |
47 | void handle(const ReqeustContext&, QByteArray& data);
48 |
49 | virtual QSharedPointer doHandle(const ReqeustContext&, QSharedPointer);
50 |
51 | private:
52 | QUdpSocket* mUdpSocket;
53 | Handler* mHandler;
54 | qint16 mPort;
55 | quint32 mRequestNum;
56 | };
57 |
58 | #endif // UDPSERVER_H
59 |
--------------------------------------------------------------------------------
/include/NetWork/network_global.h:
--------------------------------------------------------------------------------
1 | #ifndef NETWORK_GLOBAL_H
2 | #define NETWORK_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef NETWORK_LIB
7 | # define NETWORK_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define NETWORK_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // NETWORK_GLOBAL_H
13 |
--------------------------------------------------------------------------------
/include/QAFCore/AbstractObject.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/AbstractObject.h
--------------------------------------------------------------------------------
/include/QAFCore/AbstractPlugin.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/AbstractPlugin.h
--------------------------------------------------------------------------------
/include/QAFCore/AbstractSystem.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/AbstractSystem.h
--------------------------------------------------------------------------------
/include/QAFCore/AbstractTreeModel.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/AbstractTreeModel.h
--------------------------------------------------------------------------------
/include/QAFCore/CommonTreeModel.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/CommonTreeModel.h
--------------------------------------------------------------------------------
/include/QAFCore/ConfigModel.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/ConfigModel.h
--------------------------------------------------------------------------------
/include/QAFCore/ConfigSystem.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/ConfigSystem.h
--------------------------------------------------------------------------------
/include/QAFCore/LogModel.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/LogModel.h
--------------------------------------------------------------------------------
/include/QAFCore/Logger.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace QAF
5 | {
6 | class Logger
7 | {
8 | public:
9 | static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
10 | static void backTrace(int traceNum = 255);
11 | };
12 | }
--------------------------------------------------------------------------------
/include/QAFCore/ModelItem.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include "qafcore_global.h"
6 |
7 | namespace QAF
8 | {
9 | class QAction;
10 |
11 | class QAFCORE_EXPORT ModelItem
12 | {
13 | public:
14 | ModelItem();
15 | virtual ~ModelItem();
16 |
17 | virtual QString className();
18 | virtual QVariant data(int index, int role = Qt::DisplayRole);
19 | virtual bool setData(const QVariant &value, int index, int role = Qt::DisplayRole);
20 | virtual int itemFlags(int index);
21 | virtual QList actions();
22 |
23 | ModelItem* parent();
24 | void addChild(ModelItem*);
25 | void insertChild(ModelItem* befor, ModelItem* item);
26 | void removeChild(ModelItem*);
27 | int childCount();
28 | int indexOf(ModelItem*);
29 | ModelItem* child(int);
30 |
31 | void setStatus(int);
32 | int status();
33 |
34 | private:
35 | QList mChildren;
36 | ModelItem* mParent;
37 | int mStatus;
38 | };
39 | }
--------------------------------------------------------------------------------
/include/QAFCore/ObjectModel.h:
--------------------------------------------------------------------------------
1 | #ifndef OBJECTMODEL_H
2 | #define OBJECTMODEL_H
3 |
4 | #include "QtCommonModel.h"
5 |
6 | namespace QAF
7 | {
8 | class ObjectModel : public QtCommonModel
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | ObjectModel(QObject *parent);
14 | ~ObjectModel();
15 |
16 | private:
17 |
18 | };
19 | }
20 |
21 | #endif // OBJECTMODEL_H
22 |
--------------------------------------------------------------------------------
/include/QAFCore/ObjectProxy.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "qafcore_global.h"
4 | #include "AbstractObject.h"
5 |
6 | namespace QAF
7 | {
8 | class ObjectSystem;
9 |
10 | class QAFCORE_EXPORT ObjectProxy
11 | {
12 | friend class ObjectSystem;
13 |
14 | public:
15 | ObjectProxy(ObjectId id, ObjectSystem* ObjectSystemId);
16 | ObjectProxy(const ObjectProxy&);
17 | virtual ~ObjectProxy();
18 |
19 | inline bool isNull() const;
20 | ObjectProxy& operator=(const ObjectProxy&);
21 |
22 | ObjectId objectId() const
23 | {
24 | return mObjectId;
25 | }
26 |
27 | ObjectSystem* objectSystem() const
28 | {
29 | return mObjectSystem;
30 | }
31 |
32 | protected:
33 | AbstractObject* ptr() const;
34 |
35 | protected:
36 | ObjectId mObjectId;
37 | ObjectSystem* mObjectSystem;
38 | };
39 |
40 | }
--------------------------------------------------------------------------------
/include/QAFCore/ObjectPtr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ObjectProxy.h"
4 |
5 | namespace QAF
6 | {
7 |
8 | class ObjectSystem;
9 |
10 | template
11 | class ObjectPtr :public ObjectProxy
12 | {
13 | public:
14 | ObjectPtr(ObjectId id = INVALID_OBJECT_ID, ObjectSystem* ObjectSystemId = nullptr)
15 | :ObjectProxy(id, ObjectSystemId){
16 |
17 | }
18 |
19 | template
20 | ObjectPtr(const ObjectPtr& other)
21 | : ObjectProxy(INVALID_OBJECT_ID,nullptr)
22 | {
23 | AbstractObject* ao = (AbstractObject*)other.data();
24 | T* uPtr = dynamic_cast(ao);
25 | if (uPtr){
26 | setObjectId(other.objectId());
27 | setObjectSystem(other.objectSystem());
28 | }
29 | }
30 |
31 | ~ObjectPtr(){}
32 |
33 | inline bool isValid() const
34 | {
35 | return this->isNull();
36 | }
37 |
38 | inline const T& operator*() const
39 | {
40 | T* t = dynamic_cast(ptr());
41 | Q_ASSERT(t);
42 | return *t;
43 | }
44 |
45 | inline T* operator->() const
46 | {
47 | return static_cast(ptr());
48 | }
49 |
50 | inline const T* data() const
51 | {
52 | return static_cast(ptr());
53 | }
54 |
55 | inline bool operator!() const
56 | {
57 | return isValid();
58 | }
59 |
60 | inline bool operator==(const ObjectPtr& other) const
61 | {
62 | if (isValid() && other.isValid()
63 | && objectId() == other->objectId()
64 | && objectSystem() == other->objectSystem())
65 | {
66 | return true;
67 | }else{
68 | return false;
69 | }
70 | }
71 |
72 | protected:
73 | void setObjectId(ObjectId id)
74 | {
75 | mObjectId = id;
76 | }
77 |
78 | void setObjectSystem(ObjectSystem* sys)
79 | {
80 | mObjectSystem = sys;
81 | }
82 |
83 | // ASSERT_CONVERTIBLE_TYPE(T, AbstractObject);
84 | };
85 | }
--------------------------------------------------------------------------------
/include/QAFCore/ObjectSystem.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "AbstractObject.h"
4 | #include "ObjectPtr.h"
5 | #include "AbstractSystem.h"
6 |
7 | #include
8 |
9 | namespace QAF
10 | {
11 | class QAFCORE_EXPORT ObjectSystem :
12 | public AbstractSystem
13 | {
14 | friend class ObjectProxy;
15 |
16 | Q_OBJECT
17 |
18 | public:
19 | ObjectSystem(int sysId, QObject* parent = 0);
20 | ~ObjectSystem();
21 |
22 | virtual void install();
23 | virtual void uninstall();
24 |
25 | template
26 | ObjectPtr create(Args... args)
27 | {
28 | AbstractObject* obj = new T(args...);
29 | ObjectId id = makeId();
30 | obj->mObjectId = id;
31 | ObjectInfo* info = new ObjectInfo();
32 | info->mObject = obj;
33 | mObjects.insert(id, info);
34 | return ObjectPtr(id, this);
35 | }
36 |
37 | template
38 | ObjectPtr clone(const ObjectPtr& other)
39 | {
40 | AbstractObject* obj = new T(*other);
41 | ObjectId id = makeId();
42 | obj->mObjectId = id;
43 | ObjectInfo* info = new ObjectInfo();
44 | info->mObject = obj;
45 | mObjects.insert(id, info);
46 | return ObjectPtr(id, this);
47 | }
48 |
49 | template
50 | ObjectPtr object(ObjectId id)
51 | {
52 | T* p = qobject_cast(query(id));
53 | if (p)
54 | return ObjectPtr(id, this);
55 | else
56 | return ObjectPtr();
57 | }
58 |
59 | bool merge(ObjectSystem&);
60 | bool destory(ObjectId);
61 | inline bool hasObject(ObjectId);
62 | inline int objectCount();
63 |
64 | protected:
65 | inline ObjectId makeId();
66 | inline void releaseId(ObjectId);
67 | bool changeId(ObjectId before, ObjectId after);
68 | AbstractObject* query(ObjectId);
69 |
70 | void addObjectProxy(ObjectProxy*);
71 | void removeObjectProxy(ObjectProxy*);
72 |
73 | private:
74 |
75 | struct ObjectInfo
76 | {
77 | AbstractObject* mObject;
78 | QList mProxys;
79 |
80 | ObjectInfo()
81 | {
82 | mObject = nullptr;
83 | }
84 | };
85 |
86 | QHash mObjects;
87 |
88 | ObjectId mMinValidId;
89 | ObjectId mMaxValidId;
90 | };
91 | }
--------------------------------------------------------------------------------
/include/QAFCore/PluginSystem.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "AbstractSystem.h"
4 |
5 | #include
6 | #include
7 |
8 | namespace QAF
9 | {
10 | class AbstractPlugin;
11 | class AbstractPluginFactory;
12 |
13 | class PluginSystem :
14 | public AbstractSystem
15 | {
16 | Q_OBJECT
17 | public:
18 |
19 | struct PluginConfig
20 | {
21 | QString mPlugin;
22 | QMap mConfigs;
23 | };
24 |
25 | PluginSystem(int sysId, QObject* parent = 0);
26 | ~PluginSystem();
27 |
28 | virtual void install();
29 | virtual void uninstall();
30 |
31 | protected:
32 | QList getPluginsFromConfig();
33 |
34 | private:
35 | QList mPlugins;
36 | QList mFactorys;
37 | };
38 | }
--------------------------------------------------------------------------------
/include/QAFCore/QAFContext.h:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file QAFContext.h
3 | * \date 2016/07/22
4 | *
5 | * \author zxj
6 | *
7 | * \brief
8 | *
9 | * agent of the core model,to control user's access authority
10 | *
11 | * \note
12 | */
13 |
14 | #pragma once
15 |
16 | #include "qafcore_global.h"
17 | #include "Singleton.h"
18 | #include "QAFGlobal.h"
19 |
20 | namespace QAF
21 | {
22 | class UIInterface;
23 | class AbstractSystem;
24 | class LogModel;
25 |
26 | class QAFCORE_EXPORT QAFContext:public Singleton
27 | {
28 | public:
29 | void construct();
30 | void destruct();
31 |
32 | /*!
33 | * \fn wellKnwonPath
34 | * \brief
35 | * To get common path in this application
36 | * \param
37 | * dt:the type of dir
38 | * \return
39 | * absolute path for given type
40 | */
41 | static QString wellKnownPath(DirType);
42 |
43 | /*!
44 | * \fn getLogModel
45 | * \brief
46 | * get log model
47 | * \param
48 | * void
49 | * \return
50 | * pointer of log model
51 | */
52 | LogModel* getLogModel() const;
53 |
54 | /*!
55 | * \fn setUIInterface
56 | * \brief
57 | * \param
58 | *
59 | * \return
60 | * void
61 | */
62 | void setUIInterface(UIInterface*);
63 |
64 | /*!
65 | * \fn getUIInterface
66 | * \brief
67 | * get the interface of GUI to create your custom appearance
68 | * \param
69 | * void
70 | * \return
71 | * pointer of ui interface
72 | */
73 | UIInterface* getUIInterface() const;
74 |
75 | /*!
76 | * \fn getSystem
77 | * \brief
78 | * get system
79 | * \param
80 | * st:system type what your what
81 | * \return
82 | * pointer of abstract system
83 | */
84 | AbstractSystem* getSystem(SystemType) const;
85 | };
86 | }
87 |
--------------------------------------------------------------------------------
/include/QAFCore/QAFCore.h:
--------------------------------------------------------------------------------
1 | #ifndef QAFCORE_H
2 | #define QAFCORE_H
3 |
4 | #include
5 | #include
6 |
7 | #include "Singleton.h"
8 | #include "QAFGlobal.h"
9 |
10 | class QAbstractItemModel;
11 |
12 | namespace QAF
13 | {
14 | class AbstractObject;
15 | class AbstractSystem;
16 | class PluginSystem;
17 | class UIInterface;
18 | class ConfigSystem;
19 | class ObjectSystem;
20 | class LogModel;
21 |
22 | class QAFCore:public QObject,public Singleton
23 | {
24 |
25 | public:
26 | QAFCore();
27 | ~QAFCore();
28 |
29 | void initialize();
30 |
31 | void addSystem(AbstractSystem*);
32 | void removeSystem(SystemType);
33 | AbstractSystem* getSystem(SystemType type) const;
34 | ConfigSystem* getConfigSystem() const;
35 | ObjectSystem* getObjectSystem(int sysId = ST_OBJECT) const;
36 | PluginSystem* getPluginSystem() const;
37 |
38 | void setUIInterface(UIInterface*);
39 | UIInterface* getUIInterface() const;
40 | LogModel* getLogModel() const;
41 |
42 | int getVersion() const;
43 | QString getVersionStr() const;
44 | bool isSupported(int version) const;
45 |
46 | protected:
47 | void initCore();
48 | void initExtent();
49 | void destory();
50 |
51 | private:
52 | QMap mSystems;
53 | UIInterface* mUIInterface;
54 | LogModel* mLogModel;
55 | bool mIsInit = false;
56 | };
57 | }
58 |
59 | #endif // QAFCORE_H
--------------------------------------------------------------------------------
/include/QAFCore/QAFDirs.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "qafcore_global.h"
4 | #include "QAFGlobal.h"
5 |
6 | namespace QAF
7 | {
8 | namespace QAFDirs
9 | {
10 | QString path(DirType type);
11 | };
12 | }
--------------------------------------------------------------------------------
/include/QAFCore/QAFException.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/QAFException.h
--------------------------------------------------------------------------------
/include/QAFCore/QAFGlobal.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/QAFGlobal.h
--------------------------------------------------------------------------------
/include/QAFCore/QAFLogger.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace QAF
5 | {
6 | class Logger
7 | {
8 | public:
9 | static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
10 | static void backTrace(int traceNum = 255);
11 | };
12 | }
--------------------------------------------------------------------------------
/include/QAFCore/Serializable.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "qafcore_global.h"
4 |
5 | class QDataStream;
6 |
7 | class Serializable
8 | {
9 | public:
10 | Serializable(){}
11 | virtual ~Serializable(){}
12 |
13 | virtual void pack(QDataStream& stream) const = 0;
14 | virtual void unpack(QDataStream& stream) = 0;
15 | };
16 |
17 | QAFCORE_EXPORT QDataStream& operator<< (QDataStream&, const Serializable&);
18 | QAFCORE_EXPORT QDataStream& operator>> (QDataStream&, Serializable&);
--------------------------------------------------------------------------------
/include/QAFCore/UIInterface.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/UIInterface.h
--------------------------------------------------------------------------------
/include/QAFCore/qafcore_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QAFCORE_GLOBAL_H
2 | #define QAFCORE_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef QAFCORE_LIB
7 | # define QAFCORE_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define QAFCORE_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // QAFCORE_GLOBAL_H
--------------------------------------------------------------------------------
/include/QAFCore/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/QAFCore/resource.h
--------------------------------------------------------------------------------
/include/QtAwesome/QtAwesomeAnim.h:
--------------------------------------------------------------------------------
1 | #ifndef QTAWESOMEANIMATION_H
2 | #define QTAWESOMEANIMATION_H
3 |
4 | #include
5 |
6 | #include "qtawesome_global.h"
7 |
8 | class QPainter;
9 | class QRect;
10 | class QTimer;
11 | class QWidget;
12 |
13 | ///
14 | /// Basic Animation Support for QtAwesome (Inspired by https://github.com/spyder-ide/qtawesome)
15 | ///
16 | class QTAWESONME_EXPORT QtAwesomeAnimation : public QObject
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | QtAwesomeAnimation( QWidget* parentWidget, int interval=10, int step=1);
22 |
23 | void setup( QPainter& painter, const QRect& rect );
24 |
25 | public slots:
26 | void update();
27 |
28 | private:
29 | QWidget* parentWidgetRef_;
30 | QTimer* timer_;
31 | int interval_;
32 | int step_;
33 | float angle_;
34 |
35 | };
36 |
37 |
38 | #endif // QTAWESOMEANIMATION_H
39 |
--------------------------------------------------------------------------------
/include/QtAwesome/qtawesome_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QTAWESONME_GLOBAL_H
2 | #define QTAWESONME_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef QTAWESONME_LIB
7 | # define QTAWESONME_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define QTAWESONME_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // QTAWESONME_GLOBAL_H
--------------------------------------------------------------------------------
/include/QtPropertyBrowser/qtbuttonpropertybrowser.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 | ** All rights reserved.
5 | **
6 | ** Contact: Nokia Corporation (qt-info@nokia.com)
7 | **
8 | ** This file is part of a Qt Solutions component.
9 | **
10 | ** You may use this file under the terms of the BSD license as follows:
11 | **
12 | ** "Redistribution and use in source and binary forms, with or without
13 | ** modification, are permitted provided that the following conditions are
14 | ** met:
15 | ** * Redistributions of source code must retain the above copyright
16 | ** notice, this list of conditions and the following disclaimer.
17 | ** * Redistributions in binary form must reproduce the above copyright
18 | ** notice, this list of conditions and the following disclaimer in
19 | ** the documentation and/or other materials provided with the
20 | ** distribution.
21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22 | ** the names of its contributors may be used to endorse or promote
23 | ** products derived from this software without specific prior written
24 | ** permission.
25 | **
26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 | **
38 | ****************************************************************************/
39 |
40 |
41 | #ifndef QTBUTTONPROPERTYBROWSER_H
42 | #define QTBUTTONPROPERTYBROWSER_H
43 |
44 | #include "qtpropertybrowser.h"
45 |
46 | #if QT_VERSION >= 0x040400
47 | QT_BEGIN_NAMESPACE
48 | #endif
49 |
50 | class QtButtonPropertyBrowserPrivate;
51 |
52 | class QT_QTPROPERTYBROWSER_EXPORT QtButtonPropertyBrowser : public QtAbstractPropertyBrowser
53 | {
54 | Q_OBJECT
55 | public:
56 |
57 | QtButtonPropertyBrowser(QWidget *parent = 0);
58 | ~QtButtonPropertyBrowser();
59 |
60 | void setExpanded(QtBrowserItem *item, bool expanded);
61 | bool isExpanded(QtBrowserItem *item) const;
62 |
63 | Q_SIGNALS:
64 |
65 | void collapsed(QtBrowserItem *item);
66 | void expanded(QtBrowserItem *item);
67 |
68 | protected:
69 | virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem);
70 | virtual void itemRemoved(QtBrowserItem *item);
71 | virtual void itemChanged(QtBrowserItem *item);
72 |
73 | private:
74 |
75 | QtButtonPropertyBrowserPrivate *d_ptr;
76 | Q_DECLARE_PRIVATE(QtButtonPropertyBrowser)
77 | Q_DISABLE_COPY(QtButtonPropertyBrowser)
78 | Q_PRIVATE_SLOT(d_func(), void slotUpdate())
79 | Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed())
80 | Q_PRIVATE_SLOT(d_func(), void slotToggled(bool))
81 |
82 | };
83 |
84 | #if QT_VERSION >= 0x040400
85 | QT_END_NAMESPACE
86 | #endif
87 |
88 | #endif
89 |
--------------------------------------------------------------------------------
/include/QtPropertyBrowser/qtgroupboxpropertybrowser.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 | ** All rights reserved.
5 | **
6 | ** Contact: Nokia Corporation (qt-info@nokia.com)
7 | **
8 | ** This file is part of a Qt Solutions component.
9 | **
10 | ** You may use this file under the terms of the BSD license as follows:
11 | **
12 | ** "Redistribution and use in source and binary forms, with or without
13 | ** modification, are permitted provided that the following conditions are
14 | ** met:
15 | ** * Redistributions of source code must retain the above copyright
16 | ** notice, this list of conditions and the following disclaimer.
17 | ** * Redistributions in binary form must reproduce the above copyright
18 | ** notice, this list of conditions and the following disclaimer in
19 | ** the documentation and/or other materials provided with the
20 | ** distribution.
21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22 | ** the names of its contributors may be used to endorse or promote
23 | ** products derived from this software without specific prior written
24 | ** permission.
25 | **
26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 | **
38 | ****************************************************************************/
39 |
40 |
41 | #ifndef QTGROUPBOXPROPERTYBROWSER_H
42 | #define QTGROUPBOXPROPERTYBROWSER_H
43 |
44 | #include "qtpropertybrowser.h"
45 |
46 | #if QT_VERSION >= 0x040400
47 | QT_BEGIN_NAMESPACE
48 | #endif
49 |
50 | class QtGroupBoxPropertyBrowserPrivate;
51 |
52 | class QT_QTPROPERTYBROWSER_EXPORT QtGroupBoxPropertyBrowser : public QtAbstractPropertyBrowser
53 | {
54 | Q_OBJECT
55 | public:
56 |
57 | QtGroupBoxPropertyBrowser(QWidget *parent = 0);
58 | ~QtGroupBoxPropertyBrowser();
59 |
60 | protected:
61 | virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem);
62 | virtual void itemRemoved(QtBrowserItem *item);
63 | virtual void itemChanged(QtBrowserItem *item);
64 |
65 | private:
66 |
67 | QtGroupBoxPropertyBrowserPrivate *d_ptr;
68 | Q_DECLARE_PRIVATE(QtGroupBoxPropertyBrowser)
69 | Q_DISABLE_COPY(QtGroupBoxPropertyBrowser)
70 | Q_PRIVATE_SLOT(d_func(), void slotUpdate())
71 | Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed())
72 |
73 | };
74 |
75 | #if QT_VERSION >= 0x040400
76 | QT_END_NAMESPACE
77 | #endif
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/include/Utils/BaseException.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/include/Utils/BaseException.h
--------------------------------------------------------------------------------
/include/Utils/Ensure.h:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file Ensure.h
3 | * \date 2016/07/21 22:31
4 | *
5 | * \author unknown(refer to this blog:http://mindhacks.cn/2012/08/27/modern-cpp-practices/)
6 | * Contact: user@company.com
7 | *
8 | * \brief
9 | *
10 | * runtime assert macro which can output more information
11 | *
12 | * \note
13 | */
14 |
15 | #pragma once
16 |
17 | #include
18 | #include
19 |
20 | class EnsureException : public std::exception
21 | {
22 | public:
23 | EnsureException(const char *exp, const char *file, int line)
24 | {
25 | std::ostringstream so;
26 | so << "ensure failed : " << exp << '\n';
27 | so << file << '(' << line << ')' << '\n';
28 | so << "context variables:\n";
29 | m_what = so.str();
30 | }
31 | ~EnsureException() throw (){}
32 |
33 | template
34 | EnsureException& operator << (const std::pair& p)
35 | {
36 | std::ostringstream so;
37 | so << '\t' << p.first << " : " << p.second << '\n';
38 | m_what += so.str();
39 | return *this;
40 | }
41 | EnsureException& operator << (int){ return *this; }
42 |
43 | const char *what() const throw () { return m_what.c_str(); }
44 | private:
45 | mutable std::string m_what;
46 | };
47 |
48 | static int A = 0, B = 0;
49 | #define AB(a, N) std::make_pair(#a, a) << N
50 | #define A(a) AB(a, B)
51 | #define B(a) AB(a, A)
52 |
53 | #define ENSURE(b) if (b); else throw EnsureException(#b, __FILE__, __LINE__) << A
--------------------------------------------------------------------------------
/include/Utils/Singleton.h:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file Singleton.h
3 | * \date 2016/07/21 22:30
4 | *
5 | * \author zxj
6 | * Contact: user@company.com
7 | *
8 | * \brief
9 | *
10 | * single pattern implement
11 | *
12 | * \note
13 | */
14 |
15 | #pragma once
16 |
17 | #include
18 |
19 | template
20 | class Singleton
21 | {
22 | public:
23 | static T* getSingleton()
24 | {
25 | //test is object has been constructed
26 | if (!sInstancePtr.loadAcquire())
27 | {
28 | T* ptr = new T();
29 | //atomic operator
30 | if (!sInstancePtr.testAndSetOrdered(0, ptr))
31 | {
32 | //the object has been constructed
33 | //destruct the object you just apply
34 | delete ptr;
35 | }
36 | }
37 | return sInstancePtr.loadAcquire();
38 | }
39 |
40 | static void release()
41 | {
42 | T* ptr = sInstancePtr.loadAcquire();
43 | if (ptr)
44 | {
45 | if (sInstancePtr.testAndSetOrdered(ptr, 0))
46 | {
47 | delete ptr;
48 | }
49 | }
50 | }
51 |
52 | protected:
53 | //limit object construct and destruct
54 | Singleton(){}
55 | virtual ~Singleton(){}
56 |
57 | private:
58 | //single object refused to copy
59 | Singleton(const Singleton&);
60 | Singleton& operator=(const Singleton&);
61 |
62 | static QBasicAtomicPointer sInstancePtr;
63 | };
64 |
65 | template
66 | QBasicAtomicPointer Singleton::sInstancePtr = Q_BASIC_ATOMIC_INITIALIZER(0);
--------------------------------------------------------------------------------
/include/Utils/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILS_H
2 | #define UTILS_H
3 |
4 | template
5 | class CanConvert
6 | {
7 | typedef char Type1[1];
8 | typedef char Type2[2];
9 |
10 | static Type1& test(T2&);
11 | static Type2& test(...);
12 | static T1& make();
13 |
14 | public:
15 | enum { ret = (sizeof(test(make())) == sizeof(Type1)) };
16 | };
17 |
18 | template
19 | class IsSameType
20 | {
21 | public:
22 | enum { ret = false };
23 | };
24 |
25 | template
26 | class IsSameType
27 | {
28 | public:
29 | enum { ret = true };
30 | };
31 |
32 | #define ASSERT_SAME_TYPE(classname1,classname2) static_assert(IsSameType::ret, #classname1##" is not the same type with "###classname2)
33 | #define ASSERT_CONVERTIBLE_TYPE(classname1,classname2) static_assert(CanConvert::ret,#classname1##" can not convert to "###classname2)
34 |
35 | #ifdef QT_DEBUG
36 | #define QT_CONNECT(conenction_name) qDebug() << "Connect:" << connection_name << "Sate:" << QObject::connect
37 | #else
38 | #define QT_CONNECT(connection_name) QObject::connect
39 | #endif
40 |
41 | #endif //UTILS_H
--------------------------------------------------------------------------------
/include/Utils/utils_global.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILS_GLOBAL_H
2 | #define UTILS_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef UTILS_LIB
7 | # define UTILS_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define UTILS_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // UTILS_GLOBAL_H
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/cpp/cpp_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Author: kenton@google.com (Kenton Varda)
32 | // Based on original Protocol Buffers design by
33 | // Sanjay Ghemawat, Jeff Dean, and others.
34 | //
35 | // Generates C++ code for a given .proto file.
36 |
37 | #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
38 | #define GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
39 |
40 | #include
41 | #include
42 |
43 | namespace google {
44 | namespace protobuf {
45 | namespace compiler {
46 | namespace cpp {
47 |
48 | // CodeGenerator implementation which generates a C++ source file and
49 | // header. If you create your own protocol compiler binary and you want
50 | // it to support C++ output, you can do so by registering an instance of this
51 | // CodeGenerator with the CommandLineInterface in your main() function.
52 | class LIBPROTOC_EXPORT CppGenerator : public CodeGenerator {
53 | public:
54 | CppGenerator();
55 | ~CppGenerator();
56 |
57 | // implements CodeGenerator ----------------------------------------
58 | bool Generate(const FileDescriptor* file,
59 | const string& parameter,
60 | GeneratorContext* generator_context,
61 | string* error) const;
62 |
63 | private:
64 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CppGenerator);
65 | };
66 |
67 | } // namespace cpp
68 | } // namespace compiler
69 | } // namespace protobuf
70 |
71 | } // namespace google
72 | #endif // GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
73 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/csharp/csharp_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Generates C# code for a given .proto file.
32 |
33 | #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
34 | #define GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
35 |
36 | #include
37 |
38 | #include
39 |
40 | namespace google {
41 | namespace protobuf {
42 | namespace compiler {
43 | namespace csharp {
44 |
45 | // CodeGenerator implementation which generates a C# source file and
46 | // header. If you create your own protocol compiler binary and you want
47 | // it to support C# output, you can do so by registering an instance of this
48 | // CodeGenerator with the CommandLineInterface in your main() function.
49 | class LIBPROTOC_EXPORT Generator
50 | : public google::protobuf::compiler::CodeGenerator {
51 | virtual bool Generate(
52 | const FileDescriptor* file,
53 | const string& parameter,
54 | GeneratorContext* generator_context,
55 | string* error) const;
56 | };
57 |
58 | } // namespace csharp
59 | } // namespace compiler
60 | } // namespace protobuf
61 | } // namespace google
62 |
63 | #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
64 |
65 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/java/java_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Author: kenton@google.com (Kenton Varda)
32 | // Based on original Protocol Buffers design by
33 | // Sanjay Ghemawat, Jeff Dean, and others.
34 | //
35 | // Generates Java code for a given .proto file.
36 |
37 | #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
38 | #define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
39 |
40 | #include
41 | #include
42 |
43 | namespace google {
44 | namespace protobuf {
45 | namespace compiler {
46 | namespace java {
47 |
48 | // CodeGenerator implementation which generates Java code. If you create your
49 | // own protocol compiler binary and you want it to support Java output, you
50 | // can do so by registering an instance of this CodeGenerator with the
51 | // CommandLineInterface in your main() function.
52 | class LIBPROTOC_EXPORT JavaGenerator : public CodeGenerator {
53 | public:
54 | JavaGenerator();
55 | ~JavaGenerator();
56 |
57 | // implements CodeGenerator ----------------------------------------
58 | bool Generate(const FileDescriptor* file,
59 | const string& parameter,
60 | GeneratorContext* context,
61 | string* error) const;
62 |
63 | private:
64 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator);
65 | };
66 |
67 | } // namespace java
68 | } // namespace compiler
69 | } // namespace protobuf
70 |
71 | } // namespace google
72 | #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
73 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/java/java_names.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Author: kenton@google.com (Kenton Varda)
32 | // Based on original Protocol Buffers design by
33 | // Sanjay Ghemawat, Jeff Dean, and others.
34 | //
35 | // Provides a mechanism for mapping a descriptor to the
36 | // fully-qualified name of the corresponding Java class.
37 |
38 | #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
39 | #define GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
40 |
41 | #include
42 |
43 | namespace google {
44 | namespace protobuf {
45 |
46 | class Descriptor;
47 | class EnumDescriptor;
48 | class FileDescriptor;
49 | class ServiceDescriptor;
50 |
51 | namespace compiler {
52 | namespace java {
53 |
54 | // Requires:
55 | // descriptor != NULL
56 | //
57 | // Returns:
58 | // The fully-qualified Java class name.
59 | string ClassName(const Descriptor* descriptor);
60 |
61 | // Requires:
62 | // descriptor != NULL
63 | //
64 | // Returns:
65 | // The fully-qualified Java class name.
66 | string ClassName(const EnumDescriptor* descriptor);
67 |
68 | // Requires:
69 | // descriptor != NULL
70 | //
71 | // Returns:
72 | // The fully-qualified Java class name.
73 | string ClassName(const FileDescriptor* descriptor);
74 |
75 | // Requires:
76 | // descriptor != NULL
77 | //
78 | // Returns:
79 | // The fully-qualified Java class name.
80 | string ClassName(const ServiceDescriptor* descriptor);
81 |
82 | } // namespace java
83 | } // namespace compiler
84 | } // namespace protobuf
85 | } // namespace google
86 |
87 | #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
88 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/javanano/javanano_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // http://code.google.com/p/protobuf/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Author: kenton@google.com (Kenton Varda)
32 | // Based on original Protocol Buffers design by
33 | // Sanjay Ghemawat, Jeff Dean, and others.
34 | //
35 | // Generates Java nano code for a given .proto file.
36 |
37 | #ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
38 | #define GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
39 |
40 | #include
41 | #include
42 |
43 | namespace google {
44 | namespace protobuf {
45 | namespace compiler {
46 | namespace javanano {
47 |
48 | // CodeGenerator implementation which generates Java nano code. If you create your
49 | // own protocol compiler binary and you want it to support Java output for the
50 | // nano runtime, you can do so by registering an instance of this CodeGenerator with
51 | // the CommandLineInterface in your main() function.
52 | class LIBPROTOC_EXPORT JavaNanoGenerator : public CodeGenerator {
53 | public:
54 | JavaNanoGenerator();
55 | ~JavaNanoGenerator();
56 |
57 | // implements CodeGenerator ----------------------------------------
58 | bool Generate(const FileDescriptor* file,
59 | const string& parameter,
60 | GeneratorContext* output_directory,
61 | string* error) const;
62 |
63 | private:
64 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaNanoGenerator);
65 | };
66 |
67 | } // namespace javanano
68 | } // namespace compiler
69 | } // namespace protobuf
70 |
71 | } // namespace google
72 | #endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
73 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/objectivec/objectivec_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Generates ObjectiveC code for a given .proto file.
32 |
33 | #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__
34 | #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__
35 |
36 | #include
37 | #include
38 |
39 | namespace google {
40 | namespace protobuf {
41 | namespace compiler {
42 | namespace objectivec {
43 |
44 | // CodeGenerator implementation which generates a ObjectiveC source file and
45 | // header. If you create your own protocol compiler binary and you want it to
46 | // support ObjectiveC output, you can do so by registering an instance of this
47 | // CodeGenerator with the CommandLineInterface in your main() function.
48 | class LIBPROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator {
49 | public:
50 | ObjectiveCGenerator();
51 | ~ObjectiveCGenerator();
52 |
53 | // implements CodeGenerator ----------------------------------------
54 | bool HasGenerateAll() const;
55 | bool Generate(const FileDescriptor* file,
56 | const string& parameter,
57 | GeneratorContext* context,
58 | string* error) const;
59 | bool GenerateAll(const vector& files,
60 | const string& parameter,
61 | GeneratorContext* context,
62 | string* error) const;
63 |
64 | private:
65 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjectiveCGenerator);
66 | };
67 |
68 | } // namespace objectivec
69 | } // namespace compiler
70 | } // namespace protobuf
71 | } // namespace google
72 | #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__
73 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/php/php_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
32 | #define GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
33 |
34 | #include
35 |
36 | #include
37 |
38 | namespace google {
39 | namespace protobuf {
40 | namespace compiler {
41 | namespace php {
42 |
43 | class LIBPROTOC_EXPORT Generator
44 | : public google::protobuf::compiler::CodeGenerator {
45 | virtual bool Generate(
46 | const FileDescriptor* file,
47 | const string& parameter,
48 | GeneratorContext* generator_context,
49 | string* error) const;
50 | };
51 |
52 | } // namespace php
53 | } // namespace compiler
54 | } // namespace protobuf
55 | } // namespace google
56 |
57 | #endif // GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
58 |
--------------------------------------------------------------------------------
/include/google/protobuf/compiler/ruby/ruby_generator.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Generates Ruby code for a given .proto file.
32 |
33 | #ifndef GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__
34 | #define GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__
35 |
36 | #include
37 |
38 | #include
39 |
40 | namespace google {
41 | namespace protobuf {
42 | namespace compiler {
43 | namespace ruby {
44 |
45 | // CodeGenerator implementation for generated Ruby protocol buffer classes.
46 | // If you create your own protocol compiler binary and you want it to support
47 | // Ruby output, you can do so by registering an instance of this
48 | // CodeGenerator with the CommandLineInterface in your main() function.
49 | class LIBPROTOC_EXPORT Generator
50 | : public google::protobuf::compiler::CodeGenerator {
51 | virtual bool Generate(
52 | const FileDescriptor* file,
53 | const string& parameter,
54 | GeneratorContext* generator_context,
55 | string* error) const;
56 | };
57 |
58 | } // namespace ruby
59 | } // namespace compiler
60 | } // namespace protobuf
61 | } // namespace google
62 |
63 | #endif // GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__
64 |
65 |
--------------------------------------------------------------------------------
/include/google/protobuf/empty.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option go_package = "github.com/golang/protobuf/ptypes/empty";
37 | option java_package = "com.google.protobuf";
38 | option java_outer_classname = "EmptyProto";
39 | option java_multiple_files = true;
40 | option objc_class_prefix = "GPB";
41 | option cc_enable_arenas = true;
42 |
43 | // A generic empty message that you can re-use to avoid defining duplicated
44 | // empty messages in your APIs. A typical example is to use it as the request
45 | // or the response type of an API method. For instance:
46 | //
47 | // service Foo {
48 | // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
49 | // }
50 | //
51 | // The JSON representation for `Empty` is empty JSON object `{}`.
52 | message Empty {}
53 |
--------------------------------------------------------------------------------
/include/google/protobuf/generated_enum_util.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
32 | #define GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
33 |
34 | #include
35 |
36 | namespace google {
37 | namespace protobuf {
38 |
39 | // This type trait can be used to cause templates to only match proto2 enum
40 | // types.
41 | template struct is_proto_enum : ::google::protobuf::internal::false_type {};
42 |
43 | } // namespace protobuf
44 |
45 | } // namespace google
46 | #endif // GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
47 |
--------------------------------------------------------------------------------
/include/google/protobuf/has_bits.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef GOOGLE_PROTOBUF_HAS_BITS_H__
32 | #define GOOGLE_PROTOBUF_HAS_BITS_H__
33 |
34 | #include
35 |
36 | namespace google {
37 | namespace protobuf {
38 | namespace internal {
39 |
40 | template
41 | class HasBits {
42 | public:
43 | HasBits() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { Clear(); }
44 |
45 | void Clear() GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
46 | memset(has_bits_, 0, sizeof(has_bits_));
47 | }
48 |
49 | ::google::protobuf::uint32& operator[](int index) GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
50 | return has_bits_[index];
51 | }
52 |
53 | const ::google::protobuf::uint32& operator[](int index) const GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
54 | return has_bits_[index];
55 | }
56 |
57 | bool operator==(const HasBits& rhs) const {
58 | return memcmp(has_bits_, rhs.has_bits_, sizeof(has_bits_)) == 0;
59 | }
60 |
61 | bool operator!=(const HasBits& rhs) const {
62 | return !(*this == rhs);
63 | }
64 | private:
65 | ::google::protobuf::uint32 has_bits_[doublewords];
66 | };
67 |
68 | } // namespace internal
69 | } // namespace protobuf
70 |
71 | } // namespace google
72 | #endif // GOOGLE_PROTOBUF_HAS_BITS_H__
73 |
--------------------------------------------------------------------------------
/include/google/protobuf/io/strtod.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // A locale-independent version of strtod(), used to parse floating
32 | // point default values in .proto files, where the decimal separator
33 | // is always a dot.
34 |
35 | #ifndef GOOGLE_PROTOBUF_IO_STRTOD_H__
36 | #define GOOGLE_PROTOBUF_IO_STRTOD_H__
37 |
38 | namespace google {
39 | namespace protobuf {
40 | namespace io {
41 |
42 | // A locale-independent version of the standard strtod(), which always
43 | // uses a dot as the decimal separator.
44 | double NoLocaleStrtod(const char* str, char** endptr);
45 |
46 | // Casts a double value to a float value. If the value is outside of the
47 | // representable range of float, it will be converted to positive or negative
48 | // infinity.
49 | float SafeDoubleToFloat(double value);
50 |
51 | } // namespace io
52 | } // namespace protobuf
53 |
54 | } // namespace google
55 | #endif // GOOGLE_PROTOBUF_IO_STRTOD_H__
56 |
--------------------------------------------------------------------------------
/include/google/protobuf/source_context.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option java_package = "com.google.protobuf";
37 | option java_outer_classname = "SourceContextProto";
38 | option java_multiple_files = true;
39 | option objc_class_prefix = "GPB";
40 |
41 | // `SourceContext` represents information about the source of a
42 | // protobuf element, like the file in which it is defined.
43 | message SourceContext {
44 | // The path-qualified name of the .proto file that contained the associated
45 | // protobuf element. For example: `"google/protobuf/source_context.proto"`.
46 | string file_name = 1;
47 | }
48 |
--------------------------------------------------------------------------------
/include/google/protobuf/stubs/atomic_sequence_num.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2014 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | #ifndef GOOGLE_PROTOBUF_ATOMIC_SEQUENCE_NUM_H_
31 | #define GOOGLE_PROTOBUF_ATOMIC_SEQUENCE_NUM_H_
32 |
33 | #include
34 |
35 | namespace google {
36 | namespace protobuf {
37 | namespace internal {
38 |
39 | class SequenceNumber {
40 | public:
41 | SequenceNumber() : word_(0) {}
42 |
43 | AtomicWord GetNext() {
44 | return NoBarrier_AtomicIncrement(&word_, 1) - 1;
45 | }
46 | private:
47 | AtomicWord word_;
48 | };
49 |
50 | } // namespace internal
51 | } // namespace protobuf
52 | } // namespace google
53 |
54 | #endif // GOOGLE_PROTOBUF_ATOMIC_SEQUENCE_NUM_H_
55 |
--------------------------------------------------------------------------------
/include/google/protobuf/stubs/singleton.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2014 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | #ifndef GOOGLE_PROTOBUF_STUBS_SINGLETON_H__
31 | #define GOOGLE_PROTOBUF_STUBS_SINGLETON_H__
32 |
33 | #include
34 | #include
35 | #include
36 |
37 | namespace google {
38 | namespace protobuf {
39 | namespace internal {
40 | template
41 | class Singleton {
42 | public:
43 | static T* get() {
44 | GoogleOnceInit(&once_, &Singleton::Init);
45 | return instance_;
46 | }
47 | static void ShutDown() {
48 | delete instance_;
49 | instance_ = NULL;
50 | }
51 | private:
52 | static void Init() {
53 | instance_ = new T();
54 | }
55 | static ProtobufOnceType once_;
56 | static T* instance_;
57 | };
58 |
59 | template
60 | ProtobufOnceType Singleton::once_;
61 |
62 | template
63 | T* Singleton::instance_ = NULL;
64 | } // namespace internal
65 | } // namespace protobuf
66 | } // namespace google
67 |
68 | #endif // GOOGLE_PROTOBUF_STUBS_SINGLETON_H__
69 |
--------------------------------------------------------------------------------
/include/google/protobuf/util/type_resolver.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Defines a TypeResolver for the Any message.
32 |
33 | #ifndef GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_H__
34 | #define GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_H__
35 |
36 | #include
37 |
38 | #include
39 | #include
40 |
41 |
42 | namespace google {
43 | namespace protobuf {
44 | class Type;
45 | class Enum;
46 | } // namespace protobuf
47 |
48 |
49 | namespace protobuf {
50 | class DescriptorPool;
51 | namespace util {
52 |
53 | // Abstract interface for a type resovler.
54 | //
55 | // Implementations of this interface must be thread-safe.
56 | class LIBPROTOBUF_EXPORT TypeResolver {
57 | public:
58 | TypeResolver() {}
59 | virtual ~TypeResolver() {}
60 |
61 | // Resolves a type url for a message type.
62 | virtual util::Status ResolveMessageType(
63 | const string& type_url, google::protobuf::Type* message_type) = 0;
64 |
65 | // Resolves a type url for an enum type.
66 | virtual util::Status ResolveEnumType(const string& type_url,
67 | google::protobuf::Enum* enum_type) = 0;
68 |
69 | private:
70 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeResolver);
71 | };
72 |
73 | } // namespace util
74 | } // namespace protobuf
75 |
76 | } // namespace google
77 | #endif // GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_H__
78 |
--------------------------------------------------------------------------------
/include/google/protobuf/util/type_resolver_util.h:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Defines utilities for the TypeResolver.
32 |
33 | #ifndef GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_UTIL_H__
34 | #define GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_UTIL_H__
35 |
36 | #include
37 |
38 | #include
39 | namespace google {
40 | namespace protobuf {
41 | class DescriptorPool;
42 | namespace util {
43 | class TypeResolver;
44 |
45 | // Creates a TypeResolver that serves type information in the given descriptor
46 | // pool. Caller takes ownership of the returned TypeResolver.
47 | LIBPROTOBUF_EXPORT TypeResolver* NewTypeResolverForDescriptorPool(
48 | const string& url_prefix, const DescriptorPool* pool);
49 |
50 | } // namespace util
51 | } // namespace protobuf
52 |
53 | } // namespace google
54 | #endif // GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_UTIL_H__
55 |
--------------------------------------------------------------------------------
/include/log4qt/basicconfigurator.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | *
3 | * package: Log4Qt
4 | * file: basicconfigurator.h
5 | * created: September 2007
6 | * author: Martin Heinrich
7 | *
8 | *
9 | * Copyright 2007 Martin Heinrich
10 | *
11 | * Licensed under the Apache License, Version 2.0 (the "License");
12 | * you may not use this file except in compliance with the License.
13 | * You may obtain a copy of the License at
14 | *
15 | * http://www.apache.org/licenses/LICENSE-2.0
16 | *
17 | * Unless required by applicable law or agreed to in writing, software
18 | * distributed under the License is distributed on an "AS IS" BASIS,
19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 | * See the License for the specific language governing permissions and
21 | * limitations under the License.
22 | *
23 | ******************************************************************************/
24 |
25 | #ifndef LOG4QT_BASICCONFIGURATOR_H
26 | #define LOG4QT_BASICCONFIGURATOR_H
27 |
28 |
29 | /******************************************************************************
30 | * Dependencies
31 | ******************************************************************************/
32 |
33 |
34 | #include
35 | #include "log4qt/log4qt.h"
36 |
37 | #include "log4qt_global.h"
38 |
39 | /******************************************************************************
40 | * Declarations
41 | ******************************************************************************/
42 |
43 | namespace Log4Qt
44 | {
45 |
46 | class Appender;
47 |
48 | /*!
49 | * \brief The class BasicConfigurator provides a simple package
50 | * configuration.
51 | *
52 | * \note All the functions declared in this class are thread-safe.
53 | */
54 | class LOG4QT_EXPORT BasicConfigurator
55 | {
56 | private:
57 | BasicConfigurator(); // Not implemented
58 | // BasicConfigurator(const BasicConfigurator &rOther); // Use compiler default
59 | // virtual ~BasicConfigurator(); // Use compiler default
60 | // BasicConfigurator &operator=(const BasicConfigurator &rOther); // Use compiler default
61 |
62 | public:
63 | static bool configure();
64 | static void configure(Appender *pAppender);
65 | static void resetConfiguration();
66 | };
67 |
68 |
69 | /**************************************************************************
70 | * Operators, Helper
71 | **************************************************************************/
72 |
73 |
74 | /**************************************************************************
75 | * Inline
76 | **************************************************************************/
77 |
78 |
79 | } // namspace Log4Qt
80 |
81 |
82 | // Q_DECLARE_TYPEINFO(Log4Qt::BasicConfigurator, Q_MOVABLE_TYPE); // Use default
83 |
84 |
85 | #endif // LOG4QT_BASICCONFIGURATOR_H
86 |
--------------------------------------------------------------------------------
/include/log4qt/log4qt_global.h:
--------------------------------------------------------------------------------
1 | #ifndef LOG4QT_GLOBAL_H
2 | #define LOG4QT_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef LOG4QT_LIB
7 | # define LOG4QT_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define LOG4QT_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // LOG4QT_GLOBAL_H
13 |
--------------------------------------------------------------------------------
/include/log4qt/simplelayout.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | *
3 | * package: Log4Qt
4 | * file: simplelayout.h
5 | * created: September 2007
6 | * author: Martin Heinrich
7 | *
8 | *
9 | * Copyright 2007 Martin Heinrich
10 | *
11 | * Licensed under the Apache License, Version 2.0 (the "License");
12 | * you may not use this file except in compliance with the License.
13 | * You may obtain a copy of the License at
14 | *
15 | * http://www.apache.org/licenses/LICENSE-2.0
16 | *
17 | * Unless required by applicable law or agreed to in writing, software
18 | * distributed under the License is distributed on an "AS IS" BASIS,
19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 | * See the License for the specific language governing permissions and
21 | * limitations under the License.
22 | *
23 | ******************************************************************************/
24 |
25 | #ifndef LOG4QT_SIMPLELAYOUT_H
26 | #define LOG4QT_SIMPLELAYOUT_H
27 |
28 |
29 | /******************************************************************************
30 | * Dependencies
31 | ******************************************************************************/
32 |
33 | #include "log4qt/layout.h"
34 |
35 |
36 | /******************************************************************************
37 | * Declarations
38 | ******************************************************************************/
39 |
40 |
41 | namespace Log4Qt
42 | {
43 |
44 | /*!
45 | * \brief The class SimpleLayout outputs the level and message of a logging
46 | * event.
47 | *
48 | * \note The ownership and lifetime of objects of this class are managed.
49 | * See \ref Ownership "Object ownership" for more details.
50 | */
51 | class SimpleLayout : public Layout
52 | {
53 | Q_OBJECT
54 |
55 | public:
56 | SimpleLayout(QObject *pParent = 0);
57 | // virtual ~SimpleLayout(); // Use compiler default
58 | private:
59 | SimpleLayout(const SimpleLayout &rOther); // Not implemented
60 | SimpleLayout &operator=(const SimpleLayout &rOther); // Not implemented
61 |
62 | public:
63 | virtual QString format(const LoggingEvent &rEvent);
64 |
65 | protected:
66 |
67 | #ifndef QT_NO_DEBUG_STREAM
68 | /*!
69 | * Writes all object member variables to the given debug stream
70 | * \a rDebug and returns the stream.
71 | *
72 | *
73 | * %SimpleLayout(name:"SL" referencecount:1)
74 | *
75 | * \sa QDebug, operator<<(QDebug debug, const LogObject &rLogObject)
76 | */
77 | virtual QDebug debug(QDebug &rDebug) const;
78 | #endif // QT_NO_DEBUG_STREAM
79 | };
80 |
81 |
82 | /**************************************************************************
83 | * Operators, Helper
84 | **************************************************************************/
85 |
86 |
87 | /**************************************************************************
88 | * Inline
89 | **************************************************************************/
90 |
91 | inline SimpleLayout::SimpleLayout(QObject *pParent) :
92 | Layout(pParent)
93 | {}
94 |
95 |
96 | } // namespace Log4Qt
97 |
98 |
99 | // Q_DECLARE_TYPEINFO(Log4Qt::SimpleLayout, Q_COMPLEX_TYPE); // Use default
100 |
101 |
102 | #endif // LOG4QT_SIMPLELAYOUT_H
103 |
--------------------------------------------------------------------------------
/src/DBManager/DBManager.pri:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | HEADERS += ./dbmanager.h \
11 | ./dbmanager_global.h
12 | SOURCES += ./dbmanager.cpp
13 |
--------------------------------------------------------------------------------
/src/DBManager/DBManager.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | TEMPLATE = lib
6 | TARGET = DBManager
7 | DESTDIR = $$PWD/../../lib
8 | QT += core sql
9 | CONFIG += debug_and_release
10 | DEFINES += QT_DLL DBMANAGER_LIB QT_SQL_LIB
11 | DEPENDPATH += $$PWD
12 |
13 | CONFIG(debug,debug|release){
14 | TARGET=$$join(TARGET,,,d)
15 | }
16 | CONFIG(release,release|debug){
17 |
18 | }
19 | include(DBManager.pri)
20 |
21 | message($$ConfigureName)
22 |
--------------------------------------------------------------------------------
/src/DBManager/DBManager.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;cxx;c;def
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h
11 |
12 |
13 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
14 | moc;h;cpp
15 | False
16 |
17 |
18 | {3c31eb9c-b2e1-400e-a8ff-965d0645bebd}
19 | cpp;moc
20 | False
21 |
22 |
23 | {4cbc352b-7a00-4be8-a304-bc537e17f4a1}
24 | cpp;moc
25 | False
26 |
27 |
28 |
29 |
30 | Source Files
31 |
32 |
33 |
34 |
35 | Header Files
36 |
37 |
38 | Header Files
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/DBManager/dbmanager.h:
--------------------------------------------------------------------------------
1 | #ifndef DBMANAGER_H
2 | #define DBMANAGER_H
3 |
4 | #include "dbmanager_global.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | class QSqlDatabase;
13 |
14 | class DBMANAGER_EXPORT DBManager : public QObject
15 | {
16 | public:
17 | DBManager(const QString& dbType,QObject *parent = 0);
18 | ~DBManager();
19 |
20 | inline bool isOpened() const;
21 |
22 | bool open(const QString& dbName,const QString& user, const QString& psw, const QString& address,int port);
23 |
24 | bool execSql(const QString& sql);
25 |
26 | bool update(const QString& table,const QMap& values,const QString& _where = "");
27 |
28 | bool remove(const QString& table,const QString& _where = "");
29 |
30 | bool add(const QString& table,const QMap& values);
31 |
32 | QList> query(const QString& table,/*[Output]*/QStringList& columns,const QString& _where = "");
33 |
34 | void close();
35 |
36 | private:
37 | QSqlDatabase* mDB;
38 | };
39 |
40 | #endif // DBMANAGER_H
41 |
--------------------------------------------------------------------------------
/src/DBManager/dbmanager_global.h:
--------------------------------------------------------------------------------
1 | #ifndef DBMANAGER_GLOBAL_H
2 | #define DBMANAGER_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef DBMANAGER_LIB
7 | # define DBMANAGER_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define DBMANAGER_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // DBMANAGER_GLOBAL_H
--------------------------------------------------------------------------------
/src/NetWork/Handler.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class Package;
4 |
5 | struct ReqeustContext
6 | {
7 | QHostAddress Address;
8 | quint16 Port;
9 | };
10 |
11 | class Handler
12 | {
13 | public:
14 | virtual QSharedPointer doHandle(const ReqeustContext&,QSharedPointer) = 0;
15 | };
16 |
17 |
--------------------------------------------------------------------------------
/src/NetWork/NetWork.pri:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | HEADERS += ./Handler.h \
11 | ./network_global.h \
12 | ./Package.h \
13 | ./Protocol.h \
14 | ./UDPClient.h \
15 | ./UDPServer.h \
16 | ./TCPClient.h \
17 | ./TCPServer.h
18 | SOURCES += ./Package.cpp \
19 | ./Protocol.cpp \
20 | ./UDPClient.cpp \
21 | ./UDPServer.cpp \
22 | ./TCPClient.cpp \
23 | ./TCPServer.cpp
24 |
--------------------------------------------------------------------------------
/src/NetWork/NetWork.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | TEMPLATE = lib
6 | TARGET = NetWork
7 | DESTDIR = $$PWD/../../lib
8 | QT += core network
9 | CONFIG += debug_and_release
10 | DEFINES += QT_DLL NETWORK_LIB QT_NETWORK_LIB
11 | INCLUDEPATH += $$PWD \
12 | $$PWD/../Utils
13 |
14 | DEPENDPATH += $$PWD
15 |
16 | CONFIG(debug,debug|release){
17 | TARGET=$$join(TARGET,,,d)
18 | }
19 |
20 | CONFIG(release,release|debug){
21 |
22 | }
23 | include(NetWork.pri)
24 |
--------------------------------------------------------------------------------
/src/NetWork/Package.cpp:
--------------------------------------------------------------------------------
1 | #include "Package.h"
2 |
3 | #include "BaseException.h"
4 |
5 | QSharedPointer ObjectFactory::createObject(const QByteArray& className)
6 | {
7 | ObjectFactory::Constructor constructor = constructors().value(className, nullptr);
8 | if (constructor == NULL)
9 | {
10 | EXCEPTION_SIMPLE_THROW(QLogicException, "Can not create object before regist this type.");
11 | return QSharedPointer();
12 | }
13 | return QSharedPointer((*constructor)());
14 | }
15 |
16 | QHash& ObjectFactory::constructors()
17 | {
18 | static QHash instance;
19 | return instance;
20 | }
21 |
--------------------------------------------------------------------------------
/src/NetWork/Package.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "network_global.h"
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #ifndef PACKAGE_VERSION
12 | #define PACKAGE_VERSION 1
13 | #endif // !PACKAGE_VERSION
14 |
15 | #define DECLARE_CLASS_NAME(class_name) static QByteArray className() { return #class_name;} \
16 | virtual QByteArray packageType() { return class_name::className(); }
17 |
18 | struct PackageHeader
19 | {
20 | qint16 Version;
21 |
22 | PackageHeader() : Version(PACKAGE_VERSION){}
23 | };
24 |
25 | class Package
26 | {
27 | public:
28 | Package(){}
29 | virtual ~Package(){}
30 |
31 | DECLARE_CLASS_NAME(Package)
32 |
33 | virtual bool pack(QDataStream& stream) /*= 0*/
34 | {
35 | stream << packageType() << mHeader.Version;
36 | return true;
37 | }
38 |
39 | virtual bool unpack(QDataStream& stream) /*= 0*/
40 | {
41 | stream >> mHeader.Version;
42 | return true;
43 | }
44 |
45 | qint16 version() const { return mHeader.Version; }
46 |
47 | void setVersion(qint16 version_) { mHeader.Version = version_; }
48 |
49 | protected:
50 | PackageHeader mHeader;
51 | };
52 |
53 | class NETWORK_EXPORT ObjectFactory
54 | {
55 | public:
56 | template
57 | static void registerClass()
58 | {
59 | constructors().insert(T::className(), &constructorHelper);
60 | }
61 |
62 | static QSharedPointer createObject(const QByteArray& className);
63 |
64 | private:
65 | typedef Package* (*Constructor)();
66 |
67 | template
68 | static Package* constructorHelper()
69 | {
70 | return new T();
71 | }
72 |
73 | static QHash& constructors();
74 | };
75 |
--------------------------------------------------------------------------------
/src/NetWork/Protocol.cpp:
--------------------------------------------------------------------------------
1 | #include "Protocol.h"
2 |
3 | Request::Request()
4 | :mRequestType(RT_NORMAL)
5 | {
6 | mHeader.Version = ProtocolVersion;
7 | }
8 |
9 | Request::~Request()
10 | {
11 |
12 | }
13 |
14 | void Request::setReqestType(quint8 type)
15 | {
16 | mRequestType = type;
17 | }
18 |
19 | quint8 Request::reqestType() const
20 | {
21 | return mRequestType;
22 | }
23 |
24 | void Request::setData(const QMap& data)
25 | {
26 | mRequestData = data;
27 | }
28 |
29 | bool Request::pack(QDataStream& stream)
30 | {
31 | Package::pack(stream);
32 |
33 | stream << mRequestType << mRequestData;
34 | return true;
35 | }
36 |
37 | bool Request::unpack(QDataStream& stream)
38 | {
39 | try{
40 | if (!Package::unpack(stream))
41 | return false;
42 |
43 | if (mHeader.Version != ProtocolVersion)
44 | return false;
45 |
46 | stream >> mRequestType >> mRequestData;
47 | }
48 | catch (...){
49 | return false;
50 | }
51 |
52 | return true;
53 | }
54 |
55 | const QMap& Request::data() const
56 | {
57 | return mRequestData;
58 | }
59 |
60 | //////////////////////////////////////////////////////////////////////////
61 |
62 | Response::Response()
63 | :mStatus(RS_OK)
64 | {
65 | mHeader.Version = ProtocolVersion;
66 | }
67 |
68 | Response::~Response()
69 | {
70 |
71 | }
72 |
73 | void Response::setStatus(quint8 status)
74 | {
75 | mStatus = status;
76 | }
77 |
78 | quint8 Response::status() const
79 | {
80 | return mStatus;
81 | }
82 |
83 | QByteArray Response::datas() const
84 | {
85 | return mDatas;
86 | }
87 |
88 | void Response::setDatas(const QByteArray& data)
89 | {
90 | mDatas = data;
91 | }
92 |
93 | bool Response::pack(QDataStream& stream)
94 | {
95 | if (!Package::pack(stream))
96 | return false;
97 |
98 | stream << mStatus << mDatas;
99 | return true;
100 | }
101 |
102 | bool Response::unpack(QDataStream& stream)
103 | {
104 | try
105 | {
106 | if (!Package::unpack(stream))
107 | return false;
108 |
109 | if (mHeader.Version != ProtocolVersion)
110 | return false;
111 |
112 | stream >> mStatus >> mDatas;
113 | }
114 | catch (...)
115 | {
116 | return false;
117 | }
118 | return true;
119 | }
120 |
--------------------------------------------------------------------------------
/src/NetWork/Protocol.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/NetWork/Protocol.h
--------------------------------------------------------------------------------
/src/NetWork/TCPServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/NetWork/TCPServer.cpp
--------------------------------------------------------------------------------
/src/NetWork/TCPServer.h:
--------------------------------------------------------------------------------
1 | #ifndef TCPSERVER_H
2 | #define TCPSERVER_H
3 |
4 | #include "network_global.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "Handler.h"
12 | #include "network_global.h"
13 |
14 | class QTcpServer;
15 | class QTcpSocket;
16 | class TCPServer;
17 |
18 | struct ClientEntity{
19 | QTcpSocket* Socket;
20 | quint64 TotalReadLength;
21 | quint64 ReadLength;
22 | quint64 TotalWriteLength;
23 | quint64 WriteLength;
24 |
25 | QByteArray ReadBuffer;
26 | QByteArray WriteBuffer;
27 |
28 | ClientEntity(){
29 | reset();
30 | }
31 |
32 | void reset(){
33 | TotalReadLength = 0;
34 | ReadLength = 0;
35 | TotalWriteLength = 0;
36 | WriteLength = 0;
37 |
38 | ReadBuffer.clear();
39 | WriteBuffer.clear();
40 | }
41 | };
42 |
43 | class NETWORK_EXPORT TCPReceiver :public QObject
44 | {
45 | Q_OBJECT
46 |
47 | public:
48 | TCPReceiver(TCPServer* server, QObject* parent = nullptr)
49 | :QObject(parent), mServer(server){}
50 |
51 | public slots :
52 | void new_connection();
53 | void on_ready_read();
54 | void on_bytes_written(qint64);
55 | void on_disconnected();
56 | void on_error(QAbstractSocket::SocketError);
57 |
58 | private:
59 | TCPServer* mServer;
60 | };
61 |
62 | class NETWORK_EXPORT TCPServer : public QThread,public Handler
63 | {
64 | Q_OBJECT
65 | friend class TCPReceiver;
66 | public:
67 | TCPServer(qint16 port,QObject *parent = nullptr);
68 | ~TCPServer();
69 |
70 | void setHandler(Handler*);
71 |
72 | quint32 requestNum() const;
73 |
74 | protected:
75 | void run();
76 |
77 | void handle(ClientEntity* entity);
78 |
79 | virtual QSharedPointer doHandle(const ReqeustContext& context, QSharedPointer package);
80 |
81 | private:
82 | QTcpServer* mTcpServer;
83 | Handler* mHandler;
84 | qint16 mPort;
85 |
86 | QHash mClients;
87 | quint32 mRequestNum;
88 | };
89 |
90 | #endif // TCPSERVER_H
91 |
--------------------------------------------------------------------------------
/src/NetWork/TcpClient.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/NetWork/TcpClient.cpp
--------------------------------------------------------------------------------
/src/NetWork/TcpClient.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/NetWork/TcpClient.h
--------------------------------------------------------------------------------
/src/NetWork/UDPClient.cpp:
--------------------------------------------------------------------------------
1 | #include "UDPClient.h"
2 |
3 | #include
4 |
5 | #include "Package.h"
6 |
7 | UDPClient::UDPClient()
8 | {
9 | }
10 |
11 |
12 | UDPClient::~UDPClient()
13 | {
14 | }
15 |
16 | void UDPClient::send(Package& package, const QHostAddress& address, int port)
17 | {
18 | QByteArray data;
19 | QDataStream outStream(&data, QIODevice::WriteOnly);
20 | outStream.setVersion(QDataStream::Qt_5_6);
21 | package.pack(outStream);
22 |
23 | QUdpSocket socket;
24 | socket.writeDatagram(data, address, port);
25 | }
26 |
--------------------------------------------------------------------------------
/src/NetWork/UDPClient.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "network_global.h"
4 |
5 | #include
6 |
7 | class Package;
8 |
9 | class NETWORK_EXPORT UDPClient
10 | {
11 | public:
12 | UDPClient();
13 | ~UDPClient();
14 |
15 | static void send(Package& package, const QHostAddress& address, int port);
16 |
17 | private:
18 |
19 | };
20 |
21 |
--------------------------------------------------------------------------------
/src/NetWork/UDPServer.cpp:
--------------------------------------------------------------------------------
1 | #include "UDPServer.h"
2 |
3 | #include
4 |
5 | #include "BaseException.h"
6 |
7 | #include "Package.h"
8 | #include "Protocol.h"
9 |
10 | UDPServer::UDPServer(int port,QObject *parent)
11 | : QThread(parent)
12 | , mUdpSocket(nullptr)
13 | , mPort(port)
14 | , mRequestNum(0)
15 | {
16 | mHandler = this;
17 | }
18 |
19 | UDPServer::~UDPServer()
20 | {
21 |
22 | }
23 |
24 | void UDPServer::setHandler(Handler* handler)
25 | {
26 | mHandler = handler;
27 | }
28 |
29 | void UDPServer::handle(const ReqeustContext& context , QByteArray& data)
30 | {
31 | QDataStream stream(&data, QIODevice::ReadOnly);
32 | stream.setVersion(QDataStream::Qt_5_6);
33 |
34 | QByteArray className;
35 | stream >> className;
36 |
37 | QSharedPointer package = ObjectFactory::createObject(className);
38 | if (package.isNull())
39 | return;
40 |
41 | package->unpack(stream);
42 | mHandler->doHandle(context,package);
43 | mRequestNum++;
44 | qDebug() << "UDPServer:receive one package.";
45 | }
46 |
47 | QSharedPointer UDPServer::doHandle(const ReqeustContext& context , QSharedPointer package)
48 | {
49 | return QSharedPointer();
50 | }
51 |
52 | void UDPServer::run()
53 | {
54 | mRequestNum = 0;
55 | mUdpSocket = new QUdpSocket();
56 |
57 | if (!mUdpSocket->bind(QHostAddress::Any, mPort, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint))
58 | {
59 | mUdpSocket->deleteLater();
60 | EXCEPTION_SIMPLE_THROW(QRuntimeException, "connot bind udpsocket!");
61 | }
62 |
63 | UDPReceiver* ts = new UDPReceiver(this);
64 | connect(mUdpSocket, SIGNAL(readyRead())
65 | , ts, SLOT(readPendingDatagrams()));
66 |
67 | exec();
68 |
69 | mUdpSocket->deleteLater();
70 | mUdpSocket = nullptr;
71 | ts->deleteLater();
72 | }
73 |
74 | quint32 UDPServer::requestNum() const
75 | {
76 | return mRequestNum;
77 | }
78 |
79 | //////////////////////////////////////////////////////////////////////////
80 |
81 | void UDPReceiver::readPendingDatagrams()
82 | {
83 | while (mServer->mUdpSocket->hasPendingDatagrams()) {
84 | QByteArray datagram;
85 | datagram.resize(mServer->mUdpSocket->pendingDatagramSize());
86 |
87 | ReqeustContext context;
88 |
89 | mServer->mUdpSocket->readDatagram(datagram.data(), datagram.size(),
90 | &context.Address, &context.Port);
91 |
92 | mServer->handle(context, datagram);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/NetWork/UDPServer.h:
--------------------------------------------------------------------------------
1 | #ifndef UDPSERVER_H
2 | #define UDPSERVER_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "network_global.h"
9 |
10 | #include "Handler.h"
11 |
12 | class QUdpSocket;
13 | class Package;
14 | class UDPServer;
15 |
16 | class UDPReceiver :public QObject
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | UDPReceiver(UDPServer* server, QObject* parent = nullptr)
22 | :QObject(parent), mServer(server){}
23 |
24 | public slots :
25 | void readPendingDatagrams();
26 |
27 | private:
28 | UDPServer* mServer;
29 | };
30 |
31 | class NETWORK_EXPORT UDPServer : public QThread,public Handler
32 | {
33 | Q_OBJECT
34 |
35 | friend class UDPReceiver;
36 | public:
37 | UDPServer(int port,QObject *parent = nullptr);
38 | ~UDPServer();
39 |
40 | void setHandler(Handler*);
41 |
42 | quint32 requestNum() const;
43 |
44 | protected:
45 | void run();
46 |
47 | void handle(const ReqeustContext&, QByteArray& data);
48 |
49 | virtual QSharedPointer doHandle(const ReqeustContext&, QSharedPointer);
50 |
51 | private:
52 | QUdpSocket* mUdpSocket;
53 | Handler* mHandler;
54 | qint16 mPort;
55 | quint32 mRequestNum;
56 | };
57 |
58 | #endif // UDPSERVER_H
59 |
--------------------------------------------------------------------------------
/src/NetWork/network_global.h:
--------------------------------------------------------------------------------
1 | #ifndef NETWORK_GLOBAL_H
2 | #define NETWORK_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef NETWORK_LIB
7 | # define NETWORK_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define NETWORK_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // NETWORK_GLOBAL_H
13 |
--------------------------------------------------------------------------------
/src/QAF/QAF.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/QAF.ico
--------------------------------------------------------------------------------
/src/QAF/QAF.pri:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | HEADERS += ./stdafx.h \
11 | ./mainwindow.h \
12 | ./qafapplication.h
13 | SOURCES += ./main.cpp \
14 | ./mainwindow.cpp \
15 | ./qafapplication.cpp \
16 | ./stdafx.cpp
17 | FORMS += ./mainwindow.ui
18 | RESOURCES += qaf.qrc \
19 | style.qrc
20 |
--------------------------------------------------------------------------------
/src/QAF/QAF.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | TEMPLATE = app
6 | TARGET = QAF
7 | DESTDIR = $$PWD/../../bin/Debug
8 | QT += core widgets gui
9 | CONFIG += debug_and_release console
10 | DEFINES += QT_DLL QT_WIDGETS_LIB
11 |
12 | INCLUDEPATH += $$PWD \
13 | $$PWD/../QAFCore \
14 | $$PWD/../QtAwesome \
15 | $$PWD/../Utils \
16 | $$PWD/../../include
17 |
18 | LIBS += -L"$$PWD/../../lib"
19 | PRECOMPILED_HEADER = stdafx.h
20 | DEPENDPATH += $$PWD
21 |
22 | CONFIG(debug,debug|release){
23 | TARGET=$$join(TARGET,,,d)
24 | LIBS += -lQAFCored \
25 | #-llog4qtd \
26 | -lQtAwesomed
27 | }
28 |
29 | CONFIG(release,release|debug){
30 | LIBS += -lQAFCore \
31 | #-llog4qt \
32 | -lQtAwesome
33 | }
34 | include(QAF.pri)
35 | win32:RC_FILE = QAF.rc
36 |
--------------------------------------------------------------------------------
/src/QAF/QAF.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON DISCARDABLE "QAF.ico"
2 |
3 |
--------------------------------------------------------------------------------
/src/QAF/Resources/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/Resources/folder.png
--------------------------------------------------------------------------------
/src/QAF/Resources/gear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/Resources/gear.png
--------------------------------------------------------------------------------
/src/QAF/Resources/startup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/Resources/startup.png
--------------------------------------------------------------------------------
/src/QAF/main.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "qafapplication.h"
3 |
4 | #include
5 |
6 | //#include
7 | //#include
8 |
9 | int main(int argc, char *argv[])
10 | {
11 | QApplication::addLibraryPath("");
12 |
13 | QAFApplication app(argc, argv);
14 |
15 | // Log4Qt::BasicConfigurator::configure();
16 |
17 | // Log4Qt::Logger* rootLogger = Log4Qt::Logger::rootLogger();
18 |
19 | // rootLogger->info("test log4qt");
20 | // rootLogger->error("test log4qt error");
21 |
22 | if (!app.onlyOne()){
23 | QMessageBox::critical(NULL, "Process has been running", "Only one instance is allowed!");
24 | return 1;
25 | }
26 |
27 | return app.run();
28 | }
29 |
--------------------------------------------------------------------------------
/src/QAF/mainwindow.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/mainwindow.cpp
--------------------------------------------------------------------------------
/src/QAF/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef QAF_H
2 | #define QAF_H
3 |
4 | #include
5 | #include "UIInterface.h"
6 | #include "ui_mainwindow.h"
7 |
8 | using QAF::UIInterface;
9 |
10 | class MainWindow
11 | : public QMainWindow
12 | , public UIInterface
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | MainWindow(QWidget *parent = 0);
18 | ~MainWindow();
19 |
20 | virtual QWidget* getMainWindow();
21 | virtual QMenu* getMenu(int id);
22 | virtual QAction* getAction(int id);
23 | virtual QWidget* getWidget(int id);
24 | virtual QDockWidget* getDockWidget(int id);
25 | virtual void setMenu(int id, QMenu* menu);
26 | virtual void setAction(int id, QAction* action);
27 | virtual void setWidget(int id, QWidget* widget);
28 | virtual void setDockWidget(int id, QDockWidget* dock, QAF::DockWidgetPos pos = QAF::DWP_BOTTOM);
29 |
30 | protected:
31 | void createMenu();
32 | void createAction();
33 |
34 | private:
35 | Ui::MainWindow ui;
36 |
37 | QSplashScreen* mSplashScreen;
38 | QMap mMenus;
39 | QMap mActions;
40 | QMap mWidgets;
41 | QMap mDockWidgets;
42 | };
43 |
44 | #endif // QAF_H
45 |
--------------------------------------------------------------------------------
/src/QAF/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 766
10 | 499
11 |
12 |
13 |
14 | 主程序
15 |
16 |
17 |
18 |
19 |
20 |
66 |
67 |
68 | 主程序
69 |
70 |
71 | TopToolBarArea
72 |
73 |
74 | false
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/src/QAF/qaf.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Resources/folder.png
4 | Resources/gear.png
5 | Resources/startup.png
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/QAF/qafapplication.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "qafapplication.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "mainwindow.h"
10 |
11 | QAFApplication::QAFApplication(int & argc, char ** argv)
12 | :QApplication(argc,argv)
13 | {
14 |
15 | }
16 |
17 | QAFApplication::~QAFApplication()
18 | {
19 |
20 | }
21 |
22 | void QAFApplication::splashMessage(QString msg)
23 | {
24 | QAFApplication* app = static_cast(instance());
25 | if (app && app->mSplashScreen)
26 | {
27 | app->mSplashScreen->showMessage(msg, Qt::AlignRight | Qt::AlignBottom, Qt::white);
28 | processEvents();
29 | }
30 | }
31 |
32 | void QAFApplication::initialize()
33 | {
34 |
35 | QtAwesome::getSingleton()->initFontAwesome();
36 | QVariantMap options;
37 | //options.insert("color-active", QColor(205,0,0 ) );
38 | //options.insert("anim", qVariantFromValue(new QtAwesomeAnimation(beerButton, 10, 2)));
39 | QIcon icon = QtAwesome::getSingleton()->icon(fa::locationarrow, options);
40 | setWindowIcon(icon);
41 |
42 | //set propertys of application
43 | setApplicationName("QAF");
44 | setOrganizationName("xiaojian");
45 | setOrganizationDomain("xiaojian.site");
46 | setApplicationVersion(QAF_VERSION_STR);
47 |
48 | //install qss
49 | QFile f(":qdarkstyle/style.qss");
50 | if (!f.exists())
51 | {
52 | printf("Unable to set stylesheet, file not found\n");
53 | }
54 | else
55 | {
56 | f.open(QFile::ReadOnly | QFile::Text);
57 | QTextStream ts(&f);
58 | qApp->setStyleSheet(ts.readAll());
59 | }
60 |
61 | //install translator
62 | QString lang = QLocale::system().name().section('_', 0, 0);
63 | QString trPath = QAF::QAFContext::wellKnownPath(QAF::DT_TRANSTOR);
64 | QString trName = "qaf_" + lang;
65 | QTranslator tr;
66 | if (tr.load(trName, trPath))
67 | {
68 | installTranslator(&tr);
69 | }
70 |
71 | //initialize splash window
72 | QPixmap pixmap(":/QAF/Resources/startup.png");
73 | mSplashScreen = new QSplashScreen(pixmap);
74 | mSplashScreen->show();
75 | processEvents();
76 |
77 | mMainWindow = new MainWindow();
78 | }
79 |
80 | int QAFApplication::run()
81 | {
82 | initialize();
83 |
84 | QAF::QAFContext::getSingleton()->construct();
85 |
86 | int ret = 0;
87 | mMainWindow->showMaximized();
88 | mSplashScreen->finish(mMainWindow);
89 | mSplashScreen->deleteLater();
90 | mSplashScreen = nullptr;
91 | ret = exec();
92 | mMainWindow->deleteLater();
93 | mMainWindow = nullptr;
94 |
95 | QAF::QAFContext::getSingleton()->destruct();
96 | return ret;
97 | }
98 |
99 | bool QAFApplication::onlyOne()
100 | {
101 | static QSharedMemory shared_memory;
102 | shared_memory.setKey(qApp->applicationName());
103 |
104 | if (shared_memory.attach()) {
105 | return false;
106 | }else{
107 | shared_memory.create(1);
108 | }
109 |
110 | return true;
111 | }
112 |
--------------------------------------------------------------------------------
/src/QAF/qafapplication.h:
--------------------------------------------------------------------------------
1 | #ifndef QAFAPPLICATION_H
2 | #define QAFAPPLICATION_H
3 |
4 | #include
5 |
6 | class QAFApplication : public QApplication
7 | {
8 | public:
9 | QAFApplication(int & argc, char ** argv);
10 | ~QAFApplication();
11 |
12 | int run();
13 |
14 | bool onlyOne();
15 |
16 | static void splashMessage(QString);
17 |
18 | protected:
19 | void initialize();
20 |
21 | private:
22 | QSplashScreen* mSplashScreen = nullptr;
23 | QWidget* mMainWindow = nullptr;
24 | };
25 |
26 | #endif // QAFAPPLICATION_H
27 |
--------------------------------------------------------------------------------
/src/QAF/rc/Hmovetoolbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/Hmovetoolbar.png
--------------------------------------------------------------------------------
/src/QAF/rc/Hsepartoolbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/Hsepartoolbar.png
--------------------------------------------------------------------------------
/src/QAF/rc/Vmovetoolbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/Vmovetoolbar.png
--------------------------------------------------------------------------------
/src/QAF/rc/Vsepartoolbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/Vsepartoolbar.png
--------------------------------------------------------------------------------
/src/QAF/rc/branch_closed-on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/branch_closed-on.png
--------------------------------------------------------------------------------
/src/QAF/rc/branch_closed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/branch_closed.png
--------------------------------------------------------------------------------
/src/QAF/rc/branch_open-on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/branch_open-on.png
--------------------------------------------------------------------------------
/src/QAF/rc/branch_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/branch_open.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_checked.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_checked_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_checked_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_checked_focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_checked_focus.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_indeterminate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_indeterminate.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_indeterminate_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_indeterminate_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_indeterminate_focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_indeterminate_focus.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_unchecked.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_unchecked_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_unchecked_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/checkbox_unchecked_focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/checkbox_unchecked_focus.png
--------------------------------------------------------------------------------
/src/QAF/rc/close-hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/close-hover.png
--------------------------------------------------------------------------------
/src/QAF/rc/close-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/close-pressed.png
--------------------------------------------------------------------------------
/src/QAF/rc/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/close.png
--------------------------------------------------------------------------------
/src/QAF/rc/down_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/down_arrow.png
--------------------------------------------------------------------------------
/src/QAF/rc/down_arrow_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/down_arrow_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/left_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/left_arrow.png
--------------------------------------------------------------------------------
/src/QAF/rc/left_arrow_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/left_arrow_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/radio_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/radio_checked.png
--------------------------------------------------------------------------------
/src/QAF/rc/radio_checked_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/radio_checked_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/radio_checked_focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/radio_checked_focus.png
--------------------------------------------------------------------------------
/src/QAF/rc/radio_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/radio_unchecked.png
--------------------------------------------------------------------------------
/src/QAF/rc/radio_unchecked_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/radio_unchecked_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/radio_unchecked_focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/radio_unchecked_focus.png
--------------------------------------------------------------------------------
/src/QAF/rc/right_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/right_arrow.png
--------------------------------------------------------------------------------
/src/QAF/rc/right_arrow_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/right_arrow_disabled.png
--------------------------------------------------------------------------------
/src/QAF/rc/sizegrip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/sizegrip.png
--------------------------------------------------------------------------------
/src/QAF/rc/stylesheet-branch-end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/stylesheet-branch-end.png
--------------------------------------------------------------------------------
/src/QAF/rc/stylesheet-branch-more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/stylesheet-branch-more.png
--------------------------------------------------------------------------------
/src/QAF/rc/stylesheet-vline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/stylesheet-vline.png
--------------------------------------------------------------------------------
/src/QAF/rc/transparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/transparent.png
--------------------------------------------------------------------------------
/src/QAF/rc/undock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/undock.png
--------------------------------------------------------------------------------
/src/QAF/rc/up_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/up_arrow.png
--------------------------------------------------------------------------------
/src/QAF/rc/up_arrow_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAF/rc/up_arrow_disabled.png
--------------------------------------------------------------------------------
/src/QAF/stdafx.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
--------------------------------------------------------------------------------
/src/QAF/stdafx.h:
--------------------------------------------------------------------------------
1 | #include
2 |
--------------------------------------------------------------------------------
/src/QAF/style.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | rc/up_arrow_disabled.png
4 | rc/Hmovetoolbar.png
5 | rc/stylesheet-branch-end.png
6 | rc/branch_closed-on.png
7 | rc/stylesheet-vline.png
8 | rc/branch_closed.png
9 | rc/branch_open-on.png
10 | rc/transparent.png
11 | rc/right_arrow_disabled.png
12 | rc/sizegrip.png
13 | rc/close.png
14 | rc/close-hover.png
15 | rc/close-pressed.png
16 | rc/down_arrow.png
17 | rc/Vmovetoolbar.png
18 | rc/left_arrow.png
19 | rc/stylesheet-branch-more.png
20 | rc/up_arrow.png
21 | rc/right_arrow.png
22 | rc/left_arrow_disabled.png
23 | rc/Hsepartoolbar.png
24 | rc/branch_open.png
25 | rc/Vsepartoolbar.png
26 | rc/down_arrow_disabled.png
27 | rc/undock.png
28 | rc/checkbox_checked_disabled.png
29 | rc/checkbox_checked_focus.png
30 | rc/checkbox_checked.png
31 | rc/checkbox_indeterminate.png
32 | rc/checkbox_indeterminate_focus.png
33 | rc/checkbox_unchecked_disabled.png
34 | rc/checkbox_unchecked_focus.png
35 | rc/checkbox_unchecked.png
36 | rc/radio_checked_disabled.png
37 | rc/radio_checked_focus.png
38 | rc/radio_checked.png
39 | rc/radio_unchecked_disabled.png
40 | rc/radio_unchecked_focus.png
41 | rc/radio_unchecked.png
42 |
43 |
44 | style.qss
45 |
46 |
47 |
--------------------------------------------------------------------------------
/src/QAFCore/AbstractObject.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/AbstractObject.cpp
--------------------------------------------------------------------------------
/src/QAFCore/AbstractObject.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/AbstractObject.h
--------------------------------------------------------------------------------
/src/QAFCore/AbstractPlugin.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/AbstractPlugin.h
--------------------------------------------------------------------------------
/src/QAFCore/AbstractSystem.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/AbstractSystem.h
--------------------------------------------------------------------------------
/src/QAFCore/ConfigSystem.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/ConfigSystem.cpp
--------------------------------------------------------------------------------
/src/QAFCore/ConfigSystem.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/ConfigSystem.h
--------------------------------------------------------------------------------
/src/QAFCore/LogModel.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/LogModel.cpp
--------------------------------------------------------------------------------
/src/QAFCore/LogModel.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/LogModel.h
--------------------------------------------------------------------------------
/src/QAFCore/ObjectModel.cpp:
--------------------------------------------------------------------------------
1 | #include "ObjectModel.h"
2 |
3 | namespace QAF
4 | {
5 | ObjectModel::ObjectModel(QObject *parent)
6 | : QtCommonModel(parent)
7 | {
8 |
9 | }
10 |
11 | ObjectModel::~ObjectModel()
12 | {
13 |
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/src/QAFCore/ObjectModel.h:
--------------------------------------------------------------------------------
1 | #ifndef OBJECTMODEL_H
2 | #define OBJECTMODEL_H
3 |
4 | #include "QtCommonModel.h"
5 |
6 | namespace QAF
7 | {
8 | class ObjectModel : public QtCommonModel
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | ObjectModel(QObject *parent);
14 | ~ObjectModel();
15 |
16 | private:
17 |
18 | };
19 | }
20 |
21 | #endif // OBJECTMODEL_H
22 |
--------------------------------------------------------------------------------
/src/QAFCore/ObjectProxy.cpp:
--------------------------------------------------------------------------------
1 | #include "ObjectProxy.h"
2 | #include "ObjectSystem.h"
3 |
4 | namespace QAF
5 | {
6 |
7 | ObjectProxy::ObjectProxy(ObjectId id, ObjectSystem* os)
8 | :mObjectSystem(os)
9 | , mObjectId(id)
10 | {
11 | if (id != 0 && os)
12 | {
13 | mObjectSystem->addObjectProxy(this);
14 | }
15 | }
16 |
17 | ObjectProxy::ObjectProxy(const ObjectProxy& other)
18 | {
19 | mObjectId = 0;
20 | mObjectSystem = nullptr;
21 |
22 | if (other.isNull())
23 | {
24 | mObjectSystem = other.mObjectSystem;
25 | mObjectId = other.mObjectId;
26 | mObjectSystem->addObjectProxy(this);
27 | }
28 | }
29 |
30 | ObjectProxy::~ObjectProxy()
31 | {
32 | if (isNull())
33 | {
34 | mObjectSystem->removeObjectProxy(this);
35 | }
36 |
37 | mObjectId = 0;
38 | mObjectSystem = nullptr;
39 | }
40 |
41 | bool ObjectProxy::isNull() const
42 | {
43 | if (!mObjectSystem)
44 | return false;
45 |
46 | if (mObjectId != 0)
47 | return (mObjectSystem->query(mObjectId) != nullptr);
48 | else
49 | return false;
50 | }
51 |
52 | ObjectProxy& ObjectProxy::operator=(const ObjectProxy& other)
53 | {
54 | if (isNull())
55 | {
56 | mObjectSystem->removeObjectProxy(this);
57 | }
58 |
59 | mObjectId = 0;
60 | mObjectSystem = nullptr;
61 |
62 | if (other.isNull())
63 | {
64 | mObjectSystem = other.mObjectSystem;
65 | mObjectId = other.mObjectId;
66 | mObjectSystem->addObjectProxy(this);
67 | }
68 |
69 | return *this;
70 | }
71 |
72 | AbstractObject* ObjectProxy::ptr() const
73 | {
74 | return mObjectSystem->query(mObjectId);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/QAFCore/ObjectProxy.h:
--------------------------------------------------------------------------------
1 | #ifndef OBJECTPROXY_H
2 | #define OBJECTPROXY_H
3 |
4 | #include "qafcore_global.h"
5 | #include "AbstractObject.h"
6 |
7 | namespace QAF
8 | {
9 | class ObjectSystem;
10 |
11 | class QAFCORE_EXPORT ObjectProxy
12 | {
13 | friend class ObjectSystem;
14 |
15 | public:
16 | ObjectProxy(ObjectId id, ObjectSystem* ObjectSystemId);
17 | ObjectProxy(const ObjectProxy&);
18 | virtual ~ObjectProxy();
19 |
20 | inline bool isNull() const;
21 | ObjectProxy& operator=(const ObjectProxy&);
22 |
23 | ObjectId objectId() const
24 | {
25 | return mObjectId;
26 | }
27 |
28 | ObjectSystem* objectSystem() const
29 | {
30 | return mObjectSystem;
31 | }
32 |
33 | protected:
34 | AbstractObject* ptr() const;
35 |
36 | protected:
37 | ObjectId mObjectId;
38 | ObjectSystem* mObjectSystem;
39 | };
40 | }
41 |
42 | #endif //OBJECTPROXY_H
43 |
--------------------------------------------------------------------------------
/src/QAFCore/ObjectPtr.h:
--------------------------------------------------------------------------------
1 | #ifndef OBJECTPTR_H
2 | #define OBJECTPTR_H
3 |
4 | #include "ObjectProxy.h"
5 |
6 | namespace QAF
7 | {
8 |
9 | class ObjectSystem;
10 |
11 | template
12 | class ObjectPtr :public ObjectProxy
13 | {
14 | public:
15 | ObjectPtr(ObjectId id = INVALID_OBJECT_ID, ObjectSystem* ObjectSystemId = nullptr)
16 | :ObjectProxy(id, ObjectSystemId){
17 |
18 | }
19 |
20 | template
21 | ObjectPtr(const ObjectPtr& other)
22 | : ObjectProxy(INVALID_OBJECT_ID,nullptr)
23 | {
24 | AbstractObject* ao = (AbstractObject*)(other.data());
25 | T* uPtr = dynamic_cast(ao);
26 | if (uPtr){
27 | setObjectId(other.objectId());
28 | setObjectSystem(other.objectSystem());
29 | }
30 | }
31 |
32 | ~ObjectPtr(){}
33 |
34 | inline bool isValid() const
35 | {
36 | return this->isNull();
37 | }
38 |
39 | inline const T& operator*() const
40 | {
41 | T* t = dynamic_cast(ptr());
42 | Q_ASSERT(t);
43 | return *t;
44 | }
45 |
46 | T* operator->() const
47 | {
48 | return static_cast(ptr());
49 | }
50 |
51 | inline const T* data() const
52 | {
53 | return static_cast(ptr());
54 | }
55 |
56 | inline bool operator!() const
57 | {
58 | return isValid();
59 | }
60 |
61 | inline bool operator==(const ObjectPtr& other) const
62 | {
63 | if (isValid() && other.isValid()
64 | && objectId() == other->objectId()
65 | && objectSystem() == other->objectSystem())
66 | {
67 | return true;
68 | }else{
69 | return false;
70 | }
71 | }
72 |
73 | protected:
74 | void setObjectId(ObjectId id)
75 | {
76 | mObjectId = id;
77 | }
78 |
79 | void setObjectSystem(ObjectSystem* sys)
80 | {
81 | mObjectSystem = sys;
82 | }
83 |
84 | // ASSERT_CONVERTIBLE_TYPE(T, AbstractObject);
85 | };
86 | }
87 |
88 | #endif //OBJECTPTR_H
89 |
--------------------------------------------------------------------------------
/src/QAFCore/ObjectSystem.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/ObjectSystem.cpp
--------------------------------------------------------------------------------
/src/QAFCore/ObjectSystem.h:
--------------------------------------------------------------------------------
1 | #ifndef OBJECTSYSTEM_H
2 | #define OBJECTSYSTEM_H
3 |
4 | #include "AbstractObject.h"
5 | #include "ObjectPtr.h"
6 | #include "AbstractSystem.h"
7 |
8 | #include
9 |
10 | namespace QAF
11 | {
12 | class QAFCORE_EXPORT ObjectSystem :
13 | public AbstractSystem
14 | {
15 | friend class ObjectProxy;
16 |
17 | Q_OBJECT
18 |
19 | public:
20 | ObjectSystem(int sysId, QObject* parent = 0);
21 | ~ObjectSystem();
22 |
23 | virtual void install();
24 | virtual void uninstall();
25 |
26 | template
27 | ObjectPtr create(Args... args)
28 | {
29 | AbstractObject* obj = new T(args...);
30 | ObjectId id = makeId();
31 | obj->mObjectId = id;
32 | ObjectInfo* info = new ObjectInfo();
33 | info->mObject = obj;
34 | mObjects.insert(id, info);
35 | return ObjectPtr(id, this);
36 | }
37 |
38 | template
39 | ObjectPtr clone(const ObjectPtr& other)
40 | {
41 | AbstractObject* obj = new T(*other);
42 | ObjectId id = makeId();
43 | obj->mObjectId = id;
44 | ObjectInfo* info = new ObjectInfo();
45 | info->mObject = obj;
46 | mObjects.insert(id, info);
47 | return ObjectPtr(id, this);
48 | }
49 |
50 | template
51 | ObjectPtr object(ObjectId id)
52 | {
53 | T* p = qobject_cast(query(id));
54 | if (p)
55 | return ObjectPtr(id, this);
56 | else
57 | return ObjectPtr();
58 | }
59 |
60 | bool merge(ObjectSystem&);
61 | bool destory(ObjectId);
62 | inline bool hasObject(ObjectId);
63 | inline int objectCount();
64 |
65 | protected:
66 | inline ObjectId makeId();
67 | inline void releaseId(ObjectId);
68 | bool changeId(ObjectId before, ObjectId after);
69 | AbstractObject* query(ObjectId);
70 |
71 | void addObjectProxy(ObjectProxy*);
72 | void removeObjectProxy(ObjectProxy*);
73 |
74 | private:
75 |
76 | struct ObjectInfo
77 | {
78 | AbstractObject* mObject;
79 | QList mProxys;
80 |
81 | ObjectInfo()
82 | {
83 | mObject = nullptr;
84 | }
85 | };
86 |
87 | QHash mObjects;
88 |
89 | ObjectId mMinValidId;
90 | ObjectId mMaxValidId;
91 | };
92 | }
93 |
94 | #endif //OBJECTSYSTEM_H
95 |
--------------------------------------------------------------------------------
/src/QAFCore/PluginSystem.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/PluginSystem.cpp
--------------------------------------------------------------------------------
/src/QAFCore/PluginSystem.h:
--------------------------------------------------------------------------------
1 | #ifndef PLUGINSYSTEM_H
2 | #define PLUGINSYSTEM_H
3 |
4 | #include "AbstractSystem.h"
5 |
6 | #include
7 | #include
8 |
9 | namespace QAF
10 | {
11 | class AbstractPlugin;
12 | class AbstractPluginFactory;
13 |
14 | class PluginSystem :
15 | public AbstractSystem
16 | {
17 | Q_OBJECT
18 | public:
19 |
20 | struct PluginConfig
21 | {
22 | QString mPlugin;
23 | QMap mConfigs;
24 | };
25 |
26 | PluginSystem(int sysId, QObject* parent = 0);
27 | ~PluginSystem();
28 |
29 | virtual void install();
30 | virtual void uninstall();
31 |
32 | protected:
33 | QList getPluginsFromConfig();
34 |
35 | private:
36 | QList mPlugins;
37 | QList mFactorys;
38 | };
39 | }
40 |
41 | #endif //PLUGINSYSTEM_H
42 |
--------------------------------------------------------------------------------
/src/QAFCore/QAFContext.cpp:
--------------------------------------------------------------------------------
1 | #include "QAFContext.h"
2 |
3 | #include
4 | #include
5 |
6 | #include "QAFCore.h"
7 | #include "QAFContext.h"
8 |
9 | namespace QAF
10 | {
11 | void QAFContext::setUIInterface(UIInterface* ui)
12 | {
13 | if (ui){
14 | QAFCore::getSingleton()->setUIInterface(ui);
15 | }
16 | }
17 |
18 | UIInterface* QAFContext::getUIInterface() const
19 | {
20 | return QAFCore::getSingleton()->getUIInterface();
21 | }
22 |
23 | AbstractSystem* QAFContext::getSystem(SystemType st) const
24 | {
25 | return QAFCore::getSingleton()->getSystem(st);
26 | }
27 |
28 | void QAFContext::construct()
29 | {
30 | QAFCore::getSingleton()->initialize();
31 | }
32 |
33 | void QAFContext::destruct()
34 | {
35 | QAFCore::release();
36 | }
37 |
38 | LogModel* QAFContext::getLogModel() const
39 | {
40 | return QAFCore::getSingleton()->getLogModel();
41 | }
42 |
43 | QString QAFContext::wellKnownPath(DirType dt)
44 | {
45 | static QString dirPath = QCoreApplication::applicationDirPath();
46 | QString ret = dirPath;
47 | switch (dt)
48 | {
49 | case QAF::DT_HOME://"Bin/"
50 | break;
51 | case QAF::DT_CONFIG://"Bin/../conf"
52 | ret += "/../conf";
53 | break;
54 | case QAF::DT_TRANSTOR://"Bin/../lang"
55 | ret += "/../lang";
56 | break;
57 | case QAF::DT_LOG://"Bin/../log"
58 | ret += "/../log";
59 | break;
60 | case QAF::DT_DATA://"Bin/../data"
61 | ret += "/../data";
62 | break;
63 | case QAF::DT_PLUGIN://"Bin/plugin"
64 | ret += "/plugin";
65 | break;
66 | default:
67 | break;
68 | }
69 |
70 | QDir currDir(ret);
71 | if (!currDir.exists())
72 | {
73 | //auto make if don't exists
74 | currDir.mkpath(ret);
75 | }
76 | return currDir.absolutePath();
77 | }
78 | }
--------------------------------------------------------------------------------
/src/QAFCore/QAFContext.h:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file QAFContext.h
3 | * \date 2016/07/22
4 | *
5 | * \author zxj
6 | *
7 | * \brief
8 | *
9 | * agent of the core model,to control user's access authority
10 | *
11 | * \note
12 | */
13 |
14 | #ifndef QAFCONTEXT_H
15 | #define QAFCONTEXT_H
16 |
17 | #include "qafcore_global.h"
18 | #include "Singleton.h"
19 | #include "QAFGlobal.h"
20 |
21 | namespace QAF
22 | {
23 | class UIInterface;
24 | class AbstractSystem;
25 | class LogModel;
26 |
27 | class QAFCORE_EXPORT QAFContext:public Singleton
28 | {
29 | public:
30 | void construct();
31 | void destruct();
32 |
33 | /*!
34 | * \fn wellKnwonPath
35 | * \brief
36 | * To get common path in this application
37 | * \param
38 | * dt:the type of dir
39 | * \return
40 | * absolute path for given type
41 | */
42 | static QString wellKnownPath(DirType);
43 |
44 | /*!
45 | * \fn getLogModel
46 | * \brief
47 | * get log model
48 | * \param
49 | * void
50 | * \return
51 | * pointer of log model
52 | */
53 | LogModel* getLogModel() const;
54 |
55 | /*!
56 | * \fn setUIInterface
57 | * \brief
58 | * \param
59 | *
60 | * \return
61 | * void
62 | */
63 | void setUIInterface(UIInterface*);
64 |
65 | /*!
66 | * \fn getUIInterface
67 | * \brief
68 | * get the interface of GUI to create your custom appearance
69 | * \param
70 | * void
71 | * \return
72 | * pointer of ui interface
73 | */
74 | UIInterface* getUIInterface() const;
75 |
76 | /*!
77 | * \fn getSystem
78 | * \brief
79 | * get system
80 | * \param
81 | * st:system type what your what
82 | * \return
83 | * pointer of abstract system
84 | */
85 | AbstractSystem* getSystem(SystemType) const;
86 | };
87 | }
88 |
89 | #endif //QAFCONTEXT_H
90 |
--------------------------------------------------------------------------------
/src/QAFCore/QAFCore.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/QAFCore.cpp
--------------------------------------------------------------------------------
/src/QAFCore/QAFCore.h:
--------------------------------------------------------------------------------
1 | #ifndef QAFCORE_H
2 | #define QAFCORE_H
3 |
4 | #include
5 | #include
6 |
7 | #include "Singleton.h"
8 | #include "QAFGlobal.h"
9 |
10 | class QAbstractItemModel;
11 |
12 | namespace QAF
13 | {
14 | class AbstractObject;
15 | class AbstractSystem;
16 | class PluginSystem;
17 | class UIInterface;
18 | class ConfigSystem;
19 | class ObjectSystem;
20 | class LogModel;
21 |
22 | class QAFCore:public QObject,public Singleton
23 | {
24 |
25 | public:
26 | QAFCore();
27 | ~QAFCore();
28 |
29 | void initialize();
30 |
31 | void addSystem(AbstractSystem*);
32 | void removeSystem(SystemType);
33 | AbstractSystem* getSystem(SystemType type) const;
34 | ConfigSystem* getConfigSystem() const;
35 | ObjectSystem* getObjectSystem(int sysId = ST_OBJECT) const;
36 | PluginSystem* getPluginSystem() const;
37 |
38 | void setUIInterface(UIInterface*);
39 | UIInterface* getUIInterface() const;
40 | LogModel* getLogModel() const;
41 |
42 | int getVersion() const;
43 | QString getVersionStr() const;
44 | bool isSupported(int version) const;
45 |
46 | protected:
47 | void initCore();
48 | void initExtent();
49 | void destory();
50 |
51 | private:
52 | QMap mSystems;
53 | UIInterface* mUIInterface;
54 | LogModel* mLogModel;
55 | bool mIsInit = false;
56 | };
57 | }
58 |
59 | #endif // QAFCORE_H
--------------------------------------------------------------------------------
/src/QAFCore/QAFCore.pri:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | HEADERS += $$PWD/AbstractPlugin.h \
11 | $$PWD/QAFContext.h \
12 | $$PWD/QAFLogger.h \
13 | $$PWD/LogModel.h \
14 | $$PWD/ObjectProxy.h \
15 | $$PWD/ObjectPtr.h \
16 | $$PWD/resource.h \
17 | $$PWD/Serializable.h \
18 | $$PWD/UIInterface.h \
19 | $$PWD/AbstractSystem.h \
20 | $$PWD/QAFGlobal.h \
21 | $$PWD/qafcore_global.h \
22 | $$PWD/ConfigSystem.h \
23 | $$PWD/ConfigModel.h \
24 | $$PWD/ObjectModel.h \
25 | $$PWD/QAFCore.h \
26 | $$PWD/PluginSystem.h \
27 | $$PWD/AbstractObject.h \
28 | $$PWD/ObjectSystem.h
29 |
30 | SOURCES += $$PWD/AbstractObject.cpp \
31 | $$PWD/ConfigModel.cpp \
32 | $$PWD/ConfigSystem.cpp \
33 | $$PWD/QAFContext.cpp \
34 | $$PWD/QAFLogger.cpp \
35 | $$PWD/LogModel.cpp \
36 | $$PWD/ObjectModel.cpp \
37 | $$PWD/ObjectProxy.cpp \
38 | $$PWD/ObjectSystem.cpp \
39 | $$PWD/PluginSystem.cpp \
40 | $$PWD/QAFCore.cpp \
41 | $$PWD/Serializable.cpp
42 |
43 | RESOURCES += QAFCore.qrc
44 |
--------------------------------------------------------------------------------
/src/QAFCore/QAFCore.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | TEMPLATE = lib
6 | TARGET = QAFCore
7 | DESTDIR = $$PWD/../../lib
8 | QT += core xml widgets gui
9 | CONFIG += debug_and_release
10 | DEFINES += QT_DLL QAFCORE_LIB QT_WIDGETS_LIB QT_XML_LIB
11 | INCLUDEPATH += $$PWD \
12 | $$PWD/../QtAwesome \
13 | $$PWD/../Utils \
14 | $$PWD/../QtCommonModel
15 |
16 | LIBS += -L$$PWD/../../lib
17 | DEPENDPATH += $$PWD
18 | CONFIG(debug,debug|release){
19 | TARGET=$$join(TARGET,,,d)
20 | LIBS += -lQtCommonModeld
21 | }
22 |
23 | CONFIG(release,release|debug){
24 | LIBS += -lQtCommonModel
25 | }
26 | include(QAFCore.pri)
27 |
--------------------------------------------------------------------------------
/src/QAFCore/QAFCore.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Resources/folder.png
4 | Resources/gear.png
5 | Resources/xml_attr.png
6 | Resources/xml_text.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/QAFCore/QAFCore.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/QAFCore.rc
--------------------------------------------------------------------------------
/src/QAFCore/QAFGlobal.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/QAFGlobal.h
--------------------------------------------------------------------------------
/src/QAFCore/QAFLogger.h:
--------------------------------------------------------------------------------
1 | #ifndef QAFLOGGER_H
2 | #define QAFLOGGER_H
3 |
4 | #include
5 |
6 | namespace QAF
7 | {
8 | class Logger
9 | {
10 | public:
11 | static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
12 | static void backTrace(int traceNum = 255);
13 | };
14 | }
15 |
16 | #endif //QAFLOGGER_H
17 |
--------------------------------------------------------------------------------
/src/QAFCore/Resources/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/Resources/folder.png
--------------------------------------------------------------------------------
/src/QAFCore/Resources/gear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/Resources/gear.png
--------------------------------------------------------------------------------
/src/QAFCore/Resources/xml_attr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/Resources/xml_attr.png
--------------------------------------------------------------------------------
/src/QAFCore/Resources/xml_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/Resources/xml_text.png
--------------------------------------------------------------------------------
/src/QAFCore/Serializable.cpp:
--------------------------------------------------------------------------------
1 | #include "Serializable.h"
2 | #include
3 |
4 | QDataStream& operator << (QDataStream& stream, const Serializable& srl)
5 | {
6 | srl.pack(stream);
7 | return stream;
8 | }
9 |
10 | QDataStream& operator >> (QDataStream& stream, Serializable& srl)
11 | {
12 | srl.unpack(stream);
13 | return stream;
14 | }
15 |
--------------------------------------------------------------------------------
/src/QAFCore/Serializable.h:
--------------------------------------------------------------------------------
1 | #ifndef SERIALIZABLE_H
2 | #define SERIALIZABLE_H
3 |
4 | #include "qafcore_global.h"
5 |
6 | class QDataStream;
7 |
8 | class Serializable
9 | {
10 | public:
11 | Serializable(){}
12 | virtual ~Serializable(){}
13 |
14 | virtual void pack(QDataStream& stream) const = 0;
15 | virtual void unpack(QDataStream& stream) = 0;
16 | };
17 |
18 | QAFCORE_EXPORT QDataStream& operator<< (QDataStream&, const Serializable&);
19 | QAFCORE_EXPORT QDataStream& operator>> (QDataStream&, Serializable&);
20 |
21 | #endif //SERIALIZABLE_H
22 |
--------------------------------------------------------------------------------
/src/QAFCore/UIInterface.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/UIInterface.h
--------------------------------------------------------------------------------
/src/QAFCore/qafcore_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QAFCORE_GLOBAL_H
2 | #define QAFCORE_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef QAFCORE_LIB
7 | # define QAFCORE_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define QAFCORE_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // QAFCORE_GLOBAL_H
--------------------------------------------------------------------------------
/src/QAFCore/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QAFCore/resource.h
--------------------------------------------------------------------------------
/src/QtAwesome/QtAwesome.pri:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | HEADERS += ./qtawesome_global.h \
11 | ./QtAwesome.h \
12 | ./QtAwesomeAnim.h
13 | SOURCES += ./QtAwesome.cpp \
14 | ./QtAwesomeAnim.cpp
15 | RESOURCES += QtAwesome.qrc
16 |
--------------------------------------------------------------------------------
/src/QtAwesome/QtAwesome.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | TEMPLATE = lib
6 | TARGET = QtAwesome
7 | DESTDIR = $$PWD/../../lib
8 | QT += core widgets gui
9 | CONFIG += debug_and_release
10 | DEFINES += QT_DLL QTAWESONME_LIB
11 | INCLUDEPATH += $$PWD \
12 | $$PWD/../Utils \
13 | $$PWD/debug \
14 | $$PWD/../../include
15 |
16 | #LIBS += -l$(NOINHERIT)
17 | DEPENDPATH += $$PWD
18 | CONFIG(debug,debug|release){
19 | TARGET=$$join(TARGET,,,d)
20 | }
21 |
22 | CONFIG(release,release|debug){
23 |
24 | }
25 | include(QtAwesome.pri)
26 |
--------------------------------------------------------------------------------
/src/QtAwesome/QtAwesome.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | fonts/fontawesome-4.6.1.ttf
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/QtAwesome/QtAwesomeAnim.cpp:
--------------------------------------------------------------------------------
1 | #include "QtAwesomeAnim.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | QtAwesomeAnimation::QtAwesomeAnimation(QWidget *parentWidget, int interval, int step)
10 | : parentWidgetRef_( parentWidget )
11 | , timer_( 0 )
12 | , interval_( interval )
13 | , step_( step )
14 | , angle_( 0.0f )
15 | {
16 |
17 | }
18 |
19 | void QtAwesomeAnimation::setup( QPainter &painter, const QRect &rect)
20 | {
21 | // first time set the timer
22 | if( !timer_ )
23 | {
24 | timer_ = new QTimer();
25 | connect(timer_,SIGNAL(timeout()), this, SLOT(update()) );
26 | timer_->start(interval_);
27 | }
28 | else
29 | {
30 | //timer, angle, self.step = self.info[self.parent_widget]
31 | float x_center = rect.width() * 0.5;
32 | float y_center = rect.height() * 0.5;
33 | painter.translate(x_center, y_center);
34 | painter.rotate(angle_);
35 | painter.translate(-x_center, -y_center);
36 | }
37 | }
38 |
39 |
40 | void QtAwesomeAnimation::update()
41 | {
42 | angle_ += step_;
43 | angle_ = std::fmod( angle_, 360);
44 | parentWidgetRef_->update();
45 | }
46 |
--------------------------------------------------------------------------------
/src/QtAwesome/QtAwesomeAnim.h:
--------------------------------------------------------------------------------
1 | #ifndef QTAWESOMEANIMATION_H
2 | #define QTAWESOMEANIMATION_H
3 |
4 | #include
5 |
6 | #include "qtawesome_global.h"
7 |
8 | class QPainter;
9 | class QRect;
10 | class QTimer;
11 | class QWidget;
12 |
13 | ///
14 | /// Basic Animation Support for QtAwesome (Inspired by https://github.com/spyder-ide/qtawesome)
15 | ///
16 | class QTAWESONME_EXPORT QtAwesomeAnimation : public QObject
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | QtAwesomeAnimation( QWidget* parentWidget, int interval=10, int step=1);
22 |
23 | void setup( QPainter& painter, const QRect& rect );
24 |
25 | public slots:
26 | void update();
27 |
28 | private:
29 | QWidget* parentWidgetRef_;
30 | QTimer* timer_;
31 | int interval_;
32 | int step_;
33 | float angle_;
34 |
35 | };
36 |
37 |
38 | #endif // QTAWESOMEANIMATION_H
39 |
--------------------------------------------------------------------------------
/src/QtAwesome/fonts/fontawesome-4.6.1.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QtAwesome/fonts/fontawesome-4.6.1.ttf
--------------------------------------------------------------------------------
/src/QtAwesome/qtawesome_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QTAWESONME_GLOBAL_H
2 | #define QTAWESONME_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifdef QTAWESONME_LIB
7 | # define QTAWESONME_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define QTAWESONME_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // QTAWESONME_GLOBAL_H
--------------------------------------------------------------------------------
/src/QtCommonModel/ModelItem.cpp:
--------------------------------------------------------------------------------
1 | #include "ModelItem.h"
2 |
3 | ModelItem::ModelItem()
4 | :mParent(Q_NULLPTR)
5 | , mStatus(0)
6 | {
7 |
8 | }
9 |
10 | ModelItem::~ModelItem(void)
11 | {
12 | qDeleteAll(mChildren);
13 | mChildren.clear();
14 | }
15 |
16 | ModelItem* ModelItem::parent()
17 | {
18 | return mParent;
19 | }
20 |
21 | int ModelItem::childCount()
22 | {
23 | return mChildren.size();
24 | }
25 |
26 | void ModelItem::setStatus(int status)
27 | {
28 | mStatus = status;
29 | }
30 |
31 | int ModelItem::status()
32 | {
33 | return mStatus;
34 | }
35 |
36 | int ModelItem::indexOf(ModelItem* child)
37 | {
38 | return mChildren.indexOf(child);
39 | }
40 |
41 | ModelItem* ModelItem::child(int index)
42 | {
43 | if (index >= 0 && index < mChildren.size())
44 | return mChildren.at(index);
45 | else
46 | return nullptr;
47 | }
48 |
49 | QString ModelItem::className()
50 | {
51 | return "ModelItem";
52 | }
53 |
54 | QList ModelItem::actions()
55 | {
56 | return QList();
57 | }
58 |
59 | QVariant ModelItem::data(int index, int role)
60 | {
61 | if (role == Qt::CheckStateRole)
62 | return mStatus;
63 | else
64 | return QVariant();
65 | }
66 |
67 | bool ModelItem::setData(const QVariant &value, int index, int role)
68 | {
69 | if (role == Qt::CheckStateRole)
70 | {
71 | setStatus(value.toInt());
72 | return true;
73 | }
74 | return false;
75 | }
76 |
77 | void ModelItem::addChild(ModelItem* item)
78 | {
79 | if (item){
80 | mChildren.append(item);
81 | item->mParent = this;
82 | }
83 | }
84 |
85 | void ModelItem::insertChild(ModelItem* befor, ModelItem* item)
86 | {
87 | if (befor && item)
88 | {
89 | int beforeIndex = mChildren.indexOf(befor);
90 | if (beforeIndex != -1)
91 | mChildren.insert(beforeIndex, item);
92 | else
93 | mChildren.append(item);
94 |
95 | item->mParent = this;
96 | }
97 | else if (item)
98 | {
99 | mChildren.append(item);
100 |
101 | item->mParent = this;
102 | }
103 | }
104 |
105 | void ModelItem::removeChild(ModelItem* item)
106 | {
107 | if (item){
108 | mChildren.removeOne(item);
109 | item->mParent = nullptr;
110 | }
111 | }
112 |
113 | void ModelItem::clearChildren()
114 | {
115 | qDeleteAll(mChildren);
116 | mChildren.clear();
117 | }
118 |
119 | int ModelItem::itemFlags(int)
120 | {
121 | return Qt::ItemIsEnabled |
122 | Qt::ItemIsSelectable |
123 | Qt::ItemIsEditable |
124 | Qt::ItemIsTristate;
125 | }
126 |
--------------------------------------------------------------------------------
/src/QtCommonModel/ModelItem.h:
--------------------------------------------------------------------------------
1 | #ifndef MODELITEM_H
2 | #define MODELITEM_H
3 |
4 | #include
5 | #include
6 | #include "qtcommonmodel_global.h"
7 |
8 | class QAction;
9 |
10 | class QTCOMMONMODEL_EXPORT ModelItem
11 | {
12 | friend class QtCommonModel;
13 | public:
14 | ModelItem();
15 | virtual ~ModelItem();
16 |
17 | virtual QString className();
18 | virtual QVariant data(int index, int role = Qt::DisplayRole);
19 | virtual bool setData(const QVariant &value, int index, int role = Qt::DisplayRole);
20 | virtual int itemFlags(int index);
21 | virtual QList actions();
22 |
23 | ModelItem* parent();
24 | int childCount();
25 | int indexOf(ModelItem*);
26 | ModelItem* child(int);
27 |
28 | void setStatus(int);
29 | int status();
30 |
31 | protected: //item之间的关系需要通过model来维护
32 | void addChild(ModelItem*);
33 | void insertChild(ModelItem* befor, ModelItem* item);
34 | void removeChild(ModelItem*);
35 | void clearChildren();
36 |
37 | private:
38 | QList mChildren;
39 | ModelItem* mParent;
40 | int mStatus;
41 | };
42 |
43 | #endif //MODELITEM_H
44 |
--------------------------------------------------------------------------------
/src/QtCommonModel/QtCommonModel.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/384782946/qaf/a270f55704d566460fba69e80418e5031ff98c56/src/QtCommonModel/QtCommonModel.h
--------------------------------------------------------------------------------
/src/QtCommonModel/QtCommonModel.pri:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | HEADERS += $$PWD/ModelItem.h \
11 | $$PWD/QtCommonModel.h \
12 | $$PWD/qtcommonmodel_global.h \
13 | $$PWD/QtRowTableModel.h
14 |
15 | SOURCES += $$PWD/ModelItem.cpp \
16 | $$PWD/QtCommonModel.cpp
17 |
--------------------------------------------------------------------------------
/src/QtCommonModel/QtCommonModel.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Add-in.
3 | # ------------------------------------------------------
4 |
5 | TEMPLATE = lib
6 | TARGET = QtCommonModel
7 | DESTDIR = $$PWD/../../lib
8 | QT += core
9 | CONFIG += debug_and_release
10 | DEFINES += QT_DLL QTCOMMONMODEL_LIB
11 | INCLUDEPATH += $$PWD
12 | DEPENDPATH += $$PWD
13 | CONFIG(debug,debug|release){
14 | TARGET=$$join(TARGET,,,d)
15 | }
16 |
17 | CONFIG(release,release|debug){
18 |
19 | }
20 | include(QtCommonModel.pri)
21 |
--------------------------------------------------------------------------------
/src/QtCommonModel/QtCommonModel.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;cxx;c;def
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h
11 |
12 |
13 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
14 | ui
15 |
16 |
17 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}
18 | qrc;*
19 | false
20 |
21 |
22 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
23 | moc;h;cpp
24 | False
25 |
26 |
27 |
28 |
29 | Header Files
30 |
31 |
32 | Header Files
33 |
34 |
35 | Header Files
36 |
37 |
38 | Header Files
39 |
40 |
41 |
42 |
43 | Source Files
44 |
45 |
46 | Source Files
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/QtCommonModel/QtRowTableModel.h:
--------------------------------------------------------------------------------
1 | #ifndef QTROWTABLEMODEL_H
2 | #define QTROWTABLEMODEL_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | template
9 | class QtRowTableModel : public QAbstractTableModel
10 | {
11 | typedef T Element;
12 | typedef QSharedPointer