MyGUI  3.2.0
MyGUI_BiIndexBase.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_BIINDEX_BASE_H__
23 #define __MYGUI_BIINDEX_BASE_H__
24 
25 #include "MyGUI_Prerequest.h"
26 
27 namespace MyGUI
28 {
29 
31  {
32  public:
33  BiIndexBase();
34  virtual ~BiIndexBase();
35 
36  protected:
37  size_t getIndexCount() const;
38 
39  size_t insertItemAt(size_t _index);
40 
41  size_t removeItemAt(size_t _index);
42 
43  void removeAllItems();
44 
45  // на входе индексы пользователя, на выходе реальные индексы
46  size_t convertToBack(size_t _index) const;
47 
48  // на входе индексы реальные, на выходе, то что видит пользователь
49  size_t convertToFace(size_t _index) const;
50 
51  // меняет местами два индекса, индексы со стороны пользователя
52  void swapItemsFaceAt(size_t _index1, size_t _index2);
53 
54  // меняет местами два индекса, индексы со сторонны данных
55  void swapItemsBackAt(size_t _index1, size_t _index2);
56 
57 #if MYGUI_DEBUG_MODE == 1
58  void checkIndexes();
59 #endif
60 
61  private:
62  typedef std::vector<size_t> VectorSizeT;
63 
64  // маппинг с индексов, которые видны наружу
65  // на индексы которые реально используются данными
66  VectorSizeT mIndexFace;
67 
68  // маппинг с индексов, которые используют данные
69  // на индексы которые виндны наружу
70  VectorSizeT mIndexBack;
71  };
72 
73 } // namespace MyGUI
74 
75 #endif // __MYGUI_BIINDEX_BASE_H__
#define MYGUI_EXPORT