]> git.mxchange.org Git - simgear.git/blob - simgear/misc/tabbed_values.hxx
MSVC .NET 2003 fix
[simgear.git] / simgear / misc / tabbed_values.hxx
1 #ifndef SG_TABBED_VALUES_HXX
2 #define SG_TABBED_VALUES_HXX
3
4 #include <simgear/compiler.h>
5
6 #include <vector>
7 #include STL_STRING
8
9 SG_USING_STD(vector);
10 SG_USING_STD(string);
11
12 class SGTabbedValues
13 {
14 public:
15         SGTabbedValues(const char* line);
16         
17         string operator[](const unsigned int) const;
18
19         bool isValueAt(const unsigned int) const;
20         
21         double getDoubleAt(const unsigned int) const;
22         char getCharAt(const unsigned int) const;
23         long getLongAt(const unsigned int) const;
24 private:
25         const char* fieldAt(const unsigned int offset) const;
26
27         const char* _line;
28         
29         /** this is first character of each field, if the field is empty
30         it will be the tab character. It is lazily built as needed, so
31         if only the first field is accessed (which is a common case) we
32         don't iterative over the whole line. */
33         mutable vector<char*> _fields;
34 };
35
36 #endif