diff --git a/src/flabel.cpp b/src/flabel.cpp index 5bb41d4b..6781c06a 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -67,13 +67,6 @@ FLabel& FLabel::operator = (const FString& s) return *this; } -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const FString& s) -{ - setText(text + s); - return *this; -} - //---------------------------------------------------------------------- FLabel& FLabel::operator << (fc::SpecialCharacter c) { @@ -88,87 +81,6 @@ FLabel& FLabel::operator << (const wchar_t c) return *this; } -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const uInt16 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const sInt16 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const uInt32 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const sInt32 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const uInt64 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const sInt64 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const float num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const double num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLabel& FLabel::operator << (const lDouble num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - //---------------------------------------------------------------------- const FLabel& FLabel::operator >> (FString& s) { diff --git a/src/flineedit.cpp b/src/flineedit.cpp index 7c4e9cf6..ca801734 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -72,13 +72,6 @@ FLineEdit& FLineEdit::operator = (const FString& s) return *this; } -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const FString& s) -{ - setText(text + s); - return *this; -} - //---------------------------------------------------------------------- FLineEdit& FLineEdit::operator << (fc::SpecialCharacter c) { @@ -93,87 +86,6 @@ FLineEdit& FLineEdit::operator << (const wchar_t c) return *this; } -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const uInt16 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const sInt16 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const uInt32 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const sInt32 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const uInt64 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const sInt64 num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const float num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const double num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - -//---------------------------------------------------------------------- -FLineEdit& FLineEdit::operator << (const lDouble num) -{ - FString num_str; - num_str << num; - setText(text + num_str); - return *this; -} - //---------------------------------------------------------------------- const FLineEdit& FLineEdit::operator >> (FString& s) { diff --git a/src/include/final/flabel.h b/src/include/final/flabel.h index d70db168..82e806e8 100644 --- a/src/include/final/flabel.h +++ b/src/include/final/flabel.h @@ -85,18 +85,10 @@ class FLabel : public FWidget // Overloaded operators FLabel& operator = (const FString&); - FLabel& operator << (const FString&); + template + FLabel& operator << (const typeT&); FLabel& operator << (fc::SpecialCharacter); FLabel& operator << (const wchar_t); - FLabel& operator << (const uInt16); - FLabel& operator << (const sInt16); - FLabel& operator << (const uInt32); - FLabel& operator << (const sInt32); - FLabel& operator << (const uInt64); - FLabel& operator << (const sInt64); - FLabel& operator << (const float); - FLabel& operator << (const double); - FLabel& operator << (const lDouble); const FLabel& operator >> (FString&); // Accessors @@ -166,6 +158,16 @@ class FLabel : public FWidget }; // FLabel inline functions +//---------------------------------------------------------------------- +template +inline FLabel& FLabel::operator << (const typeT& s) +{ + FString str{}; + str << s; + setText(text + str); + return *this; +} + //---------------------------------------------------------------------- inline const FString FLabel::getClassName() const { return "FLabel"; } diff --git a/src/include/final/flineedit.h b/src/include/final/flineedit.h index b14ee013..6afa4427 100644 --- a/src/include/final/flineedit.h +++ b/src/include/final/flineedit.h @@ -101,18 +101,10 @@ class FLineEdit : public FWidget // Overloaded operators FLineEdit& operator = (const FString&); - FLineEdit& operator << (const FString&); + template + FLineEdit& operator << (const typeT&); FLineEdit& operator << (fc::SpecialCharacter); FLineEdit& operator << (const wchar_t); - FLineEdit& operator << (const uInt16); - FLineEdit& operator << (const sInt16); - FLineEdit& operator << (const uInt32); - FLineEdit& operator << (const sInt32); - FLineEdit& operator << (const uInt64); - FLineEdit& operator << (const sInt64); - FLineEdit& operator << (const float); - FLineEdit& operator << (const double); - FLineEdit& operator << (const lDouble); const FLineEdit& operator >> (FString&); // Accessors @@ -235,6 +227,16 @@ class FLineEdit : public FWidget // FLineEdit inline functions +//---------------------------------------------------------------------- +template +inline FLineEdit& FLineEdit::operator << (const typeT& s) +{ + FString str{}; + str << s; + setText(text + str); + return *this; +} + //---------------------------------------------------------------------- inline const FString FLineEdit::getClassName() const { return "FLineEdit"; } diff --git a/src/include/final/ftypes.h b/src/include/final/ftypes.h index 2f17b5de..0bd41da5 100644 --- a/src/include/final/ftypes.h +++ b/src/include/final/ftypes.h @@ -44,17 +44,17 @@ typedef unsigned char uChar; typedef unsigned short uShort; typedef unsigned int uInt; typedef unsigned long uLong; -typedef uint8_t uInt8; -typedef uint16_t uInt16; -typedef uint32_t uInt32; -typedef uint64_t uInt64; +typedef std::uint8_t uInt8; +typedef std::uint16_t uInt16; +typedef std::uint32_t uInt32; +typedef std::uint64_t uInt64; typedef signed int sInt; typedef signed long sLong; -typedef int8_t sInt8; -typedef int16_t sInt16; -typedef int32_t sInt32; -typedef int64_t sInt64; +typedef std::int8_t sInt8; +typedef std::int16_t sInt16; +typedef std::int32_t sInt32; +typedef std::int64_t sInt64; typedef long double lDouble;