亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? utils.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
/*
 * 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 General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */

#include <stdio.h>
#include <windows.h>
#include <Winbase.h>
#include <tchar.h>

#include "base/Log.h"
#include "base/util/utils.h"
#include "base/base64.h"

#include "pim/Utils.h"

#include "pim/SettingFunctions.h"

#include "spdm/ManagementNode.h"
#include "spdm/DMTree.h"
#include "spdm/DMTreeFactory.h"
#include "base/quoted-printable.h"
#include "spds/DataTransformerFactory.h"
#include "spds/DataTransformer.h"
#include "pim/ClientSettings.h"
#include "pim/OutlookApp.h"
#include "localizationUtils.h"
#ifdef WIN32_PLATFORM_WFSP
#include "funresourcesp.h"
#endif
#ifdef WIN32_PLATFORM_PSPC
#include "funresourceppc.h"
#endif


// Timezones that are changing their rule in 2007
#define TZ_EASTERN_US TEXT("Eastern Standard Time")
#define TZ_CENTRAL_US TEXT("Central Standard Time")
#define TZ_MOUNTAIN TEXT("Mountain Standard Time")
#define TZ_PACIFIC_US TEXT("Pacific Standard Time")
#define TZ_ALASKA TEXT("Alaska Standard Time")


// DST conversion items
#define IS_LEAP_YEAR(y) (((y) & 3) == 0)

#define BASE_DOW          4                  // 1/1/1970 was a Thursday.
#define SECONDS_IN_A_DAY  (24L * 60L * 60L)  // Number of seconds in one day.

// Month to Year Day conversion array.
static int M2YD[] = {
   0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};
// Month to Leap Year Day conversion array.
static int M2LYD[] = {
   0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
};

/**
* Changed in 6.0. Now it create a singleton and the first time it is used
* it creates the instance
* Open POOM Application object
*/
IP_OUTLOOK_APP* getOutlookApp() {
    
    OutlookApp* app = OutlookApp::getInstance();

    if (app) {
        return app->getPolApp();
    } else {
        return NULL;
    }
        

    // Initialization and creation IPOutlookApp
    /*
    IPOutlookApp2    *polApp; // outlook app
    HRESULT hr;
    if (FAILED (CoInitializeEx (NULL, 0)))
        return NULL;
    hr = CoCreateInstance (CLSID_Application, NULL, CLSCTX_INPROC_SERVER, IID_IPOutlookApp2, (LPVOID*)&polApp);
    if (FAILED(hr))
        return NULL;
    hr = polApp->Logon (NULL);
    if (FAILED (hr))
        return NULL;       
    
    return polApp;
    */
}

/**
* Deprecated: it doesn't anything now (from 6.0)
* The Outlook Application becomes a singleton to reuse the same object.
* Close POOM Application object.
*/

void releaseOutlookApp(IP_OUTLOOK_APP* polApp) {
    /*
    if (polApp) {
        polApp->Logoff ();
        polApp->Release ();
    }
    */    
}

/*
* It release the Outlook application in the endsync of the Windows Sync Source
*/
void disposeOutlookApp() {
    OutlookApp::dispose();
}


/*
 * TODO: use API method??
 *---------------------------
 * The method extracts the content of a tag into a XML message. It is supposed the
 * message is a valid XML message. It returns NULL in case the tag is not
 * found or the XML fragment is not in the expected form.
 * The returned pointer (if not NULL) is allocated with the new operator and
 * must be discarded with the operator delete.
 *
 * @param xml : the xml fragment
 * @param tag : the tag we want the content
 * @param pos : (OUTPUT) the position just after the closing tag (ignored if NULL)
 *
 */
wchar_t* getElementContent(const wchar_t* xml, wchar_t* tag, unsigned int* pos) {
    wchar_t* p1       = NULL;
    wchar_t* p2       = NULL;
    wchar_t* ret      = NULL;
    BOOL charFound    = FALSE;

    wchar_t openTag[50];
    wchar_t closeTag[50];

    unsigned int xmlLength = wcslen(xml);
    unsigned int l = wcslen(tag);

    if (pos != NULL) {
        *pos = 0;
    }

    wsprintf(openTag, TEXT("<%s>"), tag);
    wsprintf(closeTag, TEXT("</%s>"), tag);

    p1 = wcsstr(xml, openTag);

    if (p1 == NULL) { // tag can have attributes
        //
        // This is abcxyz
        //
        //goto finally;

        // if p1 is null I try to discover the next '>' char to close the tag. If does not exist
        // return NULL

        // try to find "<tagName/>". If found it return null.
        wsprintf(openTag, TEXT("<%s/>"), tag);
        p1 = wcsstr(xml, openTag);

        if (p1 != NULL) {
            ret = new wchar_t[2];
            wsprintf(ret, TEXT(""));
            if (pos != NULL) {
                *pos = p1-xml+l+3;
            }
            goto finally;
        }

        // try to find "<tagName"
        wsprintf(openTag, TEXT("<%s"), tag);
        p1 = wcsstr(xml, openTag);

        if (p1 == NULL) {
            goto finally;
        }

        p1 = p1 + l + 1;   // <body_

        for (unsigned int k = 0; k < xmlLength; k++) { // Suppose max length as the xml string
            p1 = p1 + 1;
            if (*p1 == 0) {
                goto finally;
            }
            else if (*p1 == '>') {
                charFound = TRUE;
                p1 = p1 + 1;
                break;
            }
        }
        if (!charFound)
            goto finally;


    } else {  // tag doesn't have attribute. Original version

        p1 = p1+l+2;

    }

    if (*p1 == 0) {
        //
        // This is abc<tag>\0
        //
        goto finally;
    }

    p2 = wcsstr(p1, closeTag);

    if (p2 == NULL) {
        //
        // This is abc<tag>xyz\0
        //
        goto finally;
    }

    ret = new wchar_t[p2-p1+1];

    wcsncpy(ret, p1, p2-p1);
    ret[p2-p1] = 0;

    if (pos != NULL) {
        *pos = p2-xml+l+3;
    }

finally:

    return ret;

}

/*
* The method is used to convert VARIANT_BOOL type in the same string type
* With variant bool TRUE = -1, FALSE = 0
* Translate in BOOL i which TRUE = 1 and FALSE = 0
* @param localTemp : the variable that contain old and new value
*/

void normalizeBoolean(wchar_t* localTemp) {

    if (wcscmp(localTemp, TEXT("-1")) == 0) {
        wsprintf(localTemp, TEXT("1"));
    } else {
        wsprintf(localTemp, TEXT("0"));
    }
    /*
    if (wcscmp(localTemp, TEXT("-1")) == 0) {
        wsprintf(localTemp, TEXT("True"));
    } else {
        wsprintf(localTemp, TEXT("False"));
    }*/

}

/*
* The method replaces &lt; or &gt; with < or > in server response syncML message.
*
* @param s : the string to be replaced
*/
void replaceAmpLGt(std::wstring &s) {

    int position = 0;

    // search for &lt;
    //position = pos(TEXT("&lt;"), s);
    position = s.find(_T("&lt;"));
    while (position != std::wstring::npos) {
    // del(s, position, 4);
        s.replace(position,4, _T(""));
        // ins(TEXT("<"), s, position);
    s.insert(position, _T("<"), 1);

        // position = pos(TEXT("&lt;"), s);
    position = s.find(_T("&lt;"));
    }
    // now search for &lt;
    position = 0;
    position = s.find(_T("&gt;"));
    while (position != std::wstring::npos) {
        s.replace(position,4,_T(""));
        s.insert(position, _T(">"), 1);
        position = s.find(_T("&gt;"));
    }

}

/*
* The method removes \n from the start if there is.
* The start 1n was a bug that has been fixed in new SyncClient API version.
* It works on original array to save memory.
*
* @param ptr : the array to be modify
*/

void removeStartCarriage(wchar_t** ptr) {

    // if start with CRLF,
    if ( ptr != NULL &&
        *ptr != NULL &&
        (int)((*ptr)[0]) == 13 && (int)((*ptr)[1]) == 10)
        *ptr = &((*ptr)[2]);


}


/*
* The method removes \r\n from the end if there is.
* This method is used to remove carriage\return in reading line from file notes.dat,
* briefcase.dat and favorites.dat.
* So it will be possible compare properly file names retrived by file system
* and these file name
*
* @param ptr : the filename ended with \r\n or \n
*/

void removeEndCarriage(wchar_t** ptr) {
    int length = 0;
    if (*ptr != NULL)
        length = wcslen(*ptr);


    // if end with \n,
    if ( ptr != NULL &&
        *ptr != NULL &&
        (int)((*ptr)[length -1]) == 10)
        (*ptr)[length -1] = 0;

    if (*ptr != NULL)
        length = wcslen(*ptr);

    // if there is also \r
    if ( ptr != NULL &&
        *ptr != NULL &&
        (int)((*ptr)[length -1]) == 13)
        (*ptr)[length -1] = 0;

}

void encodeSpecialChar(std::wstring &s) {

    int position = 0, previousPosition = 0;

    //
    // &
    //
    position = s.find(_T("&"));
    while (position != std::wstring::npos) {
      s.insert(position,_T("&amp;"));
      s.replace(position +5, 1, _T(""));
          position = position + 2;
          //previousPosition = position;

      position = s.find(_T("&"), position); //s[position]

      if (position == std::wstring::npos) {
             break;
        }
    }

    //
    // <
    //
    position = 0;
    previousPosition = 0;
    position = s.find(TEXT("<"));
    while (position != std::wstring::npos) {
      s.insert(position, _T("&lt;"));
      s.replace(position +4, 1, _T(""));
          position = position + 2;
        //previousPosition = position;
        //position = pos(TEXT("<"), &s[position]);
      position = s.find(_T("<"), position); // TODO: !!!!!

    if (position == std::wstring::npos) {
            break;
        }
    }

    //
    // >
    //
    position = 0;
    previousPosition = 0;
    position = s.find(_T(">"));
    while (position != std::wstring::npos) {
      s.insert(position,_T("&gt;"));
      s.replace(position + 4, 1, _T(""));
          position = position + 2;
         //previousPosition = position;
      position = s.find(_T(">"), position);

          if (position == std::wstring::npos) {
            break;
           }
    }

}


void decodeSpecialChar(std::wstring &s) {


    unsigned int position = 0, previousPosition = 0;

    //
    // &
    //
    position = s.find(_T("&amp;"));
    while (position != std::wstring::npos) {
    s.insert(position, _T("&"));
    s.replace(position + 1, 5, _T(""));
        if (position + 1 >= s.length()) {
            position = std::wstring::npos;
            break;
        }
        position = position + 1;
    position = s.find(_T("&amp;"), position);
    if (position == std::wstring::npos) {
            break;
        }
    }

    //
    // <
    //
    position = 0;
    previousPosition = 0;
    position = s.find(_T("&lt;"));
    while (position != std::wstring::npos) {
      s.insert(position, _T("<"));
      s.replace(position +1, 4, _T(""));
          if (position + 1 >= s.length()) {
            position = std::wstring::npos;
            break;
          }
          position = position + 1;
      position = s.find(_T("&lt;"), position);

      if (position == std::wstring::npos) {
            break;
          }
    }

    //
    // >
    //
    position = 0;
    previousPosition = 0;
    position = s.find(_T("&gt;"));
    while (position != std::wstring::npos) {
      s.insert(position, _T(">"));
      s.replace(position + 1, 4, _T(""));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美影院一区二区| 亚洲另类在线一区| 中文字幕一区二区三区精华液| 亚洲女爱视频在线| 久久福利资源站| 欧美午夜理伦三级在线观看| 国产精品萝li| 国产美女在线观看一区| 欧美老女人在线| 亚洲午夜成aⅴ人片| 东方欧美亚洲色图在线| 精品久久国产字幕高潮| 亚洲成av人片在www色猫咪| av资源网一区| 国产色产综合产在线视频| 天天操天天干天天综合网| 91视频在线观看| 中文字幕免费不卡在线| 国产美女av一区二区三区| 欧美tickling挠脚心丨vk| 日韩av网站免费在线| 欧美特级限制片免费在线观看| 中文字幕欧美一区| 成人午夜激情片| 国产欧美精品一区| 国产999精品久久| 国产亚洲精品bt天堂精选| 免费成人av在线| 在线不卡中文字幕| 免费成人在线视频观看| 日韩精品一区二区三区四区视频| 日韩av一级电影| 精品福利一区二区三区免费视频| 免费久久99精品国产| 精品欧美一区二区在线观看| 狠狠色丁香婷综合久久| 久久精品一区二区| 成人av网站免费观看| 日韩久久一区二区| 色综合久久88色综合天天6| 亚洲日本在线天堂| 欧美影院一区二区三区| 日韩电影在线观看一区| 日韩美女天天操| 国产精品一二三在| 中文字幕日韩av资源站| 在线观看日韩av先锋影音电影院| 一区二区三区在线免费视频| 欧美性色黄大片| 久久精品二区亚洲w码| 亚洲精品一区二区三区四区高清| 国产精品一区二区三区乱码| 国产精品日产欧美久久久久| 色久综合一二码| 日本不卡一二三| 国产日韩精品久久久| 国产成人aaa| 亚洲一二三级电影| 欧美大白屁股肥臀xxxxxx| 国产成人亚洲精品青草天美| 亚洲视频一区二区在线| 欧美美女一区二区在线观看| 九九九久久久精品| 亚洲欧美色综合| 欧美一级二级三级蜜桃| 岛国av在线一区| 亚洲国产视频直播| 国产亚洲一区二区三区四区| 日本道色综合久久| 狠狠色丁香婷婷综合| 一区二区三区国产| 久久久久青草大香线综合精品| eeuss国产一区二区三区| 人妖欧美一区二区| 日韩一区欧美一区| 亚洲精品在线三区| 欧美偷拍一区二区| av成人免费在线| 久久99蜜桃精品| 亚洲成人免费观看| 国产精品伦理在线| 精品久久久久久久久久久院品网 | 97se亚洲国产综合在线| 日韩精品五月天| 亚洲激情欧美激情| 中文字幕欧美国产| 久久综合久久综合九色| 欧美美女一区二区| 在线免费观看视频一区| 成人午夜免费视频| 国产一区二区网址| 日本v片在线高清不卡在线观看| 亚洲人成小说网站色在线| 国产欧美一区二区精品性色超碰| 欧美久久久一区| 欧美日韩精品电影| 91激情五月电影| 91蝌蚪porny成人天涯| 国产成人三级在线观看| 久久99久久99小草精品免视看| 午夜成人在线视频| 一区二区三区欧美亚洲| 1024国产精品| 最近日韩中文字幕| 亚洲欧美一区二区在线观看| 国产精品美女一区二区三区| 久久日一线二线三线suv| 日韩欧美一区电影| 欧美一级一区二区| 日韩欧美国产一区在线观看| 日韩欧美色综合| 欧美成人综合网站| 久久亚洲精品国产精品紫薇| 久久―日本道色综合久久| 久久久99精品久久| 久久久国际精品| 国产色产综合色产在线视频 | 成人丝袜高跟foot| 国产成人欧美日韩在线电影| 成人夜色视频网站在线观看| 成人美女在线视频| 91同城在线观看| 色www精品视频在线观看| 在线免费视频一区二区| 欧美日韩一区三区四区| 欧美一区二区三区视频在线| 欧美一级高清片| 国产欧美综合在线观看第十页| 久久这里都是精品| 日本一区二区三区在线不卡| |精品福利一区二区三区| 亚洲成在线观看| 美女诱惑一区二区| 国产aⅴ综合色| 日本久久一区二区三区| 欧美精品自拍偷拍动漫精品| 日韩欧美中文字幕公布| 久久久高清一区二区三区| 亚洲国产精品精华液2区45| 亚洲欧美日韩综合aⅴ视频| 视频一区免费在线观看| 国产综合成人久久大片91| 成人av资源在线| 69堂国产成人免费视频| 久久精品网站免费观看| 一区二区成人在线| 毛片不卡一区二区| a亚洲天堂av| 日韩美女主播在线视频一区二区三区| 久久精品在线观看| 午夜精品在线看| 国产精品资源在线观看| 欧美午夜电影在线播放| 久久精品欧美一区二区三区麻豆| 亚洲日本欧美天堂| 美女脱光内衣内裤视频久久网站| eeuss影院一区二区三区| 91精品国产综合久久蜜臀| 国产精品系列在线| 全国精品久久少妇| 色综合久久久久| 久久久久99精品一区| 日日夜夜一区二区| 99精品视频一区二区| 精品国产乱码久久久久久影片| 亚洲欧美一区二区三区国产精品 | 一本色道**综合亚洲精品蜜桃冫| 日韩一级免费一区| 一级精品视频在线观看宜春院| 美女在线视频一区| 欧美午夜不卡视频| 亚洲欧美另类小说视频| 国产精品影视在线| 日韩一区二区三区高清免费看看| 自拍偷拍欧美精品| 国产很黄免费观看久久| 日韩一级免费一区| 视频一区视频二区中文字幕| 91免费观看国产| 国产精品久久久久三级| 另类专区欧美蜜桃臀第一页| 欧美高清视频一二三区| 亚洲精选免费视频| 99精品偷自拍| 国产精品另类一区| 国产成人综合视频| 亚洲h精品动漫在线观看| 成人av免费在线| 国产欧美日韩在线| 国产乱淫av一区二区三区| 51精品视频一区二区三区| 亚洲男同1069视频| 91小视频免费观看| 一区二区在线观看免费 | 亚洲精品videosex极品| 成人黄色软件下载| 日本一区二区不卡视频| 成人免费毛片片v| 亚洲国产成人自拍| 成人黄动漫网站免费app|