Hi Jim,

I just noticed you added an OSG dependency to strutils.cxx/hxx  If possible it would be nice to avoid adding graphics system dependencies to these text manipulation libraries.  SimGear and SimGear code is used in a variety of places beyond FlightGear, even in embedded systems where compiling opengl and OSG is completely impossible.

Would it work to use something like the following instead of an OSG function?:

      #include <ctype.h>

       int toupper(int c);
       int tolower(int c);

Right now this OSG dependency is breaking one of my other projects.

Thanks,

Curt.



On Sat, Sep 26, 2009 at 6:44 AM, James Turner <jmt@baron.flightgear.org> wrote:
Update of /var/cvs/SimGear-0.3/source/simgear/misc
In directory baron.flightgear.org:/tmp/cvs-serv8677/simgear/misc

Modified Files:
       strutils.cxx strutils.hxx
Log Message:
Extend simgear::strutils with convertToLowerCase helper - currently a proxy for osgDB helper of the same name.


Index: strutils.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/misc/strutils.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- strutils.cxx        13 Apr 2008 21:11:44 -0000      1.4
+++ strutils.cxx        26 Sep 2009 11:44:33 -0000      1.5
@@ -25,6 +25,11 @@

 #include "strutils.hxx"

+#include <osgDB/FileNameUtils> // for convertToLowerCase
+
+using std::string;
+using std::vector;
+
 namespace simgear {
    namespace strutils {

@@ -180,5 +185,12 @@
           return do_strip( s, BOTHSTRIP );
       }

+  string convertToLowerCase(const string& str)
+  {
+    // proxy onto osgDB - easy to reimplement here, but let's avoid
+    // code duplication for the moment.
+    return osgDB::convertToLowerCase(str);
+  }
+
    } // end namespace strutils
 } // end namespace simgear

Index: strutils.hxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/misc/strutils.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- strutils.hxx        28 Jul 2008 07:52:14 -0000      1.4
+++ strutils.hxx        26 Sep 2009 11:44:34 -0000      1.5
@@ -30,16 +30,12 @@
 #include <simgear/compiler.h>

 #include <string>
-
 #include <vector>
-using std::vector;
-
 #include <cstdlib>

-using std::string;

 namespace simgear {
-    namespace strutils {
+  namespace strutils {

 //     /**
 //      * atof() wrapper for "string" type
@@ -64,9 +60,9 @@
        * @param s String to strip.
        * @return The stripped string.
        */
-       string lstrip( const string& s );
-       string rstrip( const string& s );
-       string strip( const string& s );
+       std::string lstrip( const std::string& s );
+       std::string rstrip( const std::string& s );
+       std::string strip( const std::string& s );

       /**
        * Split a string into a words using 'sep' as the delimiter string.
@@ -79,12 +75,15 @@
        * resulting in at most maxsplit+1 words.
        * @return Array of words.
        */
-       vector<string>
-       split( const string& s,
+       std::vector<std::string>
+       split( const std::string& s,
              const char* sep = 0,
              int maxsplit = 0 );

-    } // end namespace strutils
+
+  std::string convertToLowerCase(const std::string& str);
+
+  } // end namespace strutils
 } // end namespace simgear

 #endif // STRUTILS_H


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Simgear-cvslogs mailing list
Simgear-cvslogs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simgear-cvslogs



--
Curtis Olson: http://baron.flightgear.org/~curt/