| 62 | |
| 63 | |
| 64 | bool cProbabDistrib::SetDefString(const AString & a_DefString) |
| 65 | { |
| 66 | AStringVector Points = StringSplitAndTrim(a_DefString, ";"); |
| 67 | if (Points.empty()) |
| 68 | { |
| 69 | return false; |
| 70 | } |
| 71 | cPoints Pts; |
| 72 | for (AStringVector::const_iterator itr = Points.begin(), end = Points.end(); itr != end; ++itr) |
| 73 | { |
| 74 | AStringVector Split = StringSplitAndTrim(*itr, ","); |
| 75 | if (Split.size() != 2) |
| 76 | { |
| 77 | // Bad format |
| 78 | return false; |
| 79 | } |
| 80 | int Value = atoi(Split[0].c_str()); |
| 81 | int Prob = atoi(Split[1].c_str()); |
| 82 | if ( |
| 83 | ((Value == 0) && (Split[0] != "0")) || |
| 84 | ((Prob == 0) && (Split[1] != "0")) |
| 85 | ) |
| 86 | { |
| 87 | // Number parse error |
| 88 | return false; |
| 89 | } |
| 90 | Pts.push_back(cPoint(Value, Prob)); |
| 91 | } // for itr - Points[] |
| 92 | |
| 93 | SetPoints(Pts); |
| 94 | return true; |
| 95 | } |
| 96 | |
| 97 | |
| 98 |
no test coverage detected