From a56c48079e8d691611c62c92f2cf49b3fb6345d2 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:34:47 +0100 Subject: [PATCH] Fix "\todo Complete documentation of class Fl_String" Also - fix "\todo Unicode?" in Fl_Text_Display::display_insert() after verification - fix "\todo [Internal] The user_data value must be implemented using \p fl_intptr_t" because that's now in place. --- FL/Fl_String.H | 8 ++++---- FL/Fl_Widget.H | 3 --- src/Fl_String.cxx | 18 +++++++++++++----- src/Fl_Text_Display.cxx | 2 -- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/FL/Fl_String.H b/FL/Fl_String.H index 4a20c48b2..72e90f52d 100644 --- a/FL/Fl_String.H +++ b/FL/Fl_String.H @@ -63,8 +63,6 @@ \endcode \since 1.4.0 - - \todo Complete documentation of class Fl_String */ class Fl_String { @@ -96,10 +94,12 @@ private: public: void value(const char *str); - void value(const char *str, int slen); - + void value(const char *str, int len); + /** Returns a pointer to the first character stored in the object */ const char *value() const { return value_; } + /** Returns a pointer to the first byte stored in the object */ char *buffer() { return value_; } + /** Returns the number of bytes currently stored in the object */ int size() const { return size_; } int slen() const; diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index 416f65470..b0317dc6e 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -686,9 +686,6 @@ public: using only \p long values. You may want to use user_data() instead. \see user_data() - - \todo [Internal] The user_data value must be implemented using - \p fl_intptr_t or similar to avoid 64-bit platform incompatibilities. */ long argument() const {return (long)(fl_intptr_t)user_data_;} diff --git a/src/Fl_String.cxx b/src/Fl_String.cxx index 7c82b0ec1..e07f23a94 100644 --- a/src/Fl_String.cxx +++ b/src/Fl_String.cxx @@ -23,15 +23,18 @@ Basic Fl_String class for FLTK. */ +/** Constructs an empty string */ Fl_String::Fl_String() { init(); } +/** Constructor from a C-style string */ Fl_String::Fl_String(const char *str) { init(); value(str); } +/** Constructor from a buffer of \c size bytes */ Fl_String::Fl_String(const char *str, int size) { init(); value(str, size); @@ -43,13 +46,13 @@ void Fl_String::init() { capacity_ = 0; } -// copy constructor +/** copy constructor */ Fl_String::Fl_String(const Fl_String &in) { init(); value(in.value(), in.size()); } -// copy assignment operator +/** copy assignment operator */ Fl_String& Fl_String::operator=(const Fl_String &in) { if (this == &in) return *this; @@ -58,13 +61,14 @@ Fl_String& Fl_String::operator=(const Fl_String &in) { return *this; } -// assignment operator for 'const char *' +/** assignment operator for 'const char *' */ Fl_String& Fl_String::operator=(const char *in) { value(in); // debug("*STRING* assigned"); return *this; } +/** Destructor */ Fl_String::~Fl_String() { delete[] value_; } @@ -96,15 +100,18 @@ void Fl_String::alloc_buf(int size, bool preserve_text) { value_ = new_value; } +/** Assigns the string value to a C-style string */ void Fl_String::value(const char *str) { value(str, str ? (int)strlen(str) : 0); } +/** Returns the number of non-null bytes in the object */ int Fl_String::slen() const { if (!value_) return 0; return (int)strlen(value_); } +/** Assigns the string value to a buffer of \c len bytes */ void Fl_String::value(const char *str, int len) { if (str) { alloc_buf(len); @@ -119,12 +126,13 @@ void Fl_String::value(const char *str, int len) { } } +/** Returns the minimum capacity of the object */ int Fl_String::capacity() const { return capacity_; // > 0 ? capacity_ - 1 : capacity_; } -/** Set the minumum capacity to num_bytes plus one for a terminating NUL. - The cintents of the string buffer will be copied if needed. +/** Set the minimum capacity to \c num_bytes plus one for a terminating NUL. + The contents of the string buffer will be copied if needed. \param num_bytes minimum size of buffer */ void Fl_String::capacity(int num_bytes) { diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index a7706acca..759cf6101 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1233,8 +1233,6 @@ int Fl_Text_Display::wrapped_row(int row) const { (scroll_() counts them too) and/or to count from the most efficient starting point, but the efficiency of this routine is not as important to the overall performance of the text display. - - \todo Unicode? */ void Fl_Text_Display::display_insert() { int hOffset, topLine, X, Y;