Author: wyoung
Date: Thu Jun 25 07:59:57 2009
New Revision: 2526

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2526&view=rev
Log:
- Moved private FieldNames::str_to_lwr() method out into its own module,
  in the new mysqlpp::internal namespace, so other modules can use it
- Added an overload for this new global method, with a different
  interface, for code using std::string more than char*

Added:
    trunk/lib/utility.cpp
    trunk/lib/utility.h
Modified:
    trunk/lib/field_names.h
    trunk/mysql++.bkl

Modified: trunk/lib/field_names.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/field_names.h?rev=2526&r1=2525&r2=2526&view=diff
==============================================================================
--- trunk/lib/field_names.h (original)
+++ trunk/lib/field_names.h Thu Jun 25 07:59:57 2009
@@ -30,8 +30,6 @@
 
 #include <string>
 #include <vector>
-
-#include <ctype.h>
 
 namespace mysqlpp {
 
@@ -100,13 +98,6 @@
 
 private:
        void init(const ResultBase* res);
-       void str_to_lwr(std::string& s) const
-       {
-               std::string::iterator it;
-               for (it = s.begin(); it != s.end(); ++it) {
-                       *it = tolower(*it);
-               }
-       }
 };
 
 } // end namespace mysqlpp

Added: trunk/lib/utility.cpp
URL: http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/utility.cpp?rev=2526&view=auto
==============================================================================
--- trunk/lib/utility.cpp (added)
+++ trunk/lib/utility.cpp Thu Jun 25 07:59:57 2009
@@ -1,0 +1,47 @@
+/***********************************************************************
+ utility.cpp - Implements utility functions used within the library.
+
+ Copyright (c) 2009 by Warren Young.  Others may also hold copyrights
+ on code in this file.  See the CREDITS file in the top directory of
+ the distribution for details.
+
+ This file is part of MySQL++.
+
+ MySQL++ is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ MySQL++ is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with MySQL++; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA
+***********************************************************************/
+
+#include "utility.h"
+
+namespace mysqlpp {
+       namespace internal {
+               void str_to_lwr(std::string& s)
+               {
+                       std::string::iterator it;
+                       for (it = s.begin(); it != s.end(); ++it) {
+                               *it = tolower(*it);
+                       }
+               }
+
+               void str_to_lwr(std::string& ls, const char* mcs)
+               {
+                       ls.reserve(strlen(mcs));
+                       while (mcs && *mcs) {
+                               ls += tolower(*mcs++);
+                       }
+               }
+       } // end namespace internal
+} // end namespace mysqlpp
+

Added: trunk/lib/utility.h
URL: http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/utility.h?rev=2526&view=auto
==============================================================================
--- trunk/lib/utility.h (added)
+++ trunk/lib/utility.h Thu Jun 25 07:59:57 2009
@@ -1,0 +1,50 @@
+/// \file utility.h
+/// \brief Declares utility functions used within MySQL++
+///
+/// None of this is meant to be used outside the library itself.  None
+/// of this is considered part of the library interface.  It is subject
+/// to change at any time, with no notice.
+
+/***********************************************************************
+ Copyright (c) 2009 by Warren Young.  Others may also hold copyrights
+ on code in this file.  See the CREDITS.txt file in the top directory
+ of the distribution for details.
+
+ This file is part of MySQL++.
+
+ MySQL++ is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ MySQL++ is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with MySQL++; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA
+***********************************************************************/
+
+#if !defined(MYSQLPP_UTILITY_H)
+#define MYSQLPP_UTILITY_H
+
+#include <cctype>
+#include <cstring>
+#include <string>
+
+namespace mysqlpp {
+       /// \brief Namespace for holding things used only within MySQL++
+       namespace internal {
+               /// \brief Lowercase a C++ string in place
+               void str_to_lwr(std::string& s);
+
+               /// \brief Copy a C string into a C++ string, lowercasing
+               /// it along the way
+               void str_to_lwr(std::string& ls, const char* mcs);
+       } // end namespace mysqlpp::internal
+} // end namespace mysqlpp
+
+#endif // !defined(MYSQLPP_UTILITY_H)

Modified: trunk/mysql++.bkl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/mysql%2B%2B.bkl?rev=2526&r1=2525&r2=2526&view=diff
==============================================================================
--- trunk/mysql++.bkl (original)
+++ trunk/mysql++.bkl Thu Jun 25 07:59:57 2009
@@ -81,6 +81,7 @@
         lib/transaction.cpp
         lib/type_info.cpp
         lib/uds_connection.cpp
+        lib/utility.cpp
         lib/vallist.cpp
         lib/wnp_connection.cpp
       </sources>


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to