From c7d785663404eee75fa39e297edbb01b4236a18d Mon Sep 17 00:00:00 2001 From: wonkyhonky2024 Date: Fri, 9 May 2025 16:02:07 +0100 Subject: [PATCH] more nonsense --- .clang-format | 25 +++++++++++++++++++ .clang-tidy | 13 ++++++++++ Source/MyProject/MyProject.cpp | 2 +- Source/MyProject/Private/MagicFloatInput.cpp | 23 ++++++++--------- Source/MyProject/Private/ModeInputTextBox.cpp | 14 +++++------ Source/MyProject/Private/MyPlayerState.cpp | 1 - Source/MyProject/Private/MyUserWidget.cpp | 12 ++++----- Source/MyProject/Private/TheracAdapter.cpp | 9 ++----- Source/MyProject/Public/MagicFloatInput.h | 22 ++++++++-------- Source/MyProject/Public/ModeInputTextBox.h | 13 +++++----- Source/MyProject/Public/MyUserWidget.h | 20 +++++++-------- 11 files changed, 90 insertions(+), 64 deletions(-) create mode 100644 .clang-format create mode 100644 .clang-tidy diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..7475ac3 --- /dev/null +++ b/.clang-format @@ -0,0 +1,25 @@ +--- +BasedOnStyle: LLVM +AlignAfterOpenBracket: BlockIndent +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: true + AcrossComments: true + AlignCompound: true + PadOperators: false +AlignEscapedNewlines: Left +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Always +AllowShortEnumsOnASingleLine: false +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: NonAssignment +BreakConstructorInitializers: BeforeComma +InsertNewlineAtEOF: true +KeepEmptyLinesAtEOF: true +KeepEmptyLinesAtTheStartOfBlocks: false +PackConstructorInitializers: Never +PointerAlignment: Middle +QualifierAlignment: Right +ShortNamespaceLines: 0 diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..fbb750d --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,13 @@ +--- +Checks: "* +,-llvmlibc* +,-*readability-braces-around-statements +,-hicpp-braces-around-statements +,-readability-identifier-length +,-fuchsia-default-arguments* +,-*-non-private-member-variables-in-classes +,-fuchsia-trailing-return +,-altera-unroll-loops" +WarningsAsErrors: '' +HeaderFilterRegex: '' +FormatStyle: file diff --git a/Source/MyProject/MyProject.cpp b/Source/MyProject/MyProject.cpp index 4c88a73..62a0040 100644 --- a/Source/MyProject/MyProject.cpp +++ b/Source/MyProject/MyProject.cpp @@ -3,4 +3,4 @@ #include "MyProject.h" #include "Modules/ModuleManager.h" -IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, MyProject, "MyProject" ); +IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, MyProject, "MyProject"); diff --git a/Source/MyProject/Private/MagicFloatInput.cpp b/Source/MyProject/Private/MagicFloatInput.cpp index 0b21fed..37bbc44 100644 --- a/Source/MyProject/Private/MagicFloatInput.cpp +++ b/Source/MyProject/Private/MagicFloatInput.cpp @@ -1,18 +1,17 @@ // Fill out your copyright notice in the Description page of Project Settings. - #include "MagicFloatInput.h" -void UMagicFloatInput::HandleOnTextCommitted(const FText& inText, ETextCommit::Type inCommitMethod) { - if(inText.IsEmptyOrWhitespace()) { - if(sourceInput != nullptr) { - SetText(sourceInput->GetText()); +void UMagicFloatInput::HandleOnTextCommitted( + FText const & inText, + ETextCommit::Type inCommitMethod +) { + if (inText.IsEmptyOrWhitespace()) { + if (sourceInput != nullptr) { + SetText(sourceInput->GetText()); + } else { + auto x = FCString::Atof(*inText.ToString()); + SetText(FText::FromString(FString::Printf(TEXT("%.7f"), x))); } - } - else { - auto x = FCString::Atof(*inText.ToString()); - SetText(FText::FromString(FString::Printf(TEXT("%.7f"),x))); - - } - + } } \ No newline at end of file diff --git a/Source/MyProject/Private/ModeInputTextBox.cpp b/Source/MyProject/Private/ModeInputTextBox.cpp index 6566108..134f6fe 100644 --- a/Source/MyProject/Private/ModeInputTextBox.cpp +++ b/Source/MyProject/Private/ModeInputTextBox.cpp @@ -1,12 +1,10 @@ // Fill out your copyright notice in the Description page of Project Settings. - #include "ModeInputTextBox.h" -void UModeInputTextBox::HandleOnTextChanged(const FText& inText) { - - auto & s = inText.ToString(); - auto lastChar = s.LeftChop(1); - lastChar.ToUpperInline(); - SetText(FText::FromString(lastChar)); -} \ No newline at end of file +void UModeInputTextBox::HandleOnTextChanged(FText const & inText) { + auto & s = inText.ToString(); + auto lastChar = s.LeftChop(1); + lastChar.ToUpperInline(); + SetText(FText::FromString(lastChar)); +} diff --git a/Source/MyProject/Private/MyPlayerState.cpp b/Source/MyProject/Private/MyPlayerState.cpp index 00bda13..9f024b2 100644 --- a/Source/MyProject/Private/MyPlayerState.cpp +++ b/Source/MyProject/Private/MyPlayerState.cpp @@ -1,5 +1,4 @@ // Fill out your copyright notice in the Description page of Project Settings. - #include "MyPlayerState.h" diff --git a/Source/MyProject/Private/MyUserWidget.cpp b/Source/MyProject/Private/MyUserWidget.cpp index a6ae046..8bf394d 100644 --- a/Source/MyProject/Private/MyUserWidget.cpp +++ b/Source/MyProject/Private/MyUserWidget.cpp @@ -1,13 +1,11 @@ // Fill out your copyright notice in the Description page of Project Settings. - #include "MyUserWidget.h" #include void UMyUserWidget::NativeOnInitialized() { - auto ps = StaticCast(GetOwningPlayerState()); - if (ps == nullptr) - return; - opIdTextBlock->SetText(FText::FromString(ps->GetPlayerName())); - -} \ No newline at end of file + auto ps = StaticCast(GetOwningPlayerState()); + if (ps == nullptr) + return; + opIdTextBlock->SetText(FText::FromString(ps->GetPlayerName())); +} diff --git a/Source/MyProject/Private/TheracAdapter.cpp b/Source/MyProject/Private/TheracAdapter.cpp index 27c237b..e69e668 100644 --- a/Source/MyProject/Private/TheracAdapter.cpp +++ b/Source/MyProject/Private/TheracAdapter.cpp @@ -1,12 +1,7 @@ // Fill out your copyright notice in the Description page of Project Settings. - #include "TheracAdapter.h" -TheracAdapter::TheracAdapter() -{ -} +TheracAdapter::TheracAdapter() {} -TheracAdapter::~TheracAdapter() -{ -} +TheracAdapter::~TheracAdapter() {} diff --git a/Source/MyProject/Public/MagicFloatInput.h b/Source/MyProject/Public/MagicFloatInput.h index e01090d..d22e05f 100644 --- a/Source/MyProject/Public/MagicFloatInput.h +++ b/Source/MyProject/Public/MagicFloatInput.h @@ -2,20 +2,22 @@ #pragma once -#include "CoreMinimal.h" #include "Components/EditableTextBox.h" +#include "CoreMinimal.h" #include "MagicFloatInput.generated.h" /** - * + * */ UCLASS() -class MYPROJECT_API UMagicFloatInput : public UEditableTextBox -{ - GENERATED_BODY() - - void HandleOnTextCommitted(const FText& Text, ETextCommit::Type CommitMethod) override; - - UPROPERTY(EditAnywhere) - UEditableTextBox * sourceInput; +class MYPROJECT_API UMagicFloatInput : public UEditableTextBox { + GENERATED_BODY() + + void HandleOnTextCommitted( + FText const & Text, + ETextCommit::Type CommitMethod + ) override; + + UPROPERTY(EditAnywhere) + UEditableTextBox * sourceInput; }; diff --git a/Source/MyProject/Public/ModeInputTextBox.h b/Source/MyProject/Public/ModeInputTextBox.h index 458e75e..2a05e22 100644 --- a/Source/MyProject/Public/ModeInputTextBox.h +++ b/Source/MyProject/Public/ModeInputTextBox.h @@ -2,17 +2,16 @@ #pragma once -#include "CoreMinimal.h" #include "Components/EditableTextBox.h" +#include "CoreMinimal.h" #include "ModeInputTextBox.generated.h" /** - * + * */ UCLASS() -class MYPROJECT_API UModeInputTextBox : public UEditableTextBox -{ - GENERATED_BODY() - - void HandleOnTextChanged(const FText& inText) override; +class MYPROJECT_API UModeInputTextBox : public UEditableTextBox { + GENERATED_BODY() + + void HandleOnTextChanged(FText const & inText) override; }; diff --git a/Source/MyProject/Public/MyUserWidget.h b/Source/MyProject/Public/MyUserWidget.h index aa5d37f..1f49da0 100644 --- a/Source/MyProject/Public/MyUserWidget.h +++ b/Source/MyProject/Public/MyUserWidget.h @@ -2,22 +2,20 @@ #pragma once -#include "CoreMinimal.h" #include "Blueprint/UserWidget.h" -#include +#include "CoreMinimal.h" #include "MyUserWidget.generated.h" - +#include /** - * + * */ UCLASS() -class MYPROJECT_API UMyUserWidget : public UUserWidget -{ - GENERATED_BODY() +class MYPROJECT_API UMyUserWidget : public UUserWidget { + GENERATED_BODY() - UPROPERTY(meta=(BindWidget)) - UTextBlock * opIdTextBlock; - - void NativeOnInitialized() override; + UPROPERTY(meta = (BindWidget)) + UTextBlock * opIdTextBlock; + + void NativeOnInitialized() override; };