diff options
| author | Günther Neuwirth <e0626638@student.tuwien.ac.at> | 2009-05-27 16:43:43 +0200 |
|---|---|---|
| committer | Günther Neuwirth <e0626638@student.tuwien.ac.at> | 2009-05-27 16:43:43 +0200 |
| commit | 064eaaed391835d0e0d057466f6f552e43e79bd8 (patch) | |
| tree | 9dd40d61761624f10a83f001425bc35a1dfdfd00 /ue4/mycpu/cmem.h | |
| parent | 26a97259f5a7b066cff2927e88c867fac2aaad87 (diff) | |
| download | ooprog-064eaaed391835d0e0d057466f6f552e43e79bd8.tar.gz ooprog-064eaaed391835d0e0d057466f6f552e43e79bd8.tar.bz2 ooprog-064eaaed391835d0e0d057466f6f552e43e79bd8.zip | |
add cdatset
Diffstat (limited to 'ue4/mycpu/cmem.h')
| -rw-r--r-- | ue4/mycpu/cmem.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ue4/mycpu/cmem.h b/ue4/mycpu/cmem.h index 6b23111..c6b8735 100644 --- a/ue4/mycpu/cmem.h +++ b/ue4/mycpu/cmem.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <sstream> | 13 | #include <sstream> |
| 14 | #include <stdexcept> | 14 | #include <stdexcept> |
| 15 | #include <boost/lexical_cast.hpp> | 15 | #include <boost/lexical_cast.hpp> |
| 16 | #include <boost/algorithm/string.hpp> | ||
| 16 | #ifdef DEBUG | 17 | #ifdef DEBUG |
| 17 | # include <iostream> | 18 | # include <iostream> |
| 18 | # include <iomanip> | 19 | # include <iomanip> |
| @@ -23,7 +24,7 @@ | |||
| 23 | * | 24 | * |
| 24 | * Extends std::vector template for use as memory for CCPU. | 25 | * Extends std::vector template for use as memory for CCPU. |
| 25 | */ | 26 | */ |
| 26 | template <class T> | 27 | template<class T=CDat<int>, int width=0> |
| 27 | class CMem | 28 | class CMem |
| 28 | : public std::vector<T> | 29 | : public std::vector<T> |
| 29 | { | 30 | { |
| @@ -55,7 +56,8 @@ class CMem | |||
| 55 | { | 56 | { |
| 56 | ++i; | 57 | ++i; |
| 57 | std::getline(in, line); | 58 | std::getline(in, line); |
| 58 | 59 | boost::algorithm::trim(line); | |
| 60 | |||
| 59 | /* skip last line if it's empty */ | 61 | /* skip last line if it's empty */ |
| 60 | if (line.empty() && in.eof()) | 62 | if (line.empty() && in.eof()) |
| 61 | break; | 63 | break; |
| @@ -63,8 +65,9 @@ class CMem | |||
| 63 | T value; | 65 | T value; |
| 64 | try | 66 | try |
| 65 | { | 67 | { |
| 66 | if (!line.empty()) | 68 | if (!line.empty()) |
| 67 | value = boost::lexical_cast<T>(line); | 69 | { |
| 70 | value = boost::lexical_cast<T>(line); | ||
| 68 | } | 71 | } |
| 69 | catch(boost::bad_lexical_cast& ex) | 72 | catch(boost::bad_lexical_cast& ex) |
| 70 | { | 73 | { |
