From bdde3e5d2bd6df79557e219f3b5f148aa0914390 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 7 Jul 2025 13:51:36 +0200 Subject: Fl_Table_Row: replace private class CharVector with std::vector FL/Fl_Table_Row.H: use `std::vector _rowselect;`, remove declaration of class `CharVector` src/Fl_Table_Row.cxx: remove implementation of class `CharVector`, simplify loops (use range based for loops), use resize() to change vector size. Unify copyright year of Fl_Table* headers and implementation. --- FL/Fl_Table.H | 2 +- FL/Fl_Table_Row.H | 61 ++++++++----------------------------------------------- 2 files changed, 9 insertions(+), 54 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H index 99ceb3009..d4a149da5 100644 --- a/FL/Fl_Table.H +++ b/FL/Fl_Table.H @@ -3,7 +3,7 @@ // // Copyright 2002 by Greg Ercolano. // Copyright (c) 2004 O'ksi'D -// Copyright 2023 by Bill Spitzak and others. +// Copyright 2009-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this diff --git a/FL/Fl_Table_Row.H b/FL/Fl_Table_Row.H index 93f8b0e8c..28b1d05b4 100644 --- a/FL/Fl_Table_Row.H +++ b/FL/Fl_Table_Row.H @@ -1,8 +1,3 @@ -// - -#ifndef _FL_TABLE_ROW_H -#define _FL_TABLE_ROW_H - // // Fl_Table_Row -- A row oriented table widget for the Fast Light Tool Kit (FLTK). // @@ -10,6 +5,7 @@ // Handles row-specific selection behavior. // // Copyright 2002 by Greg Ercolano. +// Copyright 2009-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -22,8 +18,14 @@ // https://www.fltk.org/bugs.php // +#ifndef _FL_TABLE_ROW_H +#define _FL_TABLE_ROW_H + #include +#include +#include + /** A table with row selection capabilities. @@ -49,55 +51,8 @@ public: SELECT_MULTI // multiple row selection (default) }; private: - // An STL-ish vector without templates - class FL_EXPORT CharVector { - char *arr; - int _size; - void init() { - arr = 0; - _size = 0; - } - void copy(char *newarr, int newsize); - public: - CharVector() { // CTOR - init(); - } - ~CharVector(); // DTOR - CharVector(CharVector&o) { // COPY CTOR - init(); - copy(o.arr, o._size); - } - CharVector& operator=(CharVector&o) { // ASSIGN - init(); - copy(o.arr, o._size); - return(*this); - } - char operator[](int x) const { - return(arr[x]); - } - char& operator[](int x) { - return(arr[x]); - } - int size() { - return(_size); - } - void size(int count); - char pop_back() { - char tmp = arr[_size-1]; - _size--; - return(tmp); - } - void push_back(char val) { - int x = _size; - size(_size+1); - arr[x] = val; - } - char back() { - return(arr[_size-1]); - } - }; - CharVector _rowselect; // selection flag for each row + std::vector _rowselect; // selection flag for each row // handle() state variables. // Put here instead of local statics in handle(), so more -- cgit v1.2.3