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

« back to all changes in this revision

Viewing changes to Wrappers/DoxygenWrapper/DoxygenWrapper/Wrappers/Replacers/EventReplacer.cs

  • 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
using System;
 
2
using System.Collections.Generic;
 
3
using System.Text;
 
4
using DoxygenWrapper.Wrappers.Interfaces;
 
5
using DoxygenWrapper.Wrappers.Compounds;
 
6
using DoxygenWrapper.Wrappers.Types;
 
7
using DoxygenWrapper.Wrappers.Compounds.Types;
 
8
 
 
9
namespace DoxygenWrapper.Wrappers.Replacers
 
10
{
 
11
        public class EventReplacer :
 
12
                IReplacer
 
13
        {
 
14
                public EventReplacer(CompoundVariable _variable)
 
15
                {
 
16
                        mReplace["DelegateName"] = _variable.EventName;
 
17
 
 
18
                        CompoundType eventType = CompoundUtility.GetEventType(_variable);
 
19
 
 
20
                        int index = 1;
 
21
                        foreach (var type in eventType.TemplateTypes)
 
22
                        {
 
23
                                mReplace["OriginalTypeName" + index.ToString()] = type.TypeName;
 
24
                                mReplace["ValueName" + index.ToString()] = GetValueName(index - 1, _variable.ValueNames);
 
25
 
 
26
                                TypeInfo parameInfo = WrapperManager.Instance.GetTypeInfo(type.TypeName);
 
27
                                if (parameInfo != null)
 
28
                                {
 
29
                                        foreach (var value in parameInfo.Values)
 
30
                                                mReplace[value.First + index.ToString()] = value.Second;
 
31
                                }
 
32
 
 
33
                                index++;
 
34
                        }
 
35
                }
 
36
 
 
37
                private string GetValueName(int _index, List<string> _values)
 
38
                {
 
39
                        if (_index < _values.Count)
 
40
                                return _values[_index];
 
41
                        return string.Format("_value{0}", _index + 1);
 
42
                }
 
43
 
 
44
                public string Replace(string _tag)
 
45
                {
 
46
                        string result = null;
 
47
                        if (mReplace.TryGetValue(_tag, out result))
 
48
                                return result;
 
49
                        return "";
 
50
                }
 
51
 
 
52
                private Dictionary<string, string> mReplace = new Dictionary<string, string>();
 
53
        }
 
54
}