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
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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 }
00063
00064
00065 #endif //GPSTK_NUMBERPARSER_HPP
00066