-rw-r--r-- | kabc/vcard/UTCValue.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kabc/vcard/UTCValue.cpp b/kabc/vcard/UTCValue.cpp index 374306c..f35d986 100644 --- a/kabc/vcard/UTCValue.cpp +++ b/kabc/vcard/UTCValue.cpp | |||
@@ -1,108 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
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 <VCardUTCValue.h> | 24 | #include <VCardUTCValue.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 | UTCValue::UTCValue() | 32 | UTCValue::UTCValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | UTCValue::UTCValue(const UTCValue & x) | 37 | UTCValue::UTCValue(const UTCValue & x) |
36 | : Value(x),positive_(x.positive_), hour_(x.hour_), minute_(x.minute_) | 38 | : Value(x),positive_(x.positive_), hour_(x.hour_), minute_(x.minute_) |
37 | 39 | ||
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | UTCValue::UTCValue(const QCString & s) | 43 | UTCValue::UTCValue(const Q3CString & s) |
42 | :Value(s) | 44 | :Value(s) |
43 | { | 45 | { |
44 | } | 46 | } |
45 | 47 | ||
46 | UTCValue & | 48 | UTCValue & |
47 | UTCValue::operator = (UTCValue & x) | 49 | UTCValue::operator = (UTCValue & x) |
48 | { | 50 | { |
49 | if (*this == x) return *this; | 51 | if (*this == x) return *this; |
50 | 52 | ||
51 | positive_ = x.positive_; | 53 | positive_ = x.positive_; |
52 | hour_ = x.hour_; | 54 | hour_ = x.hour_; |
53 | minute_ = x.minute_; | 55 | minute_ = x.minute_; |
54 | 56 | ||
55 | Value::operator = (x); | 57 | Value::operator = (x); |
56 | return *this; | 58 | return *this; |
57 | } | 59 | } |
58 | 60 | ||
59 | UTCValue & | 61 | UTCValue & |
60 | UTCValue::operator = (const QCString & s) | 62 | UTCValue::operator = (const Q3CString & s) |
61 | { | 63 | { |
62 | Value::operator = (s); | 64 | Value::operator = (s); |
63 | return *this; | 65 | return *this; |
64 | } | 66 | } |
65 | 67 | ||
66 | bool | 68 | bool |
67 | UTCValue::operator == (UTCValue & x) | 69 | UTCValue::operator == (UTCValue & x) |
68 | { | 70 | { |
69 | x.parse(); | 71 | x.parse(); |
70 | 72 | ||
71 | if (positive_ != x.positive_) return false; | 73 | if (positive_ != x.positive_) return false; |
72 | if (hour_ != x.hour_) return false; | 74 | if (hour_ != x.hour_) return false; |
73 | if (minute_ != x.minute_) return false; | 75 | if (minute_ != x.minute_) return false; |
74 | 76 | ||
75 | return true; | 77 | return true; |
76 | } | 78 | } |
77 | 79 | ||
78 | UTCValue::~UTCValue() | 80 | UTCValue::~UTCValue() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
82 | UTCValue * | 84 | UTCValue * |
83 | UTCValue::clone() | 85 | UTCValue::clone() |
84 | { | 86 | { |
85 | return new UTCValue( *this ); | 87 | return new UTCValue( *this ); |
86 | } | 88 | } |
87 | 89 | ||
88 | void | 90 | void |
89 | UTCValue::_parse() | 91 | UTCValue::_parse() |
90 | { | 92 | { |
91 | if ( strRep_.isEmpty() ) | 93 | if ( strRep_.isEmpty() ) |
92 | return; | 94 | return; |
93 | 95 | ||
94 | positive_ = ( strRep_[0] == '+' ); | 96 | positive_ = ( strRep_[0] == '+' ); |
95 | 97 | ||
96 | int colon = strRep_.find( ':' ); | 98 | int colon = strRep_.find( ':' ); |
97 | 99 | ||
98 | if ( colon == -1 ) // Not valid. | 100 | if ( colon == -1 ) // Not valid. |
99 | return; | 101 | return; |
100 | 102 | ||
101 | hour_= strRep_.mid( 1, 2 ).toInt(); | 103 | hour_= strRep_.mid( 1, 2 ).toInt(); |
102 | minute_= strRep_.right( 2 ).toInt(); | 104 | minute_= strRep_.right( 2 ).toInt(); |
103 | } | 105 | } |
104 | 106 | ||
105 | void | 107 | void |
106 | UTCValue::_assemble() | 108 | UTCValue::_assemble() |
107 | { | 109 | { |
108 | strRep_.sprintf( "%c%.2i:%.2i", (positive_ ? '+' : '-'), hour_, minute_ ); | 110 | strRep_.sprintf( "%c%.2i:%.2i", (positive_ ? '+' : '-'), hour_, minute_ ); |