mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 12:58:39 +00:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Mono.Cecil;
|
|
|
|
namespace Indy.IL2CPU.Assembler {
|
|
public class DataMember {
|
|
public const string IllegalIdentifierChars = "&.,+$<>{}-`\'/\\ ()[]*!";
|
|
public static string GetStaticFieldName(FieldDefinition aField) {
|
|
return FilterStringForIncorrectChars("static_field__" + aField.DeclaringType.FullName + "_" + aField.Name);
|
|
}
|
|
|
|
public static string FilterStringForIncorrectChars(string aName) {
|
|
string xTempResult = aName;
|
|
foreach (char c in IllegalIdentifierChars) {
|
|
xTempResult = xTempResult.Replace(c, '_');
|
|
}
|
|
return xTempResult;
|
|
}
|
|
|
|
public DataMember(string aName, string aDataType, string aDefaultValue) {
|
|
Name = aName;
|
|
DataType = aDataType;
|
|
DefaultValue = aDefaultValue;
|
|
}
|
|
|
|
public string Name {
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public readonly string DataType;
|
|
|
|
public string DefaultValue {
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return Name + " " + DataType + " " + DefaultValue;
|
|
}
|
|
}
|
|
}
|