示例#1
0
 protected string MethodDeclaration(string name,
                                    ScopeAccess scope,
                                    string returnTypeName,
                                    IEnumerable <IHasParameterInfo> parameters)
 {
     return(MethodDeclaration(name, scope, false, returnTypeName, parameters));
 }
 protected override string FieldDeclaration(string name, 
     ScopeAccess scope, bool isStatic, string fieldTypeName)
 {
     return ToStringHelper.ToStringWithCulture(scope) + " " +
         (isStatic ? "static " : "") +
         fieldTypeName + " " + MakeFieldName(name);
 }
 protected override string PropertyDeclaration(string name,
     ScopeAccess scope, bool isStatic, string propertyTypeName)
 {
     return ToStringHelper.ToStringWithCulture(scope) + " " +
         (isStatic ? "static " : "") +
         propertyTypeName + " " + MakePublicName(name);
 }
 protected override string FieldDeclaration(string name,
                                            ScopeAccess scope, bool isStatic, string fieldTypeName)
 {
     return(ToStringHelper.ToStringWithCulture(scope) + " " +
            (isStatic ? "static " : "") +
            fieldTypeName + " " + MakeFieldName(name));
 }
 protected override string PropertyDeclaration(string name,
                                               ScopeAccess scope, bool isStatic, string propertyTypeName)
 {
     return(ToStringHelper.ToStringWithCulture(scope) + " " +
            (isStatic ? "static " : "") +
            propertyTypeName + " " + MakePublicName(name));
 }
示例#6
0
        static public bool CanAccess(this ScopeAccess item, Referenceable referenceable)
        {
            if (referenceable != null)
            {
                return(item.CanAccess(referenceable.GetScopeAccessLevel()));
            }

            return(false);
        }
 protected override string MethodDeclaration(string name,
             ScopeAccess scope,
             bool isStatic,
             string returnTypeName,
             IEnumerable<IHasParameterInfo> parameters)
 {
     var indent = this.CurrentIndent + new string(' ', MethodContinueIndent);
     return ToStringHelper.ToStringWithCulture(scope) + " " +
         (isStatic ? "static " : "") +
         returnTypeName + " " + name + "(" +
         ParameterDeclarations(parameters) + ")";
 }
        protected override string MethodDeclaration(string name,
                                                    ScopeAccess scope,
                                                    bool isStatic,
                                                    string returnTypeName,
                                                    IEnumerable <IHasParameterInfo> parameters)
        {
            var indent = this.CurrentIndent + new string(' ', MethodContinueIndent);

            return(ToStringHelper.ToStringWithCulture(scope) + " " +
                   (isStatic ? "static " : "") +
                   returnTypeName + " " + name + "(" +
                   ParameterDeclarations(parameters) + ")");
        }
 private void CheckClass(CodeFirstClass eventSource,
                         string className,
                         string namespaceName,
                         ScopeAccess scopeAccess,
                         string comments,
                         string xmlCommentString)
 {
     Assert.AreEqual(className, eventSource.Name, "ClassName is wrong");
     Assert.AreEqual(namespaceName, eventSource.Namespace, "Namespace is wrong");
     Assert.AreEqual(scopeAccess, eventSource.ScopeAccess, "ScopeAccess is wrong");
     Assert.AreEqual(comments, eventSource.Comments, "Comments is wrong");
     Assert.AreEqual(xmlCommentString, eventSource.XmlCommentString, "XmlCommentString is wrong");
 }
示例#10
0
        static public ScopeAccess GetFromInside(this ScopeAccess item)
        {
            switch (item)
            {
            case ScopeAccess.Inside:
                return(ScopeAccess.Inside);

            case ScopeAccess.Lateral:
                return(ScopeAccess.Lateral);

            case ScopeAccess.Outside:
                return(ScopeAccess.Outside);
            }

            return(ScopeAccess.Outside);
        }
示例#11
0
        static public bool CanAccess(this ScopeAccess item, ScopeAccessLevel modifier)
        {
            switch (item)
            {
            case ScopeAccess.Inside:
                return(Enumerable.New(ScopeAccessLevel.Private, ScopeAccessLevel.Protected, ScopeAccessLevel.Public).Has(modifier));

            case ScopeAccess.Lateral:
                return(Enumerable.New(ScopeAccessLevel.Protected, ScopeAccessLevel.Public).Has(modifier));

            case ScopeAccess.Outside:
                return(Enumerable.New(ScopeAccessLevel.Public).Has(modifier));
            }

            return(false);
        }
示例#12
0
 private void CheckEventSource(CodeFirstEventSource eventSource,
                               string name,
                               bool isLocalized,
                               string localizationResources,
                               string eventSourceName,
                               string namespaceName,
                               ScopeAccess scopeAccess,
                               string comments,
                               string xmlCommentString)
 {
     Assert.AreEqual(name, eventSource.Name, "Name is wrong");
     Assert.AreEqual(localizationResources, eventSource.LocalizationResources, "LocalizationResources is wrong");
     Assert.AreEqual(isLocalized, eventSource.IsLocalized, "IsLocalized is wrong");
     Assert.AreEqual(eventSourceName, eventSource.EventSourceName, "EventSourceName is wrong");
     Assert.AreEqual(namespaceName, eventSource.Namespace, "Namespace is wrong");
     Assert.AreEqual(scopeAccess, eventSource.ScopeAccess, "ScopeAccess is wrong");
     Assert.AreEqual(comments, eventSource.Comments, "Comments is wrong");
     Assert.AreEqual(xmlCommentString, eventSource.XmlCommentString, "XmlCommentString is wrong");
 }
示例#13
0
 protected abstract string MethodDeclaration(string name,
                                             ScopeAccess scope,
                                             bool isStatic,
                                             string returnTypeName,
                                             IEnumerable <IHasParameterInfo> parameters);
示例#14
0
 protected abstract string FieldDeclaration(string name,
                                            ScopeAccess scope,
                                            bool isStatic,
                                            string fieldTypeName);
示例#15
0
 protected abstract string PropertyDeclaration(string name,
                                               ScopeAccess scope,
                                               bool isStatic,
                                               string propertyTypeNam);
示例#16
0
 protected string PropertyDeclaration(string name,
                                      ScopeAccess scope,
                                      string propertyTypeNam)
 {
     return(PropertyDeclaration(name, scope, false, propertyTypeNam));
 }
 private void CheckClass(CodeFirstClass eventSource,
           string className,
           string namespaceName,
           ScopeAccess scopeAccess,
           string comments,
           string xmlCommentString)
 {
     Assert.AreEqual(className, eventSource.Name, "ClassName is wrong");
      Assert.AreEqual(namespaceName, eventSource.Namespace, "Namespace is wrong");
      Assert.AreEqual(scopeAccess, eventSource.ScopeAccess, "ScopeAccess is wrong");
      Assert.AreEqual(comments, eventSource.Comments, "Comments is wrong");
      Assert.AreEqual(xmlCommentString, eventSource.XmlCommentString, "XmlCommentString is wrong");
 }
示例#18
0
 static public IEnumerable <IEnumerable <T> > GetReferenceables <T>(this Scope item, string id, ScopeAccess access, IList <Scope> path)
 {
     return(item.GetReferenceables(id, access, path).InnerConvert <Referenceable, T>());
 }
示例#19
0
        static public IEnumerable <IEnumerable <Referenceable> > GetReferenceables(this Scope item, string id, ScopeAccess access, IList <Scope> path)
        {
            if (item != null)
            {
                yield return(item.GetLocalReferenceables(id)
                             .Narrow(r => access.CanAccess(r)));

                foreach (Scope scope in item.RetrieveMarkedInstanceValues <Scope, SidewaysScopeAttribute>())
                {
                    path.Add(scope);

                    foreach (IEnumerable <Referenceable> enumerable in scope.GetReferenceables(id, access.GetFromSide(), path))
                    {
                        yield return(enumerable);
                    }

                    path.PopLast();
                }

                if (access == ScopeAccess.Inside)
                {
                    Scope scope = item.GetParentScope();

                    path.Add(scope);

                    foreach (IEnumerable <Referenceable> enumerable in scope.GetReferenceables(id, access.GetFromInside(), path))
                    {
                        yield return(enumerable);
                    }

                    path.PopLast();
                }
            }
        }
示例#20
0
 protected string FieldDeclaration(string name,
                                   ScopeAccess scope,
                                   string fieldTypeName)
 {
     return(FieldDeclaration(name, scope, false, fieldTypeName));
 }
示例#21
0
 static public IEnumerable <IEnumerable <T> > GetReferenceables <T>(this ScopeElement item, string id, ScopeAccess access, IList <Scope> path)
 {
     return(item.GetLocalScope().GetReferenceables <T>(id, access, path));
 }