亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲色图丝袜美腿| 亚洲成av人片在线观看| 亚洲国产精品久久久久秋霞影院 | 欧美探花视频资源| 亚洲精品一区二区三区蜜桃下载| 中文字幕久久午夜不卡| 奇米一区二区三区av| 色噜噜狠狠色综合欧洲selulu| 精品女同一区二区| 一区二区三区欧美在线观看| 国产一区二区三区四区五区美女 | 亚洲成av人综合在线观看| 国产精品99久久久久久有的能看| 欧美探花视频资源| 自拍偷拍欧美激情| 成人国产一区二区三区精品| 日韩一区二区三区四区| 亚洲一区二区三区中文字幕在线| 丰满亚洲少妇av| 久久精品免视看| 精品中文字幕一区二区小辣椒| 欧美久久一二区| 亚洲一区二区三区国产| 日本高清不卡视频| 亚洲欧洲综合另类| 成人黄色在线看| 中国色在线观看另类| 国产高清亚洲一区| 久久久久久久久久看片| 韩国av一区二区| 久久只精品国产| 国产在线一区二区综合免费视频| 日韩精品一区二区在线观看| 麻豆精品久久精品色综合| 555夜色666亚洲国产免| 日韩黄色免费网站| 91精品国产91热久久久做人人| 亚洲成a人片在线观看中文| 欧美美女一区二区三区| 日韩国产一二三区| 日韩一区二区三区四区| 久久精工是国产品牌吗| 亚洲精品一区二区三区蜜桃下载 | 精品无码三级在线观看视频| 日韩一区二区三区视频在线观看| 日本麻豆一区二区三区视频| 欧美一级片在线看| 国产一区在线观看视频| 欧美国产一区在线| 91麻豆自制传媒国产之光| 亚洲久草在线视频| 欧美巨大另类极品videosbest| 六月丁香婷婷色狠狠久久| 日韩午夜电影在线观看| 狠狠色狠狠色综合系列| 中文字幕av一区 二区| 色婷婷国产精品| 视频在线在亚洲| 久久久久久久综合色一本| 91麻豆免费看片| 免费高清在线一区| 国产欧美日韩在线| 欧美色精品天天在线观看视频| 日本麻豆一区二区三区视频| 国产嫩草影院久久久久| 欧美亚洲高清一区| 精品一区二区国语对白| 亚洲天堂a在线| 日韩亚洲电影在线| 成人激情免费网站| 日韩成人免费在线| 国产精品国产三级国产| 欧美美女bb生活片| 成人动漫中文字幕| 日韩国产精品91| 亚洲特黄一级片| 精品欧美乱码久久久久久| 色一情一乱一乱一91av| 精品一区二区三区不卡| 亚洲已满18点击进入久久| 精品粉嫩超白一线天av| 日本乱人伦一区| 国产一区二区三区四区五区美女 | 亚洲欧洲av色图| 69久久99精品久久久久婷婷| 9色porny自拍视频一区二区| 日韩精品每日更新| 亚洲欧美成人一区二区三区| 26uuu亚洲| 在线播放欧美女士性生活| 91一区二区三区在线观看| 狠狠色丁香久久婷婷综合_中 | 国产日韩高清在线| 日韩欧美色综合| 在线视频欧美区| 成人美女视频在线看| 久久99久久99| 日韩高清在线电影| 亚洲国产视频在线| 亚洲天堂2014| 国产精品丝袜黑色高跟| 亚洲精品在线三区| 欧美大片在线观看一区二区| 欧美日韩亚洲不卡| 欧美自拍丝袜亚洲| 在线观看视频欧美| 色婷婷av一区二区三区gif| 99久久婷婷国产综合精品| 国产乱子伦视频一区二区三区 | 97精品超碰一区二区三区| 国内精品自线一区二区三区视频| 婷婷成人激情在线网| 亚洲精品中文在线观看| 最新成人av在线| 国产精品进线69影院| 欧美激情一区不卡| 中文字幕在线不卡视频| 国产精品另类一区| 中文一区在线播放| 中文字幕不卡在线观看| 国产精品视频yy9299一区| 欧美国产精品久久| 国产精品嫩草久久久久| 国产精品欧美一区二区三区| 国产精品素人视频| 自拍偷拍国产精品| 亚洲综合免费观看高清完整版| 一区二区三区在线视频观看| 一区二区三区欧美在线观看| 午夜欧美视频在线观看| 日本欧美大码aⅴ在线播放| 麻豆91在线播放免费| 国产精品99久久久久久似苏梦涵| 国产99久久久国产精品潘金网站| 成人av影视在线观看| 色综合咪咪久久| 欧美日韩免费不卡视频一区二区三区| 欧美精品 日韩| 国产日韩三级在线| 亚洲欧洲无码一区二区三区| 亚洲精选视频在线| 免费成人深夜小野草| 国产盗摄视频一区二区三区| 成人av一区二区三区| 欧美午夜片在线观看| 日韩免费高清av| 亚洲人精品午夜| 日本美女一区二区| 成人毛片在线观看| 欧美色视频一区| 2024国产精品| 一区二区三区成人在线视频| 秋霞国产午夜精品免费视频| 国产精品91一区二区| 91国产福利在线| 日韩欧美国产综合一区| 国产精品色婷婷| 天天综合网天天综合色| 成人免费视频免费观看| 欧美美女激情18p| 亚洲色图丝袜美腿| 国产精品77777| 69成人精品免费视频| 国产精品欧美综合在线| 久久99热这里只有精品| 91国产免费观看| 久久久久国产成人精品亚洲午夜| 亚洲午夜成aⅴ人片| 国产乱码字幕精品高清av| 欧美日韩精品三区| 国产精品国产三级国产a| 韩国女主播一区| 正在播放一区二区| 亚洲你懂的在线视频| 高潮精品一区videoshd| 8v天堂国产在线一区二区| 亚洲图片你懂的| 国产成人免费视频网站高清观看视频| 欧洲在线/亚洲| 亚洲啪啪综合av一区二区三区| 黄网站免费久久| 91精品国产欧美一区二区18| 日韩欧美一二三| 一区二区三区国产精品| 成人网男人的天堂| 欧美一卡二卡三卡| 亚洲毛片av在线| 成人黄色网址在线观看| 精品欧美黑人一区二区三区| 亚洲综合精品自拍| 麻豆专区一区二区三区四区五区| 欧美视频一二三区| 国产精品久久久久久久久动漫| 日本va欧美va瓶| 日韩一区二区三区在线视频| 一区二区三区欧美激情| www.av精品| 亚洲色图欧洲色图婷婷| 国产精品1024| 精品剧情v国产在线观看在线|