commit 13132f52124e06f57f2f0c447c2a76b8a9507f1b Author: taynpg Date: Thu Nov 14 16:04:54 2024 +0800 init:最初基本架子。 diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..36e4997 --- /dev/null +++ b/.clang-format @@ -0,0 +1,17 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +PointerAlignment: Left +AccessModifierOffset: -4 +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true + AfterClass: true +Cpp11BracedListStyle: true +ReflowComments: true +SpacesBeforeTrailingComments: 3 +TabWidth: 4 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ColumnLimit: 130 +AllowShortBlocksOnASingleLine: Never +AllowShortFunctionsOnASingleLine: None +AllowShortEnumsOnASingleLine: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b861d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +.vs +.cache +cmake-* \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6ce4f97 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,35 @@ +{ + "files.autoSave": "onFocusChange", + "editor.fontSize": 14, + "editor.fontFamily": "'ComicShannsMono Nerd Font', 'ComicShannsMono Nerd Font', 'ComicShannsMono Nerd Font'", + "cmake.configureOnOpen": true, + "cmake.debugConfig": { + "console": "integratedTerminal", + "setupCommands": [ + { + "description": "-gdb-set charset utf-8", + "text": "-gdb-set charset UTF-8" + }, + { + "description": "Enable gdb pretty-printing", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "args": [ + ] + }, + // "cmake.configureSettings": { + // "CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + // }, + "cmake.options.statusBarVisibility": "visible", + "cmake.generator": "Ninja", + "C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json", + "C_Cpp.default.cppStandard": "c++17", + "editor.inlayHints.enabled": "off", + "editor.unicodeHighlight.allowedLocales": { + "ja": true, + "zh-hant": true, + "zh-hans": true + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4eeb1f8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.16) + +project(ofen LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (MSVC) + add_compile_options(/source-charset:utf-8) +endif() + +message(STATUS "System: ${CMAKE_SYSTEM_NAME}") +message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}") + +set(SRC_FILES + include/of_path.h src/of_path.cpp + include/of_str.h src/of_str.cpp +) + +include_directories(include) +add_library(Ofen STATIC ${SRC_FILES}) +target_include_directories(Ofen PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cc5c843 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# 常用功能简易封装 + +## 路径处理 + +`of_path.h` + +## 字符串处理 + +`of_str.h` \ No newline at end of file diff --git a/include/of_path.h b/include/of_path.h new file mode 100644 index 0000000..cf5196e --- /dev/null +++ b/include/of_path.h @@ -0,0 +1,17 @@ +#ifndef OFEN_PATH_HEADER +#define OFEN_PATH_HEADER + +#include + +namespace ofen { +class COfPath +{ +public: + COfPath(); + ~COfPath(); + +public: + static bool is_same_path(const std::string& pa, const std::string& pb); +}; +}; // namespace ofen +#endif \ No newline at end of file diff --git a/include/of_str.h b/include/of_str.h new file mode 100644 index 0000000..3d82864 --- /dev/null +++ b/include/of_str.h @@ -0,0 +1,16 @@ +#ifndef OFEN_STRING_HEADER +#define OFEN_STRING_HEADER + +#include + +namespace ofen { +class COfStr +{ +public: + COfStr(); + ~COfStr(); +}; +}; // namespace ofen + + +#endif \ No newline at end of file diff --git a/src/of_path.cpp b/src/of_path.cpp new file mode 100644 index 0000000..0577ad1 --- /dev/null +++ b/src/of_path.cpp @@ -0,0 +1,18 @@ +#include "of_path.h" +#include + +namespace fs = std::filesystem; +namespace ofen { +COfPath::COfPath() +{ +} + +COfPath::~COfPath() +{ +} + +bool COfPath::is_same_path(const std::string& pa, const std::string& pb) +{ + return false; +} +} // namespace ofen diff --git a/src/of_str.cpp b/src/of_str.cpp new file mode 100644 index 0000000..c127240 --- /dev/null +++ b/src/of_str.cpp @@ -0,0 +1,10 @@ +#include "of_str.h" + +namespace ofen { +COfStr::COfStr() +{ +} +COfStr::~COfStr() +{ +} +} // namespace ofen diff --git a/test/main.cpp b/test/main.cpp new file mode 100644 index 0000000..157fa26 --- /dev/null +++ b/test/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::cout << "Done" << std::endl; + return 0; +} \ No newline at end of file