コード例 #1
0
        /// <summary>
        /// Formats a type
        /// </summary>
        /// <param name="tsType">The type</param>
        /// <returns>The string representation of the type</returns>
        public virtual string Format(TsType tsType)
        {
            if (tsType is TsGenericType)
            {
                return(Format((TsGenericType)tsType));
            }
            var tsInterface = tsType as TsInterface;

            if (tsInterface != null && tsInterface.IsLiteral)
            {
                return(Format(tsInterface));
            }
            return(tsType.Name.FullName);
        }
コード例 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">The interface name</param>
 public TsProperty(TsName name, TsType type)
     : base(name)
 {
     this.Type = type;
     this.Optional = this.Type.IsNullable;
 }
コード例 #3
0
 public virtual string FormatReturnType(TsType tsReturnType)
 {
     return Format(tsReturnType);
 }
コード例 #4
0
 public virtual string Format(TsType tsType)
 {
     if (tsType is TsGenericType)
         return Format((TsGenericType)tsType);
     return tsType.ToString();
 }
コード例 #5
0
 /// <summary>
 /// Formats a return type
 /// </summary>
 /// <param name="tsReturnType">The return type</param>
 /// <returns>The string representation of the return type</returns>
 public virtual string FormatReturnType(TsType tsReturnType)
 {
     return(Format(tsReturnType));
 }
コード例 #6
0
ファイル: TsArray.cs プロジェクト: ArchitectNow/TypeScripter
 public TsArray(TsType elementType, int dimensions)
     : base(new TsName(elementType.Name.Name + GenerateArrayNotation(dimensions), elementType.Name.Namespace))
 {
 }
コード例 #7
0
ファイル: TsArray.cs プロジェクト: mtemel123/TypeScripter
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="elementType">The element type</param>
 /// <param name="dimensions">The dimensions</param>
 public TsArray(TsType elementType, int dimensions)
     : base(new TsName(elementType.Name.Name + GenerateArrayNotation(dimensions), elementType.Name.Namespace))
 {
 }
コード例 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">The parameter name</param>
 public TsParameter(TsName name, TsType type, bool IsOptional = false)
     : base(name)
 {
     this.Type = type;
     this.Optional = IsOptional;
 }
コード例 #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">The interface name</param>
 /// <param name="type">The type name</param>
 /// <param name="optional">Indicates optional property</param>
 public TsProperty(TsName name, TsType type, bool optional = false)
     : base(name)
 {
     this.Type     = type;
     this.Optional = optional;
 }
コード例 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">The parameter name</param>
 /// <param name="type">The parameter type</param>
 public TsParameter(TsName name, TsType type)
     : base(name)
 {
     this.Type     = type;
     this.Optional = false;
 }