Welcome to mirror list, hosted at ThFree Co, Russian Federation.

skin_loader.hpp « graphics - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44b0714a76723ea36dd1fff2e0afad0ee0b117a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/// @author Siarhei Rachytski
#pragma once

#include "geometry/rect2d.hpp"

#include "std/function.hpp"
#include "std/list.hpp"
#include "std/shared_ptr.hpp"

namespace graphics
{
  class SkinLoader
  {
  private:

    enum EMode
    {
      ERoot,
      EPage,
      ESkin,
      EIcon,
      EResource
    };

    list<EMode> m_mode;

    /// resourceStyle-specific parameters
    int32_t m_id;
    uint32_t m_texX;
    uint32_t m_texY;
    uint32_t m_texWidth;
    uint32_t m_texHeight;

    /// pointStyle-specific parameters
    string m_resID;

    /// skin-page specific parameters
    string m_fileName;

  public:

    /// @param _1 - symbol rect on texture. Pixel rect
    /// @param _2 - symbol name. Key on resource search
    /// @param _3 - unique id
    /// @param _4 - texture file name
    using TIconCallback = function<void (m2::RectU const &, string const &, int32_t, string const &)>;

    SkinLoader(TIconCallback const & callback);

    bool Push(string const & element);
    void Pop(string const & element);
    void AddAttr(string const & attribute, string const & value);
    void CharData(string const &) {}

    void popIcon();

  private:
    TIconCallback m_callback;
  };
}