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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mitab_indfile.cpp

?? mitab,讀取MapInfo的地圖文件
?? CPP
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):

    // m_poDataBlock is now positioned at the beginning of the key entries

    return 0;
}


/**********************************************************************
 *                   TABINDNode::GotoNodePtr()
 *
 * Move to the specified node ptr, and read the new node data from the file.
 *
 * This is just a cover funtion on top of InitNode()
 **********************************************************************/
int TABINDNode::GotoNodePtr(GInt32 nNewNodePtr)
{
    // First flush current changes if any.
    if ((m_eAccessMode == TABWrite || m_eAccessMode == TABReadWrite) && 
        m_poDataBlock && m_poDataBlock->CommitToFile() != 0)
        return -1;

    CPLAssert(nNewNodePtr % 512 == 0);

    // Then move to the requested location.
    return InitNode(m_fp, nNewNodePtr, m_nKeyLength, m_nSubTreeDepth, 
                    m_bUnique);
}

/**********************************************************************
 *                   TABINDNode::ReadIndexEntry()
 *
 * Read the key value and record/node ptr for the specified index entry
 * inside the current node data.
 *
 * nEntryNo is the 0-based index of the index entry that we are interested
 * in inside the current node.
 *
 * Returns the record/node ptr, and copies the key value inside the
 * buffer pointed to by *pKeyValue... this assumes that *pKeyValue points
 * to a buffer big enough to hold the key value (m_nKeyLength bytes).
 * If pKeyValue == NULL, then this parameter is ignored and the key value
 * is not copied.
 **********************************************************************/
GInt32 TABINDNode::ReadIndexEntry(int nEntryNo, GByte *pKeyValue)
{
    GInt32 nRecordPtr = 0;
    if (nEntryNo >= 0 && nEntryNo < m_numEntriesInNode)
    {
        if (pKeyValue)
        {
            m_poDataBlock->GotoByteInBlock(12 + nEntryNo*(m_nKeyLength+4));
            m_poDataBlock->ReadBytes(m_nKeyLength, pKeyValue);
        }
        else
        {
            m_poDataBlock->GotoByteInBlock(12 + nEntryNo*(m_nKeyLength+4)+
                                                                 m_nKeyLength);
        }

        nRecordPtr = m_poDataBlock->ReadInt32();
    }

    return nRecordPtr;
}

/**********************************************************************
 *                   TABINDNode::IndexKeyCmp()
 *
 * Compare the specified index entry with the key value, and 
 * return 0 if equal, an integer less than 0 if key is smaller than 
 * index entry, and an integer greater than 0 if key is bigger than 
 * index entry.
 *
 * nEntryNo is the 0-based index of the index entry that we are interested
 * in inside the current node.
 **********************************************************************/
int   TABINDNode::IndexKeyCmp(GByte *pKeyValue, int nEntryNo)
{
    CPLAssert(pKeyValue);
    CPLAssert(nEntryNo >= 0 && nEntryNo < m_numEntriesInNode);

    m_poDataBlock->GotoByteInBlock(12 + nEntryNo*(m_nKeyLength+4));

    return memcmp(pKeyValue, m_poDataBlock->GetCurDataPtr(), m_nKeyLength);
}

/**********************************************************************
 *                   TABINDNode::SetFieldType()
 *
 * Sets the field type for the current index and recursively set all 
 * children as well.
 * This information will then be used in building the key values, etc.
 *
 * Returns 0 on success, -1 on error.
 **********************************************************************/
int TABINDNode::SetFieldType(TABFieldType eType)
{
    if (m_fp == NULL)
    {
        CPLError(CE_Failure, CPLE_AssertionFailed,
                 "TABINDNode::SetFieldType(): File has not been opened yet!");
        return -1;
    }

    /*-----------------------------------------------------------------
     * Validate field type with key length
     *----------------------------------------------------------------*/
    if ((eType == TABFInteger && m_nKeyLength != 4) ||
        (eType == TABFSmallInt && m_nKeyLength != 2) ||
        (eType == TABFFloat && m_nKeyLength != 8) ||
        (eType == TABFDecimal && m_nKeyLength != 8) ||
        (eType == TABFDate && m_nKeyLength != 4) ||
        (eType == TABFTime && m_nKeyLength != 4) ||
        (eType == TABFDateTime && m_nKeyLength != 8) ||
        (eType == TABFLogical && m_nKeyLength != 4) )
    {
        CPLError(CE_Failure, CPLE_IllegalArg,
                 "Index key length (%d) does not match field type (%s).",
                 m_nKeyLength, TABFIELDTYPE_2_STRING(eType) );
        return -1;
    }           
    
    m_eFieldType = eType;

    /*-----------------------------------------------------------------
     * Pass the field type info to child nodes
     *----------------------------------------------------------------*/
    if (m_poCurChildNode)
        return m_poCurChildNode->SetFieldType(eType);

    return 0;
}

/**********************************************************************
 *                   TABINDNode::FindFirst()
 *
 * Start a new search in this node and its children for a key value.
 * If the index is not unique, then FindNext() can be used to return
 * the other values that correspond to the key.
 *
 * Return value:
 *  - the key's corresponding record number in the .DAT file (greater than 0)
 *  - 0 if the key was not found
 *  - or -1 if an error happened
 **********************************************************************/
GInt32 TABINDNode::FindFirst(GByte *pKeyValue)
{
    if (m_poDataBlock == NULL)
    {
        CPLError(CE_Failure, CPLE_AssertionFailed,
                 "TABINDNode::Search(): Node has not been initialized yet!");
        return -1;
    }

    /*-----------------------------------------------------------------
     * Unless something has been broken, this method will be called by our
     * parent node after it has established that we are the best candidate
     * to contain the first instance of the key value.  So there is no
     * need to look in the previous or next nodes in the chain... if the
     * value is not found in the current node block then it is not present
     * in the index at all.
     *
     * m_nCurIndexEntry will be used to keep track of the search pointer
     * when FindNext() will be used.
     *----------------------------------------------------------------*/
    m_nCurIndexEntry = 0;

    if (m_nSubTreeDepth == 1)
    {
        /*-------------------------------------------------------------
         * Leaf node level... we look for an exact match
         *------------------------------------------------------------*/
        while(m_nCurIndexEntry < m_numEntriesInNode)
        {
            int nCmpStatus = IndexKeyCmp(pKeyValue, m_nCurIndexEntry);
            if (nCmpStatus > 0)
            {
                /* Not there yet... (pKey > IndexEntry) */
                m_nCurIndexEntry++;
            }
            else if (nCmpStatus == 0)
            {
                /* Found it!  Return the record number */
                return ReadIndexEntry(m_nCurIndexEntry, NULL);
            }
            else
            {
                /* Item does not exist... return 0 */
                return 0;
            }
        }
    }
    else
    {
        /*-------------------------------------------------------------
         * Index Node: Find the child node that is the best candidate to
         * contain the value
         *
         * In the index tree at the node level, for each node entry inside
         * the parent node, the key value (in the parent) corresponds to 
         * the value of the first key that you will find when you access
         * the corresponding child node.
         *
         * This means that to find the child that contains the searched
         * key, we look for the first index key >= pKeyValue and the child
         * node that we are looking for is the one that precedes it.
         *
         * If the first key in the list is >= pKeyValue then this means
         * that the pKeyValue does not exist in our children and we just
         * return 0.  We do not bother searching the previous node at the
         * same level since this is the responsibility of our parent.
         *
         * The same way if the last indexkey in this node is < pKeyValue
         * we won't bother searching the next node since this should also
         * be taken care of by our parent.
         *------------------------------------------------------------*/
        while(m_nCurIndexEntry < m_numEntriesInNode)
        {
            int nCmpStatus = IndexKeyCmp(pKeyValue, m_nCurIndexEntry);

            if (nCmpStatus > 0 && m_nCurIndexEntry+1 < m_numEntriesInNode)
            {
                /* Not there yet... (pKey > IndexEntry) */
                m_nCurIndexEntry++;
            }
            else
            {
                /*-----------------------------------------------------
                 * We either found an indexkey >= pKeyValue or reached 
                 * the last entry in this node... still have to decide 
                 * what we're going to do... 
                 *----------------------------------------------------*/
                if (nCmpStatus < 0 && m_nCurIndexEntry == 0)
                {
                    /*-------------------------------------------------
                     * First indexkey in block is > pKeyValue...
                     * the key definitely does not exist in our children.
                     * However, we still want to drill down the rest of the
                     * tree because this function is also used when looking
                     * for a node to insert a new value.
                     *-------------------------------------------------*/
                    // Nothing special to do... just continue processing.
                }

                /*-----------------------------------------------------
                 * If we found an node for which pKeyValue < indexkey 
                 * (or pKeyValue <= indexkey for non-unique indexes) then 
                 * we access the preceding child node.
                 *
                 * Note that for indexkey == pKeyValue in non-unique indexes
                 * we also check in the preceding node because when keys
                 * are not unique then there are chances that the requested
                 * key could also be found at the end of the preceding node.
                 * In this case, if we don't find the key in the preceding
                 * node then we'll do a second search in the current node.
                 *----------------------------------------------------*/
                int numChildrenToVisit=1;
                if (m_nCurIndexEntry > 0 &&
                    (nCmpStatus < 0 || (nCmpStatus==0 && !m_bUnique)) )
                {
                    m_nCurIndexEntry--;
                    if (nCmpStatus == 0)
                        numChildrenToVisit = 2;
                }

                /*-----------------------------------------------------
                 * OK, now it's time to load/access the candidate child nodes.
                 *----------------------------------------------------*/
                int nRetValue = 0;
                for(int iChild=0; nRetValue==0 && 
                                  iChild<numChildrenToVisit; iChild++)
                {
                    // If we're doing a second pass then jump to next entry
                    if (iChild > 0)
                        m_nCurIndexEntry++;

                    int nChildNodePtr = ReadIndexEntry(m_nCurIndexEntry, NULL);
                    if (nChildNodePtr == 0)
                    {
                        /* Invalid child node??? */
                        nRetValue = 0;
                        continue;
                    }
                    else if (m_poCurChildNode == NULL)
                    {
                        /* Child node has never been initialized...do it now!*/

                        m_poCurChildNode = new TABINDNode(m_eAccessMode);
                        if ( m_poCurChildNode->InitNode(m_fp, nChildNodePtr, 
                                                        m_nKeyLength, 
                                                        m_nSubTreeDepth-1,
                                                        m_bUnique,
                                                        m_poBlockManagerRef, 
                                                        this) != 0 ||
                             m_poCurChildNode->SetFieldType(m_eFieldType)!=0)
                        {
                            // An error happened... and was already reported
                            return -1;
                        }
                    }

                    if (m_poCurChildNode->GotoNodePtr(nChildNodePtr) != 0)
                    {
                        // An error happened and has already been reported
                        return -1;
                    }

                    nRetValue = m_poCurChildNode->FindFirst(pKeyValue);
                }/*for iChild*/

                return nRetValue;

            }/*else*/

        }/*while numEntries*/

        // No node was found that contains the key value.
        // We should never get here... only leaf nodes should return 0
        CPLAssert(FALSE);
        return 0;
    }

    return 0;  // Not found
}

/**********************************************************************
 *                   TABINDNode::FindNext()
 *
 * Continue the search previously started by FindFirst() in this node 
 * and its children for a key value.
 *
 * Return value:
 *  - the key's corresponding record number in the .DAT file (greater than 0)
 *  - 0 if the key was not found
 *  - or -1 if an error happened
 **********************************************************************/
GInt32 TABINDNode::FindNext(GByte *pKeyValue)
{
    if (m_poDataBlock == NULL)
    {

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区视频导航| 亚洲国产日韩精品| www.av亚洲| 欧美日韩国产高清一区二区三区| 奇米亚洲午夜久久精品| 久久精品人人做| 91视频91自| 麻豆国产一区二区| 亚洲图片另类小说| 91精品一区二区三区久久久久久 | 99riav一区二区三区| 青青草视频一区| 亚洲精品国产精品乱码不99| 久久久影院官网| 欧美tk丨vk视频| 欧美日韩专区在线| 一本大道综合伊人精品热热| 国产宾馆实践打屁股91| 久久国产视频网| 日韩精品乱码免费| 亚洲综合久久久| 成人免费一区二区三区视频| www日韩大片| 欧美不卡激情三级在线观看| 欧美性感一区二区三区| 91丨porny丨户外露出| 国产九九视频一区二区三区| 精品在线播放午夜| 男人的天堂亚洲一区| 天堂成人国产精品一区| 一区二区三区视频在线看| 国产精品超碰97尤物18| 欧美激情一区二区三区全黄| 久久嫩草精品久久久久| 日韩欧美卡一卡二| 日韩亚洲欧美综合| 日韩欧美综合一区| 日韩免费观看高清完整版| 91精品蜜臀在线一区尤物| 91麻豆精品91久久久久久清纯 | 欧美在线视频日韩| 在线观看不卡视频| 欧洲av一区二区嗯嗯嗯啊| 91极品美女在线| 91国偷自产一区二区使用方法| 91麻豆免费在线观看| 91丝袜美腿高跟国产极品老师| 91在线精品一区二区| 91日韩一区二区三区| 欧美最新大片在线看| 欧美性猛交xxxx乱大交退制版| 欧美情侣在线播放| 91精品免费在线| 久久一日本道色综合| 国产欧美精品一区二区三区四区| 国产亚洲精品bt天堂精选| 国产精品乱码一区二三区小蝌蚪| 国产精品视频你懂的| 亚洲美女在线国产| 视频一区欧美日韩| 狠狠狠色丁香婷婷综合激情 | 日本成人在线看| 国产一区免费电影| 不卡在线视频中文字幕| 色婷婷综合久久久久中文| 欧美中文字幕一区二区三区| 91精品国产免费| 亚洲精品一区二区三区99| 欧美极品少妇xxxxⅹ高跟鞋 | 美日韩黄色大片| 国产精品123| 91亚洲永久精品| 欧美一区二区三区免费大片 | 日韩视频一区二区三区在线播放| 国产欧美日韩在线观看| 亚洲免费观看高清完整版在线| 日韩激情视频网站| 国产91在线观看丝袜| 欧美亚洲尤物久久| 国产喂奶挤奶一区二区三区| 一区二区三区在线视频免费观看| 久久国产精品色婷婷| 91小视频在线免费看| 日韩一区二区电影在线| 国产精品国产三级国产专播品爱网| 亚洲成av人在线观看| 成人一级片在线观看| 欧美电影影音先锋| 国产精品久久久久9999吃药| 五月激情综合网| fc2成人免费人成在线观看播放| 欧美午夜宅男影院| 国产精品美女久久福利网站| 婷婷成人综合网| av一区二区三区四区| 日韩一区二区三区精品视频| 亚洲码国产岛国毛片在线| 九九久久精品视频| 欧美综合视频在线观看| 久久精品日产第一区二区三区高清版 | 午夜精品一区在线观看| 国产成人综合视频| 91精品国产一区二区三区| 亚洲欧洲99久久| 国产精品一品二品| 日韩亚洲欧美一区| 亚洲 欧美综合在线网络| 成人av网站在线观看免费| 日韩久久精品一区| 日韩高清不卡一区| 欧美在线视频日韩| 亚洲欧美偷拍另类a∨色屁股| 国产伦精品一区二区三区视频青涩 | eeuss鲁片一区二区三区| 欧美不卡在线视频| 日韩高清欧美激情| 欧美影院午夜播放| 亚洲猫色日本管| 99国产精品久| 国产精品福利在线播放| 国产精品中文字幕欧美| 日韩一二三区视频| 蜜桃一区二区三区在线| 欧美肥妇bbw| 日韩电影在线免费| 欧美乱妇23p| 亚洲成a人片综合在线| 在线观看国产一区二区| 亚洲黄色片在线观看| 99精品视频中文字幕| 中文字幕亚洲精品在线观看| 成人免费视频视频| 中文字幕av不卡| 成人爽a毛片一区二区免费| 国产欧美日韩精品a在线观看| 国产福利一区二区三区视频 | 亚洲第一福利视频在线| 欧美综合色免费| 亚洲国产精品欧美一二99| 欧美性欧美巨大黑白大战| 亚洲国产精品一区二区久久恐怖片| 欧美三级中文字幕在线观看| 视频在线观看91| 日韩欧美亚洲国产另类| 极品销魂美女一区二区三区| 欧美va日韩va| 国产.欧美.日韩| 《视频一区视频二区| 色婷婷久久久综合中文字幕| 亚洲欧美日韩国产一区二区三区| 97se狠狠狠综合亚洲狠狠| 亚洲免费资源在线播放| 欧美揉bbbbb揉bbbbb| 无吗不卡中文字幕| 精品成人一区二区| 成人sese在线| 亚洲综合视频在线观看| 欧美一级精品在线| 国产精品一区二区果冻传媒| 国产精品看片你懂得| 在线亚洲人成电影网站色www| 午夜欧美在线一二页| 精品99999| a亚洲天堂av| 午夜欧美在线一二页| 精品欧美一区二区在线观看| 成人免费看的视频| 一区二区三区在线看| 日韩视频123| 99r国产精品| 蜜桃久久av一区| 国产精品欧美经典| 欧美日韩精品电影| 国产一区二区不卡在线| 樱花草国产18久久久久| 欧美一级片在线观看| 成人一区二区三区在线观看| 性做久久久久久| 日本一区二区动态图| 欧美图片一区二区三区| 国产美女av一区二区三区| 亚洲综合色噜噜狠狠| 久久五月婷婷丁香社区| 欧美性大战xxxxx久久久| 国产尤物一区二区在线| 亚洲va国产天堂va久久en| 欧美国产精品久久| 在线观看91精品国产麻豆| a级高清视频欧美日韩| 人人爽香蕉精品| 亚洲日韩欧美一区二区在线| 日韩你懂的在线观看| 色婷婷国产精品久久包臀| 激情综合色丁香一区二区| 亚洲一区免费观看| 国产日韩欧美精品一区| 欧美一区二区三区四区久久| 色综合久久88色综合天天免费| 韩国av一区二区三区在线观看| 一区二区国产视频|