More function declared as const

This commit is contained in:
Markus Gans 2020-07-12 19:05:29 +02:00
parent 13dc85860b
commit f07a481d46
8 changed files with 32 additions and 12 deletions

View File

@ -641,7 +641,7 @@ int FOptiMove::repeatedAppend ( const capability& o
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FOptiMove::relativeMove ( char move[] int FOptiMove::relativeMove ( char move[]
, int from_x, int from_y , int from_x, int from_y
, int to_x, int to_y ) , int to_x, int to_y ) const
{ {
int vtime{0}; int vtime{0};
int htime{0}; int htime{0};

View File

@ -202,7 +202,7 @@ void FTermXTerminal::setDefaults()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermXTerminal::resetColorMap() void FTermXTerminal::resetColorMap() const
{ {
// Reset the entire color table // Reset the entire color table

View File

@ -1256,7 +1256,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::clearArea (FTermArea* area, int fillchar) void FVTerm::clearArea (FTermArea* area, int fillchar) const
{ {
// Clear the area with the current attributes // Clear the area with the current attributes
@ -1682,7 +1682,7 @@ bool FVTerm::updateVTermCharacter ( const FTermArea* area
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::updateVTerm() void FVTerm::updateVTerm() const
{ {
// Updates the character data from all areas to VTerm // Updates the character data from all areas to VTerm
@ -2991,7 +2991,7 @@ inline void FVTerm::charsetChanges (FChar*& next_char)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendCharacter (FChar*& next_char) inline void FVTerm::appendCharacter (FChar*& next_char) const
{ {
const int term_width = vterm->width - 1; const int term_width = vterm->width - 1;
const int term_height = vterm->height - 1; const int term_height = vterm->height - 1;

View File

@ -31,9 +31,29 @@ template<typename T>
struct FData struct FData
{ {
explicit FData (T v) explicit FData (T v)
: value(v) : value{v}
{ } { }
FData (const FData& d) // Copy constructor
: value{d.value}
{ }
FData& operator = (const FData& d) // Copy assignment operator (=)
{
value = d.value;
return *this;
}
FData (FData&& d) noexcept // Move constructor
: value{std::move(d.value)}
{ }
FData& operator = (FData&& d) noexcept // Move assignment operator (=)
{
value = std::move(d.value);
return *this;
}
T operator () () const T operator () () const
{ {
return value; return value;

View File

@ -327,7 +327,7 @@ class FTimerEvent : public FEvent // timer event
// class FUserEvent // class FUserEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
class FUserEvent : public FEvent // timer event class FUserEvent : public FEvent // user event
{ {
public: public:
FUserEvent() = default; FUserEvent() = default;

View File

@ -169,7 +169,7 @@ class FOptiMove final
int capDuration (const char[], int) const; int capDuration (const char[], int) const;
int capDurationToLength (int) const; int capDurationToLength (int) const;
int repeatedAppend (const capability&, volatile int, char*) const; int repeatedAppend (const capability&, volatile int, char*) const;
int relativeMove (char[], int, int, int, int); int relativeMove (char[], int, int, int, int) const;
int verticalMove (char[], int, int) const; int verticalMove (char[], int, int) const;
void downMove (char[], int&, int, int) const; void downMove (char[], int&, int, int) const;
void upMove (char[], int&, int, int) const; void upMove (char[], int&, int, int) const;

View File

@ -98,7 +98,7 @@ class FTermXTerminal final
// Methods // Methods
void init(); void init();
void setDefaults(); void setDefaults();
void resetColorMap(); void resetColorMap() const;
void resetForeground(); void resetForeground();
void resetBackground(); void resetBackground();
void resetCursorColor(); void resetCursorColor();

View File

@ -313,7 +313,7 @@ class FVTerm
static void putArea (const FPoint&, const FTermArea*); static void putArea (const FPoint&, const FTermArea*);
void scrollAreaForward (FTermArea*) const; void scrollAreaForward (FTermArea*) const;
void scrollAreaReverse (FTermArea*) const; void scrollAreaReverse (FTermArea*) const;
void clearArea (FTermArea*, int = ' '); void clearArea (FTermArea*, int = ' ') const;
void processTerminalUpdate(); void processTerminalUpdate();
static void startTerminalUpdate(); static void startTerminalUpdate();
static void finishTerminalUpdate(); static void finishTerminalUpdate();
@ -364,7 +364,7 @@ class FVTerm
static bool updateVTermCharacter ( const FTermArea* static bool updateVTermCharacter ( const FTermArea*
, const FPoint& , const FPoint&
, const FPoint& ); , const FPoint& );
void updateVTerm(); void updateVTerm() const;
static void callPreprocessingHandler (const FTermArea*); static void callPreprocessingHandler (const FTermArea*);
bool hasChildAreaChanges (FTermArea*) const; bool hasChildAreaChanges (FTermArea*) const;
void clearChildAreaChanges (const FTermArea*) const; void clearChildAreaChanges (const FTermArea*) const;
@ -412,7 +412,7 @@ class FVTerm
static void markAsPrinted (uInt, uInt, uInt); static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (FChar*&); static void newFontChanges (FChar*&);
static void charsetChanges (FChar*&); static void charsetChanges (FChar*&);
void appendCharacter (FChar*&); void appendCharacter (FChar*&) const;
void appendChar (FChar*&) const; void appendChar (FChar*&) const;
void appendAttributes (FChar*&) const; void appendAttributes (FChar*&) const;
int appendLowerRight (FChar*&) const; int appendLowerRight (FChar*&) const;