Ejemplo n.º 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);
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 public virtual string FormatReturnType(TsType tsReturnType)
 {
     return Format(tsReturnType);
 }
Ejemplo n.º 4
0
 public virtual string Format(TsType tsType)
 {
     if (tsType is TsGenericType)
         return Format((TsGenericType)tsType);
     return tsType.ToString();
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 6
0
 public TsArray(TsType elementType, int dimensions)
     : base(new TsName(elementType.Name.Name + GenerateArrayNotation(dimensions), elementType.Name.Namespace))
 {
 }
Ejemplo n.º 7
0
 /// <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))
 {
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }