Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rolf Eike Beer
KWSys
Commits
08ba2821
Commit
08ba2821
authored
19 years ago
by
Brad King
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Added operator!= for stl string and char* when the system does not provide one.
parent
4eaf64bc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+3
-0
3 additions, 0 deletions
CMakeLists.txt
Configure.hxx.in
+14
-10
14 additions, 10 deletions
Configure.hxx.in
kwsysPlatformCxxTests.cxx
+11
-0
11 additions, 0 deletions
kwsysPlatformCxxTests.cxx
kwsys_stl_string.hxx.in
+19
-0
19 additions, 0 deletions
kwsys_stl_string.hxx.in
with
47 additions
and
10 deletions
CMakeLists.txt
+
3
−
0
View file @
08ba2821
...
...
@@ -175,6 +175,9 @@ ELSE(KWSYS_IOS_USE_SSTREAM)
ENDIF
(
KWSYS_IOS_USE_STRSTREAM_H
)
ENDIF
(
KWSYS_IOS_USE_SSTREAM
)
KWSYS_PLATFORM_CXX_TEST
(
KWSYS_STL_STRING_HAVE_NEQ_CHAR
"Checking whether stl string has operator!= for char*"
DIRECT
)
IF
(
KWSYS_IOS_USE_ANSI
)
# ANSI streams always have string operators.
SET
(
KWSYS_STL_STRING_HAVE_OSTREAM 1
)
...
...
This diff is collapsed.
Click to expand it.
Configure.hxx.in
+
14
−
10
View file @
08ba2821
...
...
@@ -41,6 +41,9 @@
/* Whether the STL string has operator>> for istream. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM @KWSYS_STL_STRING_HAVE_ISTREAM@
/* Whether the STL string has operator!= for char*. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR @KWSYS_STL_STRING_HAVE_NEQ_CHAR@
/* Define the stl namespace macro. */
#if @KWSYS_NAMESPACE@_STL_HAVE_STD
# define @KWSYS_NAMESPACE@_stl std
...
...
@@ -70,16 +73,17 @@
# define kwsys_stl @KWSYS_NAMESPACE@_stl
# define kwsys_ios @KWSYS_NAMESPACE@_ios
# endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define KWSYS_IOS_USE_ANSI @KWSYS_NAMESPACE@_IOS_USE_ANSI
# define KWSYS_IOS_USE_SSTREAM @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
# define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
# define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define KWSYS_IOS_USE_ANSI @KWSYS_NAMESPACE@_IOS_USE_ANSI
# define KWSYS_IOS_USE_SSTREAM @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
# define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
# define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM
# define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR
#endif
#endif
This diff is collapsed.
Click to expand it.
kwsysPlatformCxxTests.cxx
+
11
−
0
View file @
08ba2821
...
...
@@ -54,6 +54,17 @@ void f(istream& is, kwsys_stl::string& s) { is >> s; }
int
main
()
{
return
0
;
}
#endif
#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
# if KWSYS_STL_HAVE_STD
# define kwsys_stl std
# else
# define kwsys_stl
# endif
# include <string>
bool
f
(
const
kwsys_stl
::
string
&
s
)
{
return
s
!=
""
;
}
int
main
()
{
return
0
;
}
#endif
#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
#include
<sys/types.h>
#include
<sys/stat.h>
...
...
This diff is collapsed.
Click to expand it.
kwsys_stl_string.hxx.in
+
19
−
0
View file @
08ba2821
...
...
@@ -90,3 +90,22 @@ operator<<(@KWSYS_NAMESPACE@_ios::ostream& os,
return os << s.c_str();
}
#endif
// Provide the operator!= for the stl string and char* if it is not
// provided by the system or another copy of kwsys. Allow user code
// to block this definition by defining the macro
// @KWSYS_NAMESPACE@_STL_STRING_NO_NEQ_CHAR
// to avoid conflicts with other libraries.
#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR && \
!defined(@KWSYS_NAMESPACE@_STL_STRING_NO_NEQ_CHAR) && \
!defined(KWSYS_STL_STRING_NEQ_CHAR_DEFINED)
# define KWSYS_STL_STRING_NEQ_CHAR_DEFINED
inline bool operator!=(@KWSYS_NAMESPACE@_stl::string const& s, const char* c)
{
return !(s == c);
}
inline bool operator!=(const char* c, @KWSYS_NAMESPACE@_stl::string const& s)
{
return !(s == c);
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment