From b30674d123968839c4562656959df6f9122d84e2 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Thu, 24 Aug 2023 10:02:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=93=84=20=F0=9F=93=9D=20Docs,=20Chore?= =?UTF-8?q?:=20Use=20portable=20build=20command.=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20.gitignore=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20CMakeLists.txt=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20README.md=20=09=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20build.ps1=20=09=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20build.sh=20=09=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20clean.ps1=20=09=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20clean.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + CMakeLists.txt | 5 +++-- README.md | 43 +++++-------------------------------------- build.ps1 | 12 ------------ build.sh | 5 ----- clean.ps1 | 1 - clean.sh | 1 - 7 files changed, 9 insertions(+), 59 deletions(-) delete mode 100644 build.ps1 delete mode 100755 build.sh delete mode 100644 clean.ps1 delete mode 100755 clean.sh diff --git a/.gitignore b/.gitignore index e235f0f..5c427df 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,7 @@ install_manifest.txt compile_commands.json CTestTestfile.cmake _deps +build ## Ignore items for CLion .idea/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dad2f1..fc7184a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,11 @@ # # Created by Dynesshely on 2023.02.05. # Changed by ChenPi11 on 2023.03.05. -# Changed by Dynesshely on 2023.04.17 +# Changed by Dynesshely on 2023.04.17. +# Changed by ChenPi11 on 2023.08.24. # -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.6) project(CppEnhanced) diff --git a/README.md b/README.md index b0b79a7..034c079 100644 --- a/README.md +++ b/README.md @@ -7,51 +7,18 @@ In future, you will be able to import CppEnhanced from vcpkg and other package m # Build -## Get source codes +## Dependencies -```shell -git clone git@github.com:Dynesshely/CppEnhanced.git -``` - -## On Linux, Unix, Cygwin, MacOS or other unix-like OS - -Prepare CMake, C++ compiler and other tool chain first. - -```shell -# Way 1 (Recommended) -./build.sh - -# Way 2 (Manually) -mkdir build -cd build -cmake .. -make -cd .. -``` - -## On Windows (build with MSVC) ++ CMake. ( Version > 3.6 ) ++ C/C++ build toolchains. -Make sure CMake and MSVC environment installed. +## Command ```shell -# You need execute commands in `Developer PowerShell for VS` -# So that path of `MSBuild.exe` can be located -# You can also query path of `MSBuild.exe` by following command - -# Way 1 (Recommended) -./build.ps1 - -# Way 2 (Manually) mkdir build cd build cmake .. -msbuild ./ALL_BUILD.vcxproj -cd .. -``` - -You can also query path of `MSBuild.exe` by following command: -```cmd -reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath +cmake --build . --config=Release ``` # Components diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 752fe22..0000000 --- a/build.ps1 +++ /dev/null @@ -1,12 +0,0 @@ - -# $query = (reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath) -# $match = $query -match 'C:\\\S*' -# $path = $match -replace 'MSBuildToolsPath','' -replace 'REG_SZ','' -replace ' ','' - -mkdir build -cd build -cmake .. -# & "${path}MSBuild.exe" ./ALL_BUILD.vcxproj -msbuild ./ALL_BUILD.vcxproj -cd .. - diff --git a/build.sh b/build.sh deleted file mode 100755 index 596357f..0000000 --- a/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -mkdir build -cd build -cmake .. -make -cd .. diff --git a/clean.ps1 b/clean.ps1 deleted file mode 100644 index 37ca268..0000000 --- a/clean.ps1 +++ /dev/null @@ -1 +0,0 @@ -rm build -Force \ No newline at end of file diff --git a/clean.sh b/clean.sh deleted file mode 100755 index 07cbd15..0000000 --- a/clean.sh +++ /dev/null @@ -1 +0,0 @@ -rm -r build From 5521f11046ccce33947d3b01ca13634752435c11 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Thu, 24 Aug 2023 10:07:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=8E=87=20Style(ChangeLog):=20Remove?= =?UTF-8?q?=20changelog=20in=20source=20code=20before=20its=20get=20too=20?= =?UTF-8?q?long.=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20CMakeLists?= =?UTF-8?q?.txt=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20include/dat?= =?UTF-8?q?etime.hpp=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20source?= =?UTF-8?q?/datetime.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 9 +-------- include/datetime.hpp | 8 +------- source/datetime.cpp | 8 +------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc7184a..48bb46f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,4 @@ -# -# Created by Dynesshely on 2023.02.05. -# Changed by ChenPi11 on 2023.03.05. -# Changed by Dynesshely on 2023.04.17. -# Changed by ChenPi11 on 2023.08.24. -# - -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.6) project(CppEnhanced) diff --git a/include/datetime.hpp b/include/datetime.hpp index e5a566d..3dd4230 100644 --- a/include/datetime.hpp +++ b/include/datetime.hpp @@ -1,10 +1,4 @@ -// -// Created by Dynesshely on 2023.02.05 -// Changed by ChenPi11 on 2023.03.05 -// Changed by Dynesshely on 2023.04.17 -// - -#ifndef CPPENHANCED_DATETIME_H +#ifndef CPPENHANCED_DATETIME_H #define CPPENHANCED_DATETIME_H #include diff --git a/source/datetime.cpp b/source/datetime.cpp index 28c8a78..5abd8e2 100644 --- a/source/datetime.cpp +++ b/source/datetime.cpp @@ -1,10 +1,4 @@ -// -// Created by Dynesshely on 2023.02.05 -// Changed by ChenPi11 on 2023.03.05 -// Changed by Dynesshely on 2023.04.17 -// - -#include +#include namespace CppEnhanced { From 307ab61a6e5dda78247623f40f00fde5e7eefde8 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Thu, 24 Aug 2023 10:15:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=93=A6=20=F0=9F=93=9D=20Struct,=20Cho?= =?UTF-8?q?re:=20Remove=20unused=20`stdc++.h`.=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20CMakeLists.txt=20=09=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20public/stdc++.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 - public/stdc++.h | 117 ------------------------------------------------ 2 files changed, 118 deletions(-) delete mode 100644 public/stdc++.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 48bb46f..03b0b50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,6 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp") include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_SOURCE_DIR}/public ) add_library(CppEnhanced SHARED ${SOURCE_FILES}) diff --git a/public/stdc++.h b/public/stdc++.h deleted file mode 100644 index 033a3b0..0000000 --- a/public/stdc++.h +++ /dev/null @@ -1,117 +0,0 @@ -// C++ includes used for precompiling -*- C++ -*- - -// Copyright (C) 2003-2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file stdc++.h - * This is an implementation file for a precompiled header. - */ - - // 17.4.1.2 Headers - - // C -#ifndef _GLIBCXX_NO_ASSERT -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __cplusplus >= 201103L -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - -// C++ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __cplusplus >= 201103L -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif \ No newline at end of file From f33b0f4a2530cc7105b6696afdf6b61b5bee9c31 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Thu, 24 Aug 2023 10:23:23 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=8E=87=20Style:=20Remove=20BOM=20beca?= =?UTF-8?q?use=20some=20compilers=20may=20not=20support=20it.=20=09?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20.gitignore=20=09?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20CMakeLists.txt=20=09?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20include/cppfecs.hpp?= =?UTF-8?q?=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20include/datetim?= =?UTF-8?q?e.hpp=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20source/dat?= =?UTF-8?q?etime.cpp=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20tests/?= =?UTF-8?q?CMakeLists.txt=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20t?= =?UTF-8?q?ests/test=5Fdatetime.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- CMakeLists.txt | 2 +- include/cppfecs.hpp | 2 +- include/datetime.hpp | 2 +- source/datetime.cpp | 2 +- tests/CMakeLists.txt | 2 +- tests/test_datetime.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 5c427df..f73d91d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ - + ## Ignore custom items out/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 03b0b50..d39deea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.6) project(CppEnhanced) diff --git a/include/cppfecs.hpp b/include/cppfecs.hpp index df8bd47..23dd967 100644 --- a/include/cppfecs.hpp +++ b/include/cppfecs.hpp @@ -1,4 +1,4 @@ -#ifndef _INC_STDCPP_FECS_HPP_ +#ifndef _INC_STDCPP_FECS_HPP_ #define _INC_STDCPP_FECS_HPP_ #include "libplatform.h" diff --git a/include/datetime.hpp b/include/datetime.hpp index 3dd4230..882f2eb 100644 --- a/include/datetime.hpp +++ b/include/datetime.hpp @@ -1,4 +1,4 @@ -#ifndef CPPENHANCED_DATETIME_H +#ifndef CPPENHANCED_DATETIME_H #define CPPENHANCED_DATETIME_H #include diff --git a/source/datetime.cpp b/source/datetime.cpp index 5abd8e2..2afa2eb 100644 --- a/source/datetime.cpp +++ b/source/datetime.cpp @@ -1,4 +1,4 @@ -#include +#include namespace CppEnhanced { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1693f25..fd16eaa 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ - + set(TEST_SOURCES test_datetime.cpp ) diff --git a/tests/test_datetime.cpp b/tests/test_datetime.cpp index 3ce986c..94132b7 100644 --- a/tests/test_datetime.cpp +++ b/tests/test_datetime.cpp @@ -1,4 +1,4 @@ - + #include #include From c4aaaeb8fa8c4494578a5f43cd78fbafa5facc96 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Thu, 24 Aug 2023 17:04:38 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=8E=87=20Style:=20Use=20const=20refer?= =?UTF-8?q?ence=20for=20C++=20class.=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20?= =?UTF-8?q?=20=20=20=20include/datetime.hpp=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20source/datetime.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/datetime.hpp | 4 ++-- source/datetime.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/datetime.hpp b/include/datetime.hpp index 882f2eb..bece104 100644 --- a/include/datetime.hpp +++ b/include/datetime.hpp @@ -162,9 +162,9 @@ namespace CppEnhanced { std::string ToString(int type, char d = '.', char t = ':') const; - std::string ToString(std::string format) const; + std::string ToString(const std::string& format) const; - std::wstring ToString(std::wstring format) const; + std::wstring ToString(const std::wstring& format) const; bool Validate() noexcept; diff --git a/source/datetime.cpp b/source/datetime.cpp index 2afa2eb..f913ba4 100644 --- a/source/datetime.cpp +++ b/source/datetime.cpp @@ -123,14 +123,14 @@ namespace CppEnhanced { return _pub_osstream.str(); } - std::string DateTime::ToString(std::string format) const { + std::string DateTime::ToString(const std::string& format) const { // Todo: to string return std::string(""); } - std::wstring DateTime::ToString(std::wstring format) const { + std::wstring DateTime::ToString(const std::wstring& format) const { // Todo: to wstring