summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-03-07 20:26:03 +0100
committerMatthias Melcher <github@matthiasm.com>2025-03-07 20:26:03 +0100
commit1186b4e255832ae322e4dd2778318ebcb4568204 (patch)
tree34ec0d5edde3c1f1c5c51f0f5083b7f5d85c708b /src
parent70e5dc23aee51fc2fe67c73390d808e01ccfbfa6 (diff)
Making fl_filename_... public for std::string.
New functions append "_str" to the function name to avoid ambiguities when calling them. So 'char *fl_filename_name(const char *)' becomes 'std::string fl_filename_name_str(const std::string &)'
Diffstat (limited to 'src')
-rw-r--r--src/filename_absolute.cxx27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx
index da4dd816b..f70d59873 100644
--- a/src/filename_absolute.cxx
+++ b/src/filename_absolute.cxx
@@ -285,10 +285,6 @@ int Fl_System_Driver::filename_relative(char *to, int tolen, const char *dest_di
\endcond
*/
-// FIXME: '0 &&' => We can't do that in 1.4.x, enable this block in 1.5 or higher.
-// There would be too many naming conflicts with fluid's usage of these functions.
-
-#if (0 && FLTK_USE_STD)
/**
Return a new string that contains the name part of the filename.
@@ -296,7 +292,7 @@ int Fl_System_Driver::filename_relative(char *to, int tolen, const char *dest_di
\return the name part of a filename
\see fl_filename_name(const char *filename)
*/
-std::string fl_filename_name(const std::string &filename) {
+std::string fl_filename_name_str(const std::string &filename) {
return std::string(fl_filename_name(filename.c_str()));
}
@@ -306,7 +302,7 @@ std::string fl_filename_name(const std::string &filename) {
\return the path part of a filename without the name
\see fl_filename_name(const char *filename)
*/
-std::string fl_filename_path(const std::string &filename) {
+std::string fl_filename_path_str(const std::string &filename) {
const char *base = filename.c_str();
const char *name = fl_filename_name(base);
if (name) {
@@ -323,7 +319,7 @@ std::string fl_filename_path(const std::string &filename) {
string if the filename has no extension
\see fl_filename_ext(const char *buf)
*/
-std::string fl_filename_ext(const std::string &filename) {
+std::string fl_filename_ext_str(const std::string &filename) {
return std::string(fl_filename_ext(filename.c_str()));
}
@@ -334,7 +330,7 @@ std::string fl_filename_ext(const std::string &filename) {
\return the new filename
\see fl_filename_setext(char *to, int tolen, const char *ext)
*/
-std::string fl_filename_setext(const std::string &filename, const std::string &new_extension) {
+std::string fl_filename_setext_str(const std::string &filename, const std::string &new_extension) {
char buffer[FL_PATH_MAX];
fl_strlcpy(buffer, filename.c_str(), FL_PATH_MAX);
fl_filename_setext(buffer, FL_PATH_MAX, new_extension.c_str());
@@ -347,7 +343,7 @@ std::string fl_filename_setext(const std::string &filename, const std::string &n
\return the new, expanded filename
\see fl_filename_expand(char *to, int tolen, const char *from)
*/
-std::string fl_filename_expand(const std::string &from) {
+std::string fl_filename_expand_str(const std::string &from) {
char buffer[FL_PATH_MAX];
fl_filename_expand(buffer, FL_PATH_MAX, from.c_str());
return std::string(buffer);
@@ -359,7 +355,7 @@ std::string fl_filename_expand(const std::string &from) {
\return the new, absolute filename
\see fl_filename_absolute(char *to, int tolen, const char *from)
*/
-std::string fl_filename_absolute(const std::string &from) {
+std::string fl_filename_absolute_str(const std::string &from) {
char buffer[FL_PATH_MAX];
fl_filename_absolute(buffer, FL_PATH_MAX, from.c_str());
return std::string(buffer);
@@ -373,7 +369,7 @@ std::string fl_filename_absolute(const std::string &from) {
\return the new, absolute filename
\see fl_filename_absolute(char *to, int tolen, const char *from, const char *base)
*/
-std::string fl_filename_absolute(const std::string &from, const std::string &base) {
+std::string fl_filename_absolute_str(const std::string &from, const std::string &base) {
char buffer[FL_PATH_MAX];
fl_filename_absolute(buffer, FL_PATH_MAX, from.c_str(), base.c_str());
return std::string(buffer);
@@ -385,7 +381,7 @@ std::string fl_filename_absolute(const std::string &from, const std::string &bas
\return the new, relative filename
\see fl_filename_relative(char *to, int tolen, const char *from)
*/
-std::string fl_filename_relative(const std::string &from) {
+std::string fl_filename_relative_str(const std::string &from) {
char buffer[FL_PATH_MAX];
fl_filename_relative(buffer, FL_PATH_MAX, from.c_str());
return std::string(buffer);
@@ -398,7 +394,7 @@ std::string fl_filename_relative(const std::string &from) {
\return the new, relative filename
\see fl_filename_relative(char *to, int tolen, const char *from, const char *base)
*/
-std::string fl_filename_relative(const std::string &from, const std::string &base) {
+std::string fl_filename_relative_str(const std::string &from, const std::string &base) {
char buffer[FL_PATH_MAX];
fl_filename_relative(buffer, FL_PATH_MAX, from.c_str(), base.c_str());
return std::string(buffer);
@@ -408,10 +404,9 @@ std::string fl_filename_relative(const std::string &from, const std::string &bas
as a UTF-8 encoded value in an std::string.
\return the CWD encoded as UTF-8
*/
-std::string fl_getcwd() {
+std::string fl_getcwd_str() {
char buffer[FL_PATH_MAX];
+ buffer[0] = 0;
fl_getcwd(buffer, FL_PATH_MAX);
return std::string(buffer);
}
-
-#endif // FLTK_USE_STD