summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/DateValue.cpp
Side-by-side diff
Diffstat (limited to 'kabc/vcard/DateValue.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/DateValue.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/kabc/vcard/DateValue.cpp b/kabc/vcard/DateValue.cpp
index c5c5c85..87c7007 100644
--- a/kabc/vcard/DateValue.cpp
+++ b/kabc/vcard/DateValue.cpp
@@ -13,24 +13,26 @@
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include <VCardDefines.h>
#include <VCardDateValue.h>
#include <VCardValue.h>
using namespace VCARD;
DateValue::DateValue()
: Value()
{
@@ -96,40 +98,40 @@ DateValue::DateValue(const DateValue & x)
year_ = x.year_;
month_ = x.month_;
day_ = x.day_;
hour_ = x.hour_;
minute_ = x.minute_;
second_ = x.second_;
zoneHour_ = x.zoneHour_;
zoneMinute_ = x.zoneMinute_;
secFrac_ = x.secFrac_;
hasTime_ = x.hasTime_;
}
-DateValue::DateValue(const QCString & s)
+DateValue::DateValue(const Q3CString & s)
: Value(s)
{
}
DateValue &
DateValue::operator = (DateValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
DateValue &
-DateValue::operator = (const QCString & s)
+DateValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
DateValue::operator == (DateValue & x)
{
x.parse();
return false;
}
@@ -145,116 +147,116 @@ DateValue::clone()
void
DateValue::_parse()
{
vDebug("DateValue::_parse()");
// date = date-full-year ["-"] date-month ["-"] date-mday
// time = time-hour [":"] time-minute [":"] time-second [":"]
// [time-secfrac] [time-zone]
int timeSep = strRep_.find('T');
- QCString dateStr;
- QCString timeStr;
+ Q3CString dateStr;
+ Q3CString timeStr;
if (timeSep == -1) {
dateStr = strRep_;
vDebug("Has date string \"" + dateStr + "\"");
} else {
dateStr = strRep_.left(timeSep);
vDebug("Has date string \"" + dateStr + "\"");
timeStr = strRep_.mid(timeSep + 1);
vDebug("Has time string \"" + timeStr + "\"");
}
/////////////////////////////////////////////////////////////// DATE
- dateStr.replace(QRegExp("-"), "");
+ dateStr.replace("-", "");
kdDebug(5710) << "dateStr: " << dateStr << endl;
year_ = dateStr.left(4).toInt();
month_ = dateStr.mid(4, 2).toInt();
day_ = dateStr.right(2).toInt();
if (timeSep == -1) {
hasTime_ = false;
return; // No time, done.
}
else
hasTime_ = true;
/////////////////////////////////////////////////////////////// TIME
/////////////////////////////////////////////////////////////// ZONE
int zoneSep = timeStr.find('Z');
if (zoneSep != -1 && timeStr.length() - zoneSep > 3) {
- QCString zoneStr(timeStr.mid(zoneSep + 1));
+ Q3CString zoneStr(timeStr.mid(zoneSep + 1));
vDebug("zoneStr == " + zoneStr);
zonePositive_ = (zoneStr[0] == '+');
zoneHour_ = zoneStr.mid(1, 2).toInt();
zoneMinute_ = zoneStr.right(2).toInt();
timeStr.remove(zoneSep, timeStr.length() - zoneSep);
}
//////////////////////////////////////////////////// SECOND FRACTION
int secFracSep = timeStr.findRev(',');
if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors.
- QCString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep);
+ Q3CString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep);
secFrac_ = quirkafleeg.toDouble();
}
/////////////////////////////////////////////////////////////// HMS
- timeStr.replace(QRegExp(":"), "");
+ timeStr.replace(":", "");
hour_ = timeStr.left(2).toInt();
minute_ = timeStr.mid(2, 2).toInt();
second_ = timeStr.mid(4, 2).toInt();
}
void
DateValue::_assemble()
{
vDebug("DateValue::_assemble");
- QCString year;
- QCString month;
- QCString day;
+ Q3CString year;
+ Q3CString month;
+ Q3CString day;
year.setNum( year_ );
month.setNum( month_ );
day.setNum( day_ );
if ( month.length() < 2 ) month.prepend( "0" );
if ( day.length() < 2 ) day.prepend( "0" );
strRep_ = year + '-' + month + '-' + day;
if ( hasTime_ ) {
- QCString hour;
- QCString minute;
- QCString second;
+ Q3CString hour;
+ Q3CString minute;
+ Q3CString second;
hour.setNum( hour_ );
minute.setNum( minute_ );
second.setNum( second_ );
if ( hour.length() < 2 ) hour.prepend( "0" );
if ( minute.length() < 2 ) minute.prepend( "0" );
if ( second.length() < 2 ) second.prepend( "0" );
strRep_ += 'T' + hour + ':' + minute + ':' + second + 'Z';
}
}