From e397e0162fcf1ecc680211b0b8263ba537266b85 Mon Sep 17 00:00:00 2001
From: CppCXY <812125110@qq.com>
Date: Tue, 13 Aug 2024 20:21:36 +0800
Subject: [PATCH] install for CodeFormatCSharpLib

---
 CodeFormatCSharpLib/CMakeLists.txt     |  6 ++++++
 CodeFormatCSharpLib/src/CodeFormat.cpp | 23 +++++++++++------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/CodeFormatCSharpLib/CMakeLists.txt b/CodeFormatCSharpLib/CMakeLists.txt
index a621296..3c19d1f 100644
--- a/CodeFormatCSharpLib/CMakeLists.txt
+++ b/CodeFormatCSharpLib/CMakeLists.txt
@@ -15,3 +15,9 @@ target_sources(CodeFormatCSharpLib
 )
 
 target_link_libraries(CodeFormatCSharpLib PUBLIC CodeFormatCore)
+
+install(TARGETS CodeFormatCSharpLib
+		RUNTIME DESTINATION bin
+		LIBRARY DESTINATION lib
+		ARCHIVE DESTINATION lib
+)
\ No newline at end of file
diff --git a/CodeFormatCSharpLib/src/CodeFormat.cpp b/CodeFormatCSharpLib/src/CodeFormat.cpp
index fdb1795..b8568cf 100644
--- a/CodeFormatCSharpLib/src/CodeFormat.cpp
+++ b/CodeFormatCSharpLib/src/CodeFormat.cpp
@@ -57,7 +57,7 @@ void CodeFormat::SupportNonStandardSymbol() {
     _supportNonStandardSymbol = true;
 }
 
-Result<char*> CodeFormat::Reformat(const std::string &uri, std::string &&text) {
+Result<char *> CodeFormat::Reformat(const std::string &uri, std::string &&text) {
     auto file = std::make_shared<LuaSource>(std::move(text));
     LuaLexer luaLexer(file);
     if (_supportNonStandardSymbol) {
@@ -85,14 +85,14 @@ Result<char*> CodeFormat::Reformat(const std::string &uri, std::string &&text) {
 
     auto result = f.GetFormatResult(t);
     // 由于可能存在sso string,所以需要拷贝一份
-    char* ptr = new char[result.size() + 1];
+    char *ptr = new char[result.size() + 1];
     std::copy(result.begin(), result.end(), ptr);
-    ptr[result.size()] = '\0'; // [result.size()] = '\0'
+    ptr[result.size()] = '\0';// [result.size()] = '\0'
     return ptr;
 }
 
 Result<RangeFormatResult> CodeFormat::RangeFormat(const std::string &uri, FormatRange &range,
-                                            std::string &&text) {
+                                                  std::string &&text) {
     auto file = std::make_shared<LuaSource>(std::move(text));
     LuaLexer luaLexer(file);
     if (_supportNonStandardSymbol) {
@@ -121,16 +121,15 @@ Result<RangeFormatResult> CodeFormat::RangeFormat(const std::string &uri, Format
     auto formattedText = f.GetFormatResult(t);
     range = f.GetReplaceRange();
 
-    char* ptr = new char[formattedText.size() + 1];
+    char *ptr = new char[formattedText.size() + 1];
     std::copy(formattedText.begin(), formattedText.end(), ptr);
-    ptr[formattedText.size()] = '\0'; // [formattedText.size()] = '\0'
+    ptr[formattedText.size()] = '\0';// [formattedText.size()] = '\0'
     return RangeFormatResult{
-        static_cast<int>(range.StartLine),
-        static_cast<int>(range.StartCol),
-        static_cast<int>(range.EndLine),
-        static_cast<int>(range.EndCol),
-        ptr
-    };
+            static_cast<int>(range.StartLine),
+            static_cast<int>(range.StartCol),
+            static_cast<int>(range.EndLine),
+            static_cast<int>(range.EndCol),
+            ptr};
 }
 
 Result<std::vector<LuaTypeFormat::Result>>