X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=logger%2Flexical_cast.h;fp=logger%2Flexical_cast.h;h=54c92c7dd65b65397678ea75c3d94e3efc9f4112;hb=6a681aed36006908c8a65ccd3de2fc599af9b46b;hp=26d4b90f6d4efd12579f1ab24c7408fef7d9caa7;hpb=912e3f8b32ed8c2ff77f59c09e03d01d45ad7189;p=ultramonkey-l7%2Fsslproxy.git diff --git a/logger/lexical_cast.h b/logger/lexical_cast.h index 26d4b90..54c92c7 100644 --- a/logger/lexical_cast.h +++ b/logger/lexical_cast.h @@ -1,54 +1,54 @@ -/* - * @file lexical_cast.h - * - * L7VSD: Linux Virtual Server for Layer7 Load Balancing - * Copyright (C) 2008 NTT COMWARE Corporation. - * - * This program 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. - * - * This program 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 this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - **********************************************************************/ - -#ifndef __LEXICAL_CAST_H__ -#define __LEXICAL_CAST_H__ - -#include -#include - -namespace l7vs -{ - class bad_lexical_cast : public std::bad_cast - { - public: - bad_lexical_cast() {} - }; - - template - T lexical_cast(const std::string& s) - { - std::stringstream ss; - T d; - ss << s.c_str(); - while( !ss.eof() ){ - ss >> d; - if(ss.fail()) { - throw bad_lexical_cast(); - } - } - return d; - } -} - -#endif //__LEXICAL_CAST_H__ +/* + * @file lexical_cast.h + * + * L7VSD: Linux Virtual Server for Layer7 Load Balancing + * Copyright (C) 2008 NTT COMWARE Corporation. + * + * This program 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. + * + * This program 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + **********************************************************************/ + +#ifndef __LEXICAL_CAST_H__ +#define __LEXICAL_CAST_H__ + +#include +#include + +namespace l7vs +{ + class bad_lexical_cast : public std::bad_cast + { + public: + bad_lexical_cast() {} + }; + + template + T lexical_cast(const std::string& s) + { + std::stringstream ss; + T d; + ss << s.c_str(); + while( !ss.eof() ){ + ss >> d; + if(ss.fail()) { + throw bad_lexical_cast(); + } + } + return d; + } +} + +#endif //__LEXICAL_CAST_H__