libH/stringconverter.hpp

Go to the documentation of this file.
00001 
00012 /*
00013   
00014   Copyright (c) 2007, Tim Burrell
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
00026   
00027 */
00028 
00029 #ifndef __stringconverter_h
00030 #define __stringconverter_h
00031 
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 #include <string>
00037 #include <sstream>
00038 #include <iostream>
00039 
00041 // Namespace
00043 
00044 namespace H {
00045 
00047 // Class Definition
00049 
00055 template <class T>
00056 bool from_string(T& t, const std::string & s, std::ios_base & (*f) (std::ios_base&)) {
00057         std::istringstream iss(s);
00058         return !(iss >> f >> t).fail();
00059 }
00060 
00067 class stringconverter : public std::string {
00068 public: 
00069         // public functions
00070         
00071         // construction / deconstruction
00072         stringconverter(int Value);
00073         virtual ~stringconverter() throw() ;
00074         
00075         // static public functions
00076         static std::string                      toLower(std::string const & convertee); 
00077         static std::string                      toUpper(std::string const & convertee); 
00078 };
00079 
00081 
00082 }
00083 
00084 #endif // __stringconverter_h

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3