The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
TargetPlatformRepresentation.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: TargetPlatformRepresentation.cs //
6 // Authors: Francisco Ortin - francisco.ortin@gmail.com //
7 // Description: //
8 // Translates the type TargetPlatform to string and vice versa
9 // Used for command line optiones and for the visual IDE
10 // -------------------------------------------------------------------------- //
11 // Create date: 25-01-2007 //
12 // Modification date: 26-03-2007 //
14 
15 using System;
16 using System.Collections.Generic;
17 using System.Text;
18 
19 namespace TargetPlatforms {
20 
22  static string[] names = {"clr", "rrotor"};
23  static TargetPlatform[] platforms = {TargetPlatform.CLR, TargetPlatform.RRotor};
24 
25 
26  // * Singleton
27  private static TargetPlatformRepresentation instance = new TargetPlatformRepresentation();
29  System.Diagnostics.Debug.Assert(names.Length==platforms.Length);
30  for (int i=0;i<names.Length;i++) {
31  this.representations[platforms[i]] = names[i];
32  this.platformsFromName[names[i]] = platforms[i];
33  }
34  }
36  get { return instance; }
37  }
38 
42  private IDictionary<TargetPlatform, string> representations = new Dictionary<TargetPlatform, string>();
43 
47  private IDictionary<string,TargetPlatform> platformsFromName = new Dictionary<string,TargetPlatform>();
48 
54  public string getRepresentation(TargetPlatform targetPlatform) {
55  return this.representations[targetPlatform];
56  }
57 
58  public TargetPlatform getPlatformFromName(string name) {
59  return this.platformsFromName[name];
60  }
61 
62 
63  }
64 
65 }
string getRepresentation(TargetPlatform targetPlatform)
Gets the command line command of each target platform