Update of /cvsroot/libfunutil/libfunutil/lib/toolbox/src
In directory sc8-pr-cvs1:/tmp/cvs-serv13925/lib/toolbox/src
Modified Files:
children_holder.h class_name.h file_util.cpp string_util.cpp
string_util.h type_traits.h
Log Message:
mass commit: mainly build-related fixes, plus some code stuff from the cl/s11n trees.
Index: children_holder.h
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/lib/toolbox/src/children_holder.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- children_holder.h 29 Nov 2003 13:47:13 -0000 1.2
+++ children_holder.h 10 Dec 2003 19:42:24 -0000 1.3
@@ -9,12 +9,6 @@
#include <vector>
//#include <deque> // causes crashes in some cases where vector does not :/
-#ifndef TYPENAME
-#define TYPENAME typename
-// gcc 3.x handles typenames "properly" and gcc 2.95.3 does not, so we must do -DTYPENAME=
-// for gcc 2.95.3.
-#endif
-
namespace TOOLBOX_NAMESPACE
{
/**
@@ -116,7 +110,7 @@
{
if ( !parent ) return false;
static ThisType::map_type & cmap = parentChildMap();
- TYPENAME ThisType::map_type::iterator it = cmap.find( parent );
+ typename ThisType::map_type::iterator it = cmap.find( parent );
if ( it == cmap.end() ) return false;
cmap.erase( parent );
return true;
@@ -136,20 +130,20 @@
if ( !parent )
return false;
static ThisType::map_type & cmap = parentChildMap();
- TYPENAME ThisType::map_type::iterator it = cmap.find( parent );
+ typename ThisType::map_type::iterator it = cmap.find( parent );
if ( it == cmap.end() )
{
// we were probably just never registed because children() was never called.
return false;
}
- TYPENAME ThisType::list_type * li = ( *it ).second;
+ typename ThisType::list_type * li = ( *it ).second;
if ( !unmap_parent( parent ) )
{
return false;
}
- TYPENAME ThisType::list_type::iterator vit;
- TYPENAME ThisType::child_type * child = 0;
- for ( vit = li->begin(); li->begin() != li->end() )
+ typename ThisType::list_type::iterator vit;
+ typename ThisType::child_type * child = 0;
+ for ( vit = li->begin(); li->begin() != li->end(); )
{
child = ( *vit );
li->erase( vit );
Index: class_name.h
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/lib/toolbox/src/class_name.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- class_name.h 28 Nov 2003 00:56:03 -0000 1.1
+++ class_name.h 10 Dec 2003 19:42:24 -0000 1.2
@@ -41,8 +41,8 @@
/** returns the class name for class T. */
static const char * name()
{
- assert( 0 /* this class_name<> is unspecialized! */ );
- return "error::class_name<unspecialized>";
+ assert( 0 && "this class_name<> is unspecialized!" );
+ return "class_name<unspecialized>";
}
/** returns the class name for class T. */
Index: file_util.cpp
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/lib/toolbox/src/file_util.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- file_util.cpp 28 Nov 2003 00:56:03 -0000 1.1
+++ file_util.cpp 10 Dec 2003 19:42:24 -0000 1.2
@@ -9,9 +9,11 @@
#if HAVE_CONFIG_H
-# include "config.h"
+#include "config.h" // expected: HAVE_ZLIB, HAVE_BZLIB
#endif
+
#include <fstream>
+
#if HAVE_ZLIB
# include "gzstream.h"
#endif
Index: string_util.cpp
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/lib/toolbox/src/string_util.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- string_util.cpp 28 Nov 2003 00:56:03 -0000 1.1
+++ string_util.cpp 10 Dec 2003 19:42:24 -0000 1.2
@@ -72,13 +72,13 @@
- unsigned long strip_slashes( std::string &str )
+ unsigned long strip_slashes( std::string &str, const char slash )
{
std::string::size_type osz;
if( str.empty() || ((osz = str.size()) < 2 ) ) return 0;
std::string::size_type pos = 0;
unsigned long count = 0;
- pos = str.find( "\\" );
+ pos = str.find( slash );
if( pos == str.npos ) return 0;
if( osz < 2 ) return 0;
@@ -88,7 +88,7 @@
while( pos > 2 )
{
char c = str[pos];
- if( '\\' == c && (str[pos-1] != '\\') )
+ if( slash == c && (str[pos-1] != slash) )
{
++count;
search = str.find_first_not_of( " \t\n", pos +1 );
@@ -102,17 +102,17 @@
--pos;
}
- pos = str.find( "\\" );
+ pos = str.find( slash );
while( !( (pos == std::string::npos) || (pos > str.size()-2) ) )
{
// todo: search from the end, going backwards. This should be faster in terms of string's required workload.
++count;
str.erase( pos, 1 );
- if( '\\' != str[pos+1] )
+ if( slash != str[pos+1] )
{
pos += 1;
} else pos += 2;
- pos = str.find( "\\", pos );
+ pos = str.find( slash, pos );
}
return count;
@@ -135,14 +135,14 @@
- std::string trim_string( const std::string &str, int policy )
+ std::string trim_string( const std::string &str, TrimPolicy policy )
{
std::string foo = str;
trim_string( foo, policy );
return foo;
}
- unsigned int trim_string( std::string &str, int policy )
+ unsigned int trim_string( std::string &str, TrimPolicy policy )
{
if( str.empty() ) return 0;
static const std::string space(" \t\n\r");
Index: string_util.h
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/lib/toolbox/src/string_util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- string_util.h 29 Nov 2003 13:47:13 -0000 1.2
+++ string_util.h 10 Dec 2003 19:42:24 -0000 1.3
@@ -52,12 +52,12 @@
Trims leading and trailing whitespace from the input string
and returns the number of whitespace characters removed.
*/
- unsigned int trim_string( std::string &, int = TrimAll );
+ unsigned int trim_string( std::string &, TrimPolicy = TrimAll );
/**
Trims leading and trailing whitespace from the input string
and returns the trimmed string.
*/
- std::string trim_string( const std::string &, int = TrimAll );
+ std::string trim_string( const std::string &, TrimPolicy = TrimAll );
/**
@@ -65,8 +65,10 @@
Removes backslash-escaped newlines from the input string, including
any whitespace immediately following each backslash.
+
+ The optional slash parameter defines the escape character.
*/
- unsigned long strip_slashes( std::string &str );
+ unsigned long strip_slashes( std::string &str, const char slash = '\\' );
/**
Adds an escape sequence in front of any characters in
Index: type_traits.h
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/lib/toolbox/src/type_traits.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- type_traits.h 29 Nov 2003 13:47:13 -0000 1.2
+++ type_traits.h 10 Dec 2003 19:42:24 -0000 1.3
@@ -37,15 +37,12 @@
Equivalent to (const type &)
*/
typedef const type & const_reference;
- private:
- type_traits(); // unimplemented
- ~type_traits(); // unimplemented
};
/**
A specialization to treat (T *) as (T) for type_traits purposes.
*/
- template <>
+ template <typename T>
struct type_traits<T *> : public type_traits<T> {};
} // namespace
|