~ubuntu-branches/ubuntu/vivid/mygui/vivid

« back to all changes in this revision

Viewing changes to Wrappers/WrapperGenerator/Compound.h

  • Committer: Package Import Robot
  • Author(s): Scott Howard, Bret Curtis, Scott Howard
  • Date: 2014-09-18 17:57:48 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140918175748-dd8va78mvpw1jbes
Tags: 3.2.1-1
[ Bret Curtis ]
* Updated license for majority of files from LGPL to Expat (MIT)

[ Scott Howard ]
* New upstream release
* Updated patch to add build option for system GLEW libraries
* All patches accepted upstream except shared_libraries.patch
* Bumped SONAME due to dropped symbols, updated *.symbols and package
  names
* Updated license of debian/* to Expat with permission of all authors
* Don't install Doxygen autogenerated md5 and map files (thanks
  lintian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*!
2
 
        @file
3
 
        @author         Albert Semenov
4
 
        @date           01/2009
5
 
*/
6
 
#ifndef __COMPOUND_H__
7
 
#define __COMPOUND_H__
8
 
 
9
 
#include "XmlDocument.h"
10
 
 
11
 
namespace wrapper
12
 
{
13
 
 
14
 
        class Compound
15
 
        {
16
 
        public:
17
 
                typedef std::vector<std::string> VectorString;
18
 
                typedef std::pair<std::string, std::string> PairString;
19
 
                typedef std::vector<PairString> VectorPairString;
20
 
                typedef std::vector<Compound*> VectorCompound;
21
 
                typedef utility::Enumerator<VectorCompound> Enumerator;
22
 
 
23
 
        public:
24
 
                Compound() { }
25
 
 
26
 
                Compound(xml::ElementPtr _element, const std::string& _type)
27
 
                {
28
 
                        mType = _type;
29
 
                        mName = getItemName(_element);
30
 
                        mKind = _element->findAttribute("kind");
31
 
                        mId = _element->findAttribute("refid");
32
 
 
33
 
                        xml::ElementEnumerator child_item = _element->getElementEnumerator();
34
 
                        while (child_item.next())
35
 
                        {
36
 
                                if (child_item->getName() == "compound")
37
 
                                        mChilds.push_back(new Compound(child_item.current(), child_item->getName()));
38
 
                                else if (child_item->getName() == "member")
39
 
                                        mChilds.push_back(new Compound(child_item.current(), child_item->getName()));
40
 
                        }
41
 
                }
42
 
 
43
 
                virtual ~Compound()
44
 
                {
45
 
                        Enumerator childs = Enumerator(mChilds.begin(), mChilds.end());
46
 
                        while (childs.next()) delete childs.current();
47
 
                        mChilds.clear();
48
 
                }
49
 
 
50
 
                const std::string& getKind() const
51
 
                {
52
 
                        return mKind;
53
 
                }
54
 
                const std::string& getName() const
55
 
                {
56
 
                        return mName;
57
 
                }
58
 
                const std::string& getId() const
59
 
                {
60
 
                        return mId;
61
 
                }
62
 
                const std::string& getType() const
63
 
                {
64
 
                        return mType;
65
 
                }
66
 
 
67
 
                Enumerator getEnumerator() const
68
 
                {
69
 
                        return Enumerator(mChilds.begin(), mChilds.end());
70
 
                }
71
 
 
72
 
        private:
73
 
                std::string getItemName(xml::ElementPtr _element)
74
 
                {
75
 
                        xml::ElementEnumerator child_item = _element->getElementEnumerator();
76
 
                        while (child_item.next("name"))
77
 
                                return child_item->getContent();
78
 
                        return "";
79
 
                }
80
 
 
81
 
        protected:
82
 
                std::string mName;
83
 
                std::string mKind;
84
 
                std::string mId;
85
 
                std::string mType;
86
 
                VectorCompound mChilds;
87
 
        };
88
 
 
89
 
} // namespace wrapper
90
 
 
91
 
#endif // __COMPOUND_H__