Skip to content

Commit

Permalink
Reverse string definition conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
Madman10K committed Aug 14, 2023
1 parent 829e189 commit 3c7f68b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion UImGuiString.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
#ifdef UIMGUI_TEXT_UTILS_CUSTOM_STRING
#ifdef UIMGUI_TEXT_UTILS_CUSTOM_STRING_INCLUDE
#include UIMGUI_TEXT_UTILS_CUSTOM_STRING_INCLUDE
Expand Down
20 changes: 10 additions & 10 deletions UImGuiTextUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace UImGui
static void SubSuperscript(const char* subscriptBegin, const char* subscriptEnd,
const char* superscriptBegin, const char* superscriptEnd) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// C++ TString variant of the normal SubSuperscript function
static void SubSuperscript(const TString& subscript, const TString& superscript) noexcept;
#endif
Expand All @@ -118,7 +118,7 @@ namespace UImGui
const char* annotationBegin, const char* annotationEnd,
bool bWrapAnnotation = true, bool bWrapText = false) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// C++ TString version of the normal Ruby function
static void Ruby(const TString& text, const TString& annotation,
bool bWrapAnnotation = true, bool bWrapText = false) noexcept;
Expand Down Expand Up @@ -161,7 +161,7 @@ namespace UImGui
*/
static WidgetState UnderlineWrapped(const char* text, const char* end, ImColor colour = UIMGUI_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// TString wrapper on top of UnderlineWrapped
static WidgetState UnderlineWrapped(const TString& text, ImColor colour = UIMGUI_TEXT_COLOUR) noexcept;
#endif
Expand Down Expand Up @@ -203,7 +203,7 @@ namespace UImGui
*/
static WidgetState StrikethroughWrapped(const char* text, const char* end, ImColor colour = UIMGUI_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// TString wrapper on top of StrikethroughWrapped
static WidgetState StrikethroughWrapped(const TString& text, ImColor colour = UIMGUI_TEXT_COLOUR) noexcept;
#endif
Expand All @@ -228,7 +228,7 @@ namespace UImGui
static void LinkWrapped(const char* text, const char* end, ImColor colour = UIMGUI_LINK_TEXT_UNVISITED,
const std::function<void(const char* link)>& clicked = (*getData())->defaultLinkClickEvent) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// TString wrapper on top of LinkWrapped
static void LinkWrapped(const TString& text, ImColor colour = UIMGUI_LINK_TEXT_UNVISITED,
const std::function<void(const char* link)>& clicked = (*getData())->defaultLinkClickEvent) noexcept;
Expand Down Expand Up @@ -271,7 +271,7 @@ namespace UImGui
*/
static WidgetState HighlightWrapped(const char* text, const char* end, ImColor colour = UIMGUI_HIGHLIGHT_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// TString wrapper on top of HighlightWrapped
static WidgetState HighlightWrapped(const TString& text, ImColor colour = UIMGUI_HIGHLIGHT_TEXT_COLOUR) noexcept;
#endif
Expand Down Expand Up @@ -308,7 +308,7 @@ namespace UImGui
*/
static void BlockquoteWrapped(const char* text, const char* end, ImColor colour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// TString wrapper on top of HighlightWrapped
static void BlockquoteWrapped(const TString& text, ImColor colour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;
#endif
Expand All @@ -323,7 +323,7 @@ namespace UImGui
static void CodeBlock(const char* begin, const char* end, bool bWrapText,
ImColor backgroundColour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// C++ TString abstraction on top of the normal CodeBlock function
static void CodeBlock(const TString& text, bool bWrapText,
ImColor backgroundColour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;
Expand All @@ -338,7 +338,7 @@ namespace UImGui
*/
static void CodeInline(const char* begin, const char* end, ImColor backgroundColour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// C++ TString abstraction on top of the normal CodeInline function
static void CodeInline(const TString& text, ImColor backgroundColour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;
#endif
Expand All @@ -351,7 +351,7 @@ namespace UImGui
*/
static void CodeInlineWrapped(const char* begin, const char* end, ImColor backgroundColour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
// C++ TString abstraction on top of the normal CodeInlineWrapped function
static void CodeInlineWrapped(const TString& text, ImColor backgroundColour = UIMGUI_BLOCKQUOTE_TEXT_COLOUR) noexcept;
#endif
Expand Down
14 changes: 7 additions & 7 deletions UImGuiTextUtilsTextMarkdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void UImGui::TextUtils::LinkWrapped(const char* text, const char* end, ImColor c
ImGui::PopStyleColor();
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
UImGui::TextUtils::WidgetState UImGui::TextUtils::UnderlineWrapped(const TString& text, ImColor colour) noexcept
{
return UnderlineWrapped(text.c_str(), text.c_str() + text.size(), colour);
Expand Down Expand Up @@ -82,7 +82,7 @@ UImGui::TextUtils::WidgetState UImGui::TextUtils::StrikethroughWrapped(const cha
return renderWrappedTextGeneric(text, end, colour, [](ImColor color) -> void { Strikethrough(color); }, [](ImColor) -> void {});
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
UImGui::TextUtils::WidgetState UImGui::TextUtils::StrikethroughWrapped(const TString& text, ImColor colour) noexcept
{
return StrikethroughWrapped(text.c_str(), text.c_str() + text.size(), colour);
Expand All @@ -99,7 +99,7 @@ UImGui::TextUtils::WidgetState UImGui::TextUtils::HighlightWrapped(const char* t
return renderWrappedTextGeneric(text, end, colour, [](ImColor color) -> void { Highlight(color); }, [](ImColor) -> void {});
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
UImGui::TextUtils::WidgetState UImGui::TextUtils::HighlightWrapped(const TString& text, ImColor colour) noexcept
{
return HighlightWrapped(text.c_str(), text.c_str() + text.size(), colour);
Expand Down Expand Up @@ -131,7 +131,7 @@ void UImGui::TextUtils::BlockquoteWrapped(const char* text, const char* end, ImC
});
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
void UImGui::TextUtils::BlockquoteWrapped(const TString& text, ImColor colour) noexcept
{
BlockquoteWrapped(text.c_str(), text.c_str() + text.size(), colour);
Expand Down Expand Up @@ -160,7 +160,7 @@ void UImGui::TextUtils::CodeBlock(const char* begin, const char* end, bool bWrap
ImGui::InvisibleButton("##code", size);
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
void UImGui::TextUtils::CodeBlock(const TString& text, bool bWrapText, ImColor backgroundColour) noexcept
{
CodeBlock(text.c_str(), text.c_str() + text.size(), bWrapText, backgroundColour);
Expand Down Expand Up @@ -191,7 +191,7 @@ void UImGui::TextUtils::CodeInlineWrapped(const char* begin, const char* end, Im
});
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
void UImGui::TextUtils::CodeInlineWrapped(const TString& text, ImColor backgroundColour) noexcept
{
CodeInlineWrapped(text.c_str(), text.c_str() + text.size(), backgroundColour);
Expand All @@ -218,7 +218,7 @@ void UImGui::TextUtils::CodeInline(const char* begin, const char* end, ImColor b
ImGui::InvisibleButton("##code", size);
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
void UImGui::TextUtils::CodeInline(const TString& text, ImColor backgroundColour) noexcept
{
CodeInline(text.c_str(), text.c_str() + text.size(), backgroundColour);
Expand Down
2 changes: 1 addition & 1 deletion UImGuiTextUtilsTypefaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void UImGui::TextUtils::Ruby(const char* textBegin, const char* textEnd, const c
ImGui::EndGroup();
}

#ifdef UIMGUI_TEXT_UTILS_STRING
#ifndef UIMGUI_TEXT_UTILS_DISABLE_STRING
void UImGui::TextUtils::Ruby(const TString& text, const TString& annotation, bool bWrapAnnotation, bool bWrapText) noexcept
{
Ruby(text.c_str(), text.c_str() + text.size(), annotation.c_str(), annotation.c_str() + annotation.size(), bWrapAnnotation, bWrapText);
Expand Down

0 comments on commit 3c7f68b

Please sign in to comment.