MyGUI
3.2.0
|
00001 00006 /* 00007 This file is part of MyGUI. 00008 00009 MyGUI is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 MyGUI is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 #ifndef __MYGUI_BIINDEX_BASE_H__ 00023 #define __MYGUI_BIINDEX_BASE_H__ 00024 00025 #include "MyGUI_Prerequest.h" 00026 00027 namespace MyGUI 00028 { 00029 00030 class MYGUI_EXPORT BiIndexBase 00031 { 00032 public: 00033 BiIndexBase(); 00034 virtual ~BiIndexBase(); 00035 00036 protected: 00037 size_t getIndexCount() const; 00038 00039 size_t insertItemAt(size_t _index); 00040 00041 size_t removeItemAt(size_t _index); 00042 00043 void removeAllItems(); 00044 00045 // на входе индексы пользователя, на выходе реальные индексы 00046 size_t convertToBack(size_t _index) const; 00047 00048 // на входе индексы реальные, на выходе, то что видит пользователь 00049 size_t convertToFace(size_t _index) const; 00050 00051 // меняет местами два индекса, индексы со стороны пользователя 00052 void swapItemsFaceAt(size_t _index1, size_t _index2); 00053 00054 // меняет местами два индекса, индексы со сторонны данных 00055 void swapItemsBackAt(size_t _index1, size_t _index2); 00056 00057 #if MYGUI_DEBUG_MODE == 1 00058 void checkIndexes(); 00059 #endif 00060 00061 private: 00062 typedef std::vector<size_t> VectorSizeT; 00063 00064 // маппинг с индексов, которые видны наружу 00065 // на индексы которые реально используются данными 00066 VectorSizeT mIndexFace; 00067 00068 // маппинг с индексов, которые используют данные 00069 // на индексы которые виндны наружу 00070 VectorSizeT mIndexBack; 00071 }; 00072 00073 } // namespace MyGUI 00074 00075 #endif // __MYGUI_BIINDEX_BASE_H__