NumberParser.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: NumberParser.hpp 2938 2011-10-23 19:39:11Z yanweignss $"
00002 
00008 #ifndef GPSTK_NUMBERPARSER_HPP
00009 #define GPSTK_NUMBERPARSER_HPP
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //
00029 //  Wei Yan - Chinese Academy of Sciences . 2011
00030 //
00031 //============================================================================
00032 
00033 #include <iostream>
00034 #include <string>
00035 
00036 namespace gpstk
00037 {
00038    class NumberParser     
00039    {
00040    public:
00041       
00042       static int parse(const std::string& s);
00043 
00044       static bool tryParse(const std::string& s, int& value);
00045 
00046       static unsigned parseUnsigned(const std::string& s);
00047 
00048       static bool tryParseUnsigned(const std::string& s, unsigned& value);
00049 
00050       static unsigned parseHex(const std::string& s);
00051 
00052       static bool tryParseHex(const std::string& s, unsigned& value);
00053 
00054       static double parseFloat(const std::string& s);
00055 
00056       static bool tryParseFloat(const std::string& s, double& value);
00057       
00058    protected:
00059       NumberParser(){}
00060    };
00061    
00062 }   // End of namespace gpstk
00063 
00064 
00065 #endif  //GPSTK_NUMBERPARSER_HPP
00066 

Generated on Tue May 22 03:31:00 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1