author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/vcard/FloatValue.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/vcard/FloatValue.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kabc/vcard/FloatValue.cpp b/kabc/vcard/FloatValue.cpp index 15bb664..7065081 100644 --- a/kabc/vcard/FloatValue.cpp +++ b/kabc/vcard/FloatValue.cpp | |||
@@ -11,72 +11,74 @@ | |||
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardFloatValue.h> | 24 | #include <VCardFloatValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | FloatValue::FloatValue() | 32 | FloatValue::FloatValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | FloatValue::FloatValue(float f) | 37 | FloatValue::FloatValue(float f) |
36 | : Value(), | 38 | : Value(), |
37 | value_(f) | 39 | value_(f) |
38 | { | 40 | { |
39 | parsed_ = true; | 41 | parsed_ = true; |
40 | } | 42 | } |
41 | 43 | ||
42 | FloatValue::FloatValue(const FloatValue & x) | 44 | FloatValue::FloatValue(const FloatValue & x) |
43 | :Value(x) | 45 | :Value(x) |
44 | { | 46 | { |
45 | value_ = x.value_; | 47 | value_ = x.value_; |
46 | } | 48 | } |
47 | 49 | ||
48 | FloatValue::FloatValue(const QCString & s) | 50 | FloatValue::FloatValue(const Q3CString & s) |
49 | :Value(s) | 51 | :Value(s) |
50 | { | 52 | { |
51 | } | 53 | } |
52 | 54 | ||
53 | FloatValue & | 55 | FloatValue & |
54 | FloatValue::operator = (FloatValue & x) | 56 | FloatValue::operator = (FloatValue & x) |
55 | { | 57 | { |
56 | if (*this == x) return *this; | 58 | if (*this == x) return *this; |
57 | 59 | ||
58 | x.parse(); | 60 | x.parse(); |
59 | value_ = x.value_; | 61 | value_ = x.value_; |
60 | 62 | ||
61 | Value::operator = (x); | 63 | Value::operator = (x); |
62 | return *this; | 64 | return *this; |
63 | } | 65 | } |
64 | 66 | ||
65 | FloatValue & | 67 | FloatValue & |
66 | FloatValue::operator = (const QCString & s) | 68 | FloatValue::operator = (const Q3CString & s) |
67 | { | 69 | { |
68 | Value::operator = (s); | 70 | Value::operator = (s); |
69 | return *this; | 71 | return *this; |
70 | } | 72 | } |
71 | 73 | ||
72 | bool | 74 | bool |
73 | FloatValue::operator == (FloatValue & x) | 75 | FloatValue::operator == (FloatValue & x) |
74 | { | 76 | { |
75 | x.parse(); | 77 | x.parse(); |
76 | return (value_ == x.value_); | 78 | return (value_ == x.value_); |
77 | } | 79 | } |
78 | 80 | ||
79 | FloatValue::~FloatValue() | 81 | FloatValue::~FloatValue() |
80 | { | 82 | { |
81 | } | 83 | } |
82 | 84 | ||
@@ -88,33 +90,33 @@ FloatValue::_parse() | |||
88 | if (strRep_[0] == '-' || strRep_[1] == '+') { | 90 | if (strRep_[0] == '-' || strRep_[1] == '+') { |
89 | 91 | ||
90 | if (strRep_[0] == '-') | 92 | if (strRep_[0] == '-') |
91 | negative = true; | 93 | negative = true; |
92 | 94 | ||
93 | strRep_.remove(0, 1); | 95 | strRep_.remove(0, 1); |
94 | } | 96 | } |
95 | 97 | ||
96 | value_ = strRep_.toFloat(); | 98 | value_ = strRep_.toFloat(); |
97 | if (negative) | 99 | if (negative) |
98 | value_ = -value_; | 100 | value_ = -value_; |
99 | } | 101 | } |
100 | 102 | ||
101 | void | 103 | void |
102 | FloatValue::_assemble() | 104 | FloatValue::_assemble() |
103 | { | 105 | { |
104 | strRep_ = QCString().setNum(value_); | 106 | strRep_ = Q3CString().setNum(value_); |
105 | } | 107 | } |
106 | 108 | ||
107 | float | 109 | float |
108 | FloatValue::value() | 110 | FloatValue::value() |
109 | { | 111 | { |
110 | parse(); | 112 | parse(); |
111 | return value_; | 113 | return value_; |
112 | } | 114 | } |
113 | 115 | ||
114 | void | 116 | void |
115 | FloatValue::setValue(float f) | 117 | FloatValue::setValue(float f) |
116 | { | 118 | { |
117 | parsed_ = true; | 119 | parsed_ = true; |
118 | value_ = f; | 120 | value_ = f; |
119 | } | 121 | } |
120 | 122 | ||