summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Preferences.cxx26
-rw-r--r--src/Fl_String.H14
-rw-r--r--src/Fl_String.cxx4
3 files changed, 28 insertions, 16 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 586416bf5..94b17e994 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -28,9 +28,7 @@
#include <stdlib.h>
#include <stdarg.h>
-#if (FLTK_USE_STD)
#include <string>
-#endif
/*
The format of preferences files is not part of the FLTK specification
@@ -966,12 +964,12 @@ char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue
return ( v != defaultValue );
}
-#if (FLTK_USE_STD)
-
/**
- Reads an entry from the group. A default value must be
- supplied. The return value indicates if the value was available
- (non-zero) or the default was used (0).
+ Reads an entry from the group.
+
+ A default value must be supplied. The return value indicates if the value was
+ available (non-zero) or the default was used (0). NUL characters in std::string
+ are treated as the end of the text.
\param[in] key name of entry
\param[out] value returned from preferences or default value if none was set
@@ -995,8 +993,6 @@ char Fl_Preferences::get( const char *key, std::string &value, const std::string
}
}
-#endif
-
/**
Sets an entry (name/value pair). The return value indicates if there
was a problem storing the data in memory. However it does not
@@ -1167,12 +1163,12 @@ char Fl_Preferences::set( const char *key, const void *data, int dsize ) {
return 1;
}
-#if (FLTK_USE_STD)
-
/**
- Sets an entry (name/value pair). The return value indicates if there
- was a problem storing the data in memory. However it does not
- reflect if the value was actually stored in the preference file.
+ Sets an entry (name/value pair).
+
+ The return value indicates if there was a problem storing the data in memory.
+ However it does not reflect if the value was actually stored in the preference
+ file. NUL characters in std::string are treated as the end of the text.
\param[in] entry name of entry
\param[in] value set this entry to value (stops at the first nul character).
@@ -1182,8 +1178,6 @@ char Fl_Preferences::set( const char *entry, const std::string &value ) {
return set(entry, value.c_str());
}
-#endif // FLTK_USE_STD
-
/**
Returns the size of the value part of an entry.
diff --git a/src/Fl_String.H b/src/Fl_String.H
index e7fbf49eb..13dfd8cf0 100644
--- a/src/Fl_String.H
+++ b/src/Fl_String.H
@@ -29,6 +29,18 @@
#include <FL/Fl_Export.H>
+#include <string>
+
+#if 1
+
+// Since fltk 1.5.0, Fl_String is no longer needed and now maps to std::string.
+// Fl_String is not part of the public API. All occurrences of Fl_String in the
+// core library and in Fluid should be replaced with std::string. When done,
+// src/Fl_String.H and src/Fl_String.cxx can be deleted.
+using Fl_String = std::string;
+
+#else
+
// See: https://en.cppreference.com/w/cpp/string/basic_string/basic_string
/**
@@ -142,4 +154,6 @@ FL_EXPORT bool operator!=(const Fl_String & lhs, const Fl_String & rhs);
\endcond
*/
+#endif
+
#endif // _FL_Fl_String_H_
diff --git a/src/Fl_String.cxx b/src/Fl_String.cxx
index 60d50ef99..705b7cd9f 100644
--- a/src/Fl_String.cxx
+++ b/src/Fl_String.cxx
@@ -14,6 +14,8 @@
// https://www.fltk.org/bugs.php
//
+#if 0
+
/**
\cond DriverDev
\addtogroup DriverDeveloper
@@ -662,3 +664,5 @@ bool operator!=(const Fl_String &lhs, const Fl_String &rhs) {
\}
\endcond
*/
+
+#endif