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: f0e9d52d4b94038a7b96ad56c8b6def543703a2a (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/// @author Siarhei Rachytski
#pragma once

#include "defines.hpp"

#include "../geometry/rect2d.hpp"
#include "../std/list.hpp"
#include "../std/shared_ptr.hpp"

/// @example
/// <?xml version="1.0" ?>
/// <skin>
///	<texture id="0" height="512" width="512" file="basic.png">
///		<fontStyle charID="-1" xAdvance="17" xOffset="-1" yOffset="-7">
///			<resourceStyle height="29" width="18" x="152" y="93"/>
///		</fontStyle>
///   ...
///		<fontStyle charID="35" xAdvance="23" xOffset="0" yOffset="-2">
///			<resourceStyle height="25" width="23" x="537" y="171"/>
///		</fontStyle>
/// </texture>
/// <texture id="1" height="512" width="512" file="dejavu-sans-12pt.png">
/// ...
/// </texture>
/// </skin>

namespace graphics
{
  namespace gl
  {
    class BaseTexture;
  }

  class ResourceManager;
  class ResourceCache;
  struct Resource;

  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;
    m2::RectU m_texRect;

    /// pointStyle-specific parameters
    string m_resID;

    /// skin-page specific parameters
    string m_fileName;

    shared_ptr<ResourceManager> m_resourceManager;

    /// skin-specific parameters

    vector<shared_ptr<ResourceCache> > & m_caches;


    typedef list<pair<int32_t, shared_ptr<Resource> > > TResourceList;

    TResourceList m_resourceList;

  public:

    SkinLoader(shared_ptr<ResourceManager> const & resourceManager,
               vector<shared_ptr<ResourceCache> > & caches);

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

    void popIcon();
    void popSkin();
    void pushPage();
    void popPage();

    void pushResource();
    void popResource();

    vector<shared_ptr<ResourceCache> > const & caches();
  };
}