event.cpp

来自「funambol window mobile客户端源代码」· C++ 代码 · 共 959 行 · 第 1/3 页

CPP
959
字号
/*
 * Funambol is a mobile platform developed by Funambol, Inc. 
 * Copyright (C) 2003 - 2007 Funambol, Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by
 * the Free Software Foundation with the addition of the following permission 
 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
 * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License 
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 * 
 * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
 * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Powered by Funambol" logo. If the display of the logo is not reasonably 
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by Funambol".
 */


#include "vocl/iCalendar/Event.h"
#include "base/globalsdef.h"

USE_NAMESPACE

Event::Event() {
    classEvent = NULL;
    created = NULL;
    description = NULL;
    dtStart = NULL;
    geo = NULL;
    lastMod = NULL;
    location = NULL;
    organizer = NULL;
    priority = NULL;
    dtStamp = NULL;
    seq = NULL;
    status = NULL;
    summary = NULL;
    transp = NULL;
    uid = NULL;
    url = NULL;
    recurID = NULL;
    dtEnd = NULL;
    duration = NULL;
    attach = NULL;
    attendee = NULL;
    categories = NULL;
    comment = NULL;
    contact = NULL;
    exDate = NULL;
    exRule = NULL;
    rStatus = NULL;
    related = NULL;
    resources = NULL;
    rDate = NULL;
    rRule = NULL;
    xProp = NULL;

    setProdID(TEXT("VEVENT"));
}

Event::~Event() {
    if (classEvent) {
        delete classEvent; classEvent = NULL;
    }
    if (created) {
        delete created; created = NULL;
    }
    if (description) {
        delete description; description = NULL;
    }
    if (dtStart) {
        delete dtStart; dtStart = NULL;
    }
    if (geo) {
        delete geo; geo = NULL;
    }
    if (lastMod) {
        delete lastMod; lastMod = NULL;
    }
    if (location) {
        delete location; location = NULL;
    }
    if (organizer) {
        delete organizer; organizer = NULL;
    }
    if (priority) {
        delete priority; priority = NULL;
    }
    if (dtStamp) {
        delete dtStamp; dtStamp = NULL;
    }
    if (seq) {
        delete seq; seq = NULL;
    }
    if (status) {
        delete status; status = NULL;
    }
    if (summary) {
        delete summary; summary = NULL;
    }
    if (transp) {
        delete transp; transp = NULL;
    }
    if (uid) {
        delete uid; uid = NULL;
    }
    if (url) {
        delete url; url = NULL;
    }
    if (recurID) {
        delete recurID; recurID = NULL;
    }
    if (dtEnd) {
        delete dtEnd; dtEnd = NULL;
    }
    if (duration) {
        delete duration; duration = NULL;
    }
    if (attach) {
        delete attach; attach = NULL;
    }
    if (attendee) {
        delete attendee; attendee = NULL;
    }
    if (categories) {
        delete categories; categories = NULL;
    }
    if (comment) {
        delete comment; comment = NULL;
    }
    if (contact) {
        delete contact; contact = NULL;
    }
    if (exDate) {
        delete exDate; exDate = NULL;
    }
    if (exRule) {
        delete exRule; exRule = NULL;
    }
    if (rStatus) {
        delete rStatus; rStatus = NULL;
    }
    if (related) {
        delete related; related = NULL;
    }
    if (resources) {
        delete resources; resources = NULL;
    }
    if (rDate) {
        delete rDate; rDate = NULL;
    }
    if (rRule) {
        delete rRule; rRule = NULL;
    }
    if (xProp) {
        delete xProp; xProp = NULL;
    }
}

iCalProperty* Event::getClass() {
    if(!classEvent) {
        if(containsProperty(TEXT("CLASS")) && getProperty(TEXT("CLASS"))->getValue())
           classEvent = getiCalPropertyFromVProperty(getProperty(TEXT("CLASS")));
    }
    return classEvent;
}
iCalProperty* Event::getCreated() {
    if(!created) {
        if(containsProperty(TEXT("CREATED")) && getProperty(TEXT("CREATED"))->getValue())
            created = getiCalPropertyFromVProperty(getProperty(TEXT("CREATED")));
    }
    return created;
}
iCalProperty* Event::getDescription() {
    if(!description) {
        if(containsProperty(TEXT("DESCRIPTION")) && getProperty(TEXT("DESCRIPTION"))->getValue())
            description = getiCalPropertyFromVProperty(getProperty(TEXT("DESCRIPTION")));
    }
    return description;
}
iCalProperty* Event::getDtStart() {
    if(!dtStart) {
        if(containsProperty(TEXT("DTSTART")) && getProperty(TEXT("DTSTART"))->getValue())
            dtStart = getiCalPropertyFromVProperty(getProperty(TEXT("DTSTART")));
    }
    return dtStart;
}
iCalProperty* Event::getGeo() {
    if(!geo) {
        if(containsProperty(TEXT("GEO")) && getProperty(TEXT("GEO"))->getValue())
            geo = getiCalPropertyFromVProperty(getProperty(TEXT("GEO")));
    }
    return geo;
}
iCalProperty* Event::getLastMod() {
    if(!lastMod) {
        if(containsProperty(TEXT("LAST-MODIFIED")) && getProperty(TEXT("LAST-MODIFIED"))->getValue())
            lastMod = getiCalPropertyFromVProperty(getProperty(TEXT("LAST-MODIFIED")));
    }
    return lastMod;
}
iCalProperty* Event::getLocation() {
    if(!location) {
        if(containsProperty(TEXT("LOCATION")) && getProperty(TEXT("LOCATION"))->getValue())
            location = getiCalPropertyFromVProperty(getProperty(TEXT("LOCATION")));
    }
    return location;
}
iCalProperty* Event::getOrganizer() {
    if(!organizer) {
        if(containsProperty(TEXT("ORGANIZER")) && getProperty(TEXT("ORGANIZER"))->getValue())
            organizer = getiCalPropertyFromVProperty(getProperty(TEXT("ORGANIZER")));
    }
    return organizer;
}
iCalProperty* Event::getPriority() {
    if(!priority) {
        if(containsProperty(TEXT("PRIORITY")) && getProperty(TEXT("PRIORITY"))->getValue())
            priority = getiCalPropertyFromVProperty(getProperty(TEXT("PRIORITY")));
    }
    return priority;
}
iCalProperty* Event::getDtStamp() {
    if(!dtStamp) {
        if(containsProperty(TEXT("DTSTAMP")) && getProperty(TEXT("DTSTAMP"))->getValue())
            dtStamp = getiCalPropertyFromVProperty(getProperty(TEXT("DTSTAMP")));
    }
    return dtStamp;
}
iCalProperty* Event::getSequence() {
    if(!seq) {
        if(containsProperty(TEXT("SEQUENCE")) && getProperty(TEXT("SEQUENCE"))->getValue())
            seq = getiCalPropertyFromVProperty(getProperty(TEXT("SEQUENCE")));
    }
    return seq;
}
iCalProperty* Event::getStatus() {
    if(!status) {
        if(containsProperty(TEXT("STATUS")) && getProperty(TEXT("STATUS"))->getValue())
            status = getiCalPropertyFromVProperty(getProperty(TEXT("STATUS")));
    }
    return status;
}
iCalProperty* Event::getSummary() {
    if(!summary) {
        if(containsProperty(TEXT("SUMMARY")) && getProperty(TEXT("SUMMARY"))->getValue())
            summary = getiCalPropertyFromVProperty(getProperty(TEXT("SUMMARY")));
    }
    return summary;
}
iCalProperty* Event::getTransport() {
    if(!transp) {
        if(containsProperty(TEXT("TRANSP")) && getProperty(TEXT("TRANSP"))->getValue())
            transp = getiCalPropertyFromVProperty(getProperty(TEXT("TRANSP")));
    }
    return transp;
}
iCalProperty* Event::getUid() {
    if(!uid) {
        if(containsProperty(TEXT("UID")) && getProperty(TEXT("UID"))->getValue())
            uid = getiCalPropertyFromVProperty(getProperty(TEXT("UID")));
    }
    return uid;
}
iCalProperty* Event::getUrl() {
    if(!url) {
        if(containsProperty(TEXT("URL")) && getProperty(TEXT("URL"))->getValue())
            url = getiCalPropertyFromVProperty(getProperty(TEXT("URL")));
    }
    return url;
}
iCalProperty* Event::getRecurID() {
    if(!recurID) {
        if(containsProperty(TEXT("RECURRENCE-ID")) && getProperty(TEXT("RECURRENCE-ID"))->getValue())
            recurID = getiCalPropertyFromVProperty(getProperty(TEXT("RECURRENCE-ID")));
    }
    return recurID;
}
iCalProperty* Event::getDtEnd() {
    if(!dtEnd) {
        if(containsProperty(TEXT("DTEND")) && getProperty(TEXT("DTEND"))->getValue())
            dtEnd = getiCalPropertyFromVProperty(getProperty(TEXT("DTEND")));
    }
    return dtEnd;
}
iCalProperty* Event::getDuration() {
    if(!duration) {
        if(containsProperty(TEXT("DURATION")) && getProperty(TEXT("DURATION"))->getValue())
           duration = getiCalPropertyFromVProperty(getProperty(TEXT("DURATION")));
    }
    return duration;
}
ArrayList* Event::getAttach() {
    if(!attach)
        for(int i = 0; i < propertiesCount(); i++)
            if(!wcscmp(getProperty(i)->getName(),TEXT("ATTACH")) && getProperty(i)->getValue()) {
                if(!attach)
                    attach = new ArrayList();
                attach->add((ArrayElement&) *getiCalPropertyFromVProperty(getProperty(i)));
            }
    return attach;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?