コード例 #1
0
            public static bool tryDeserializeName(ref string line, NameKind nameKind, out string name)
            {
                name = string.Empty;
                switch (nameKind)
                {
                case NameKind.EnumBracket: {
                    if (!line.StartsWith("    ["))
                    {
                        return(false);
                    }
                    name = line.Substring(5, line.IndexOf(']') - 5);
                    break;
                }

                case NameKind.StructElement: {
                    line = line.TrimStart();
                    if (!line.StartsWith("."))
                    {
                        return(false);
                    }
                    name = line.Substring(1, line.IndexOf(' ') - 1);
                    break;
                }
                }
                line = line.Substring(line.IndexOf('=', name.Length + 2) + 2);
                if (line[^ 1] == ',')
コード例 #2
0
        /// <summary>
        ///     Check if the given name is a reserved keyword. if yes, add appropriate error to the refschema
        /// </summary>
        private bool CheckForSystemNamespace(UsingElement refSchema, string name, NameKind nameKind)
        {
            Debug.Assert(
                _definingSchema.ProviderManifest != null,
                "Since we don't allow using elements in provider manifest, provider manifest can never be null");

            // We need to check for system namespace
            if (EdmItemCollection.IsSystemNamespace(_definingSchema.ProviderManifest, name))
            {
                if (nameKind == NameKind.Alias)
                {
                    refSchema.AddError(
                        ErrorCode.CannotUseSystemNamespaceAsAlias, EdmSchemaErrorSeverity.Error,
                        Strings.CannotUseSystemNamespaceAsAlias(name));
                }
                else
                {
                    refSchema.AddError(
                        ErrorCode.NeedNotUseSystemNamespaceInUsing, EdmSchemaErrorSeverity.Error,
                        Strings.NeedNotUseSystemNamespaceInUsing(name));
                }
                return(true);
            }
            return(false);
        }
コード例 #3
0
ファイル: NameRecord.cs プロジェクト: gurvir93/VSSTreeLib
 public int IndexOf(NameKind kind)
 {
     for (int i = 0; i < kindCount; ++i)
     {
         if (kinds[i] == kind)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #4
0
ファイル: NameRecord.cs プロジェクト: runt18/vss2git-1
 public int IndexOf(NameKind kind)
 {
     for (int i = 0; i < kindCount; ++i)
     {
         if (kinds[i] == kind)
         {
             return i;
         }
     }
     return -1;
 }
コード例 #5
0
ファイル: SchemaLookupTable.cs プロジェクト: jwanagel/jjwtest
        /// <summary>
        ///     Check if the given name is a reserved keyword. if yes, add appropriate error to the refschema
        /// </summary>
        /// <param name="refSchema"> </param>
        /// <param name="name"> </param>
        /// <param name="nameKind"> </param>
        /// <returns> </returns>
        private bool CheckForSystemNamespace(UsingElement refSchema, string name, NameKind nameKind)
        {
            Debug.Assert(
                _definingSchema.ProviderManifest != null,
                "Since we don't allow using elements in provider manifest, provider manifest can never be null");

            // We need to check for system namespace
            if (EdmItemCollection.IsSystemNamespace(_definingSchema.ProviderManifest, name))
            {
                if (nameKind == NameKind.Alias)
                {
                    refSchema.AddError(
                        ErrorCode.CannotUseSystemNamespaceAsAlias, EdmSchemaErrorSeverity.Error,
                        Strings.CannotUseSystemNamespaceAsAlias(name));
                }
                else
                {
                    refSchema.AddError(
                        ErrorCode.NeedNotUseSystemNamespaceInUsing, EdmSchemaErrorSeverity.Error,
                        Strings.NeedNotUseSystemNamespaceInUsing(name));
                }
                return true;
            }
            return false;
        }
コード例 #6
0
        public override QualifiedNameSyntax GetChildName <TChild>(ILocatedOpenApiElement <TChild> child, NameKind nameKind)
        {
            QualifiedNameSyntax?name = Parent?.GetChildName(Element, nameKind);

            INameFormatter formatter = Context.NameFormatterSelector.GetFormatter(nameKind);

            if (name == null)
            {
                // At the components root, use the parameters namespace. In this case, use the key on the components
                // dictionary and not the parameter name, since multiple component parameters may have the same name.
                return(QualifiedName(
                           GetNamespace(),
                           IdentifierName(formatter.Format(Element.Key))));
            }

            return(name);
        }
コード例 #7
0
 public QualifiedNameSyntax?GetChildName <TChild>(ILocatedOpenApiElement <TChild> child, NameKind nameKind)
     where TChild : IOpenApiElement =>
 Parent?.GetChildName(child, nameKind);
コード例 #8
0
 public override QualifiedNameSyntax?GetChildName <TChild>(ILocatedOpenApiElement <TChild> child, NameKind nameKind) =>
 QualifiedName((NameSyntax)TypeInfo.Name, IdentifierName(
                   Context.NameFormatterSelector.GetFormatter(nameKind).Format(child.Key + "-Model")));
コード例 #9
0
        public override QualifiedNameSyntax GetChildName <TChild>(ILocatedOpenApiElement <TChild> child, NameKind nameKind)
        {
            QualifiedNameSyntax?name = Parent?.GetChildName(Element, nameKind);

            INameFormatter formatter = Context.NameFormatterSelector.GetFormatter(nameKind);

            if (name == null)
            {
                // At the components root, use the responses namespace
                return(QualifiedName(
                           GetNamespace(),
                           IdentifierName(formatter.Format(Element.Key))));
            }

            return(name);
        }
コード例 #10
0
 public override QualifiedNameSyntax?GetChildName <TChild>(ILocatedOpenApiElement <TChild> child,
                                                           NameKind nameKind) =>
 null;
コード例 #11
0
 public virtual QualifiedNameSyntax?GetChildName <TChild>(ILocatedOpenApiElement <TChild> child, NameKind nameKind)
     where TChild : IOpenApiElement => null;
コード例 #12
0
 public virtual INameFormatter GetFormatter(NameKind nameKind) => nameKind switch
 {
コード例 #13
0
 public INameFormatter GetFormatter(NameKind nameKind) => nameKind switch
 {
コード例 #14
0
 public UserName(string name, NameKind kind)
 {
     Name = name;
     Kind = kind;
 }
コード例 #15
0
        public override QualifiedNameSyntax GetChildName <TChild>(ILocatedOpenApiElement <TChild> child, NameKind nameKind)
        {
            QualifiedNameSyntax?name = Parent?.GetChildName(Element, nameKind);

            INameFormatter formatter = Context.NameFormatterSelector.GetFormatter(nameKind);

            if (name == null)
            {
                // At the components root, use the schema namespace
                return(QualifiedName(
                           Context.NamespaceProvider.GetNamespace(Element),
                           IdentifierName(formatter.Format(Element.Key + "-Item"))));
            }

            return(name.WithRight(IdentifierName(
                                      formatter.Format(name.Right.Identifier.ValueText + "-Item"))));
        }
コード例 #16
0
ファイル: YardarmTypeInfo.cs プロジェクト: CenterEdge/Yardarm
 public YardarmTypeInfo(TypeSyntax name, NameKind kind = NameKind.Class, bool isGenerated = true)
 {
     Name        = name ?? throw new ArgumentNullException(nameof(name));
     Kind        = kind;
     IsGenerated = isGenerated;
 }