init:最初基本架子。

This commit is contained in:
taynpg 2024-11-14 16:04:54 +08:00
commit 13132f5212
10 changed files with 154 additions and 0 deletions

17
.clang-format Normal file
View File

@ -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

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
build
.vs
.cache
cmake-*

35
.vscode/settings.json vendored Normal file
View File

@ -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
}
}

21
CMakeLists.txt Normal file
View File

@ -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)

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# 常用功能简易封装
## 路径处理
`of_path.h`
## 字符串处理
`of_str.h`

17
include/of_path.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef OFEN_PATH_HEADER
#define OFEN_PATH_HEADER
#include <string>
namespace ofen {
class COfPath
{
public:
COfPath();
~COfPath();
public:
static bool is_same_path(const std::string& pa, const std::string& pb);
};
}; // namespace ofen
#endif

16
include/of_str.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef OFEN_STRING_HEADER
#define OFEN_STRING_HEADER
#include <string>
namespace ofen {
class COfStr
{
public:
COfStr();
~COfStr();
};
}; // namespace ofen
#endif

18
src/of_path.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "of_path.h"
#include <filesystem>
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

10
src/of_str.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "of_str.h"
namespace ofen {
COfStr::COfStr()
{
}
COfStr::~COfStr()
{
}
} // namespace ofen

7
test/main.cpp Normal file
View File

@ -0,0 +1,7 @@
#include <iostream>
int main()
{
std::cout << "Done" << std::endl;
return 0;
}