source: trunk/lib/utility/utility.h @ 341

Last change on this file since 341 was 341, checked in by Jari Häkkinen, 18 years ago

Added exceptions for tracing file format problems when reading vectors.
Changed implentation for reading ints and doubles into stl vectors, now
unexpected characters are skipped instead of treated as zeros.
Some other minor things.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 843 bytes
Line 
1// $Id: utility.h 341 2005-06-07 14:41:25Z jari $
2
3#ifndef _theplu_utility_utility_
4#define _theplu_utility_utility_
5
6///
7/// \file utility.h
8///
9/// Some useful functions are placed here
10///
11
12#include <string>
13
14namespace theplu {
15namespace utility {
16
17
18  ///
19  /// Function return true if string is a number. A number is defined
20  /// to start with '+', '-' or a digit. It must contain at most one
21  /// decimal point '.'. Also it may contain 'E' or 'e' followed by an
22  /// integer (see is_int).
23  ///
24  /// @return true if string is a number
25  ///
26  /// @todo Make sure all C/C++ style floats are accepted, i.e. .5
27  /// should be accepted.
28  ///
29  bool is_float(const std::string&);
30
31  ///
32  /// @return true if every character in string is a digit except the
33  /// first one that may be '+' or '-'
34  ///
35  bool is_int(const std::string&);
36
37
38}} // of namespace utility and namespace theplu
39
40#endif
Note: See TracBrowser for help on using the repository browser.