123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #include "spdlog/spdlog.h"
- #include "SPAServer.h"
- #include "LHLogInit.h"
- #include "LHQLogAPI.h"
- #include "ThreadPool.h"
- #include "GlobalConfig.h"
- #include <QCoreApplication>
- void test1();
- int main(int argc, char* argv[])
- {
- QCoreApplication app(argc, argv);
- /* 初始化日志库 */
- initLog("SecurePlayAuxServer", g_apiLhQLog);
- auto logger = spdlog::get("main");
- if(logger == nullptr)
- {
- fmt::print("main logger is nullptr");
- return -1;
- }
- SPDLOG_LOGGER_INFO(logger, "★ ★ ★ ★ ★ ★ ☆ ☆ SecurePlayAuxServer ☆ ☆ ★ ★ ★ ★ ★ ★");
- /* 设置线程池最大线程个数 */
- CPPTP.setThreadMaxNum(256);
- /* 初始化服务配置 */
- GConfig.initService();
- SPAServer server;
- server.startServer();
- return app.exec();
- // test1();
- }
- struct Test
- {
- Test() {
- SPDLOG_INFO("构造函数, t:{}", t);
- }
- Test(const Test& o) {
- t = o.t;
- SPDLOG_INFO("拷贝构造函数, t:{}", t);
- }
- Test& operator=(const Test& o) {
- t = o.t;
- SPDLOG_INFO("赋值构造函数, t:{}", t);
- return *this;
- }
- ~Test() {
- SPDLOG_INFO("析构函数");
- }
- int t = 0;
- };
- Test& test2();
- Test test3();
- std::list<Test> listTest;
- void test1()
- {
- Test t;
- listTest.push_back(t);
- SPDLOG_INFO("--------------------------");
- SPDLOG_INFO("t:{}", t.t);
- auto it = listTest.front();
- it.t = 1;
- auto it1 = listTest.front();
- SPDLOG_INFO("it:{}", it1.t);
- SPDLOG_INFO("--------------------------");
- auto& it2 = listTest.front();
- it2.t = 2;
- SPDLOG_INFO("it2:{}", listTest.front().t);
- SPDLOG_INFO("--------------------------");
- auto& it3 = test2();
- SPDLOG_INFO("it3:{}", it3.t);
- SPDLOG_INFO("--------------------------");
- auto it4 = test3();
- SPDLOG_INFO("it4:{}", it4.t);
- }
- Test& test2()
- {
- Test t;
- t.t = 10;
- listTest.push_front(t);
- return listTest.front();
- }
- Test test3()
- {
- Test t;
- t.t = 10;
- listTest.push_front(t);
- return listTest.front();
- }
|