superfoki.blogg.se

Refly editor
Refly editor












refly editor
  1. #REFLY EDITOR GENERATOR#
  2. #REFLY EDITOR FULL#
  3. #REFLY EDITOR CODE#

  • left = right -> Stm.Assign( left, right).
  • For example, simple statements such assign, return: Building StatementsĪs for expressions, the Stm class contains a lot of static helper classes to simplify your work. The Expr contains other methods to map typeof, new, cast.
  • Expr.Prim creates an expression from a primitive value ( int, string, double, etc.).
  • Invoke invokes the method with the arguments, Field retrieves the field from an expression

    #REFLY EDITOR CODE#

    Here are some code samples, with their Refly counter part: The class Expr contains a number of static helper classes that will generate all the expression objects for you. Creating a namespaceįirst of all, we need a namespace, that is an instance of NamespaceDeclaration:Īge.( " user age") Building Expressions

    #REFLY EDITOR GENERATOR#

    This section gives step-by-step instructions to get you code generator running. Usually, importing the Refly.CodeDom is sufficient to have all the functionalities of Refly. When Refly is asked to generate the code, it creates the CodeDom code and lets CodeDom generate the code. Refly acts as a wrapper around CodeDom: each class of the CodeDom namespace has its Refly counter part. Refly.Templates, some generator classes,.Refly.CodeDom, root namespace for the CodeDom generator,.The Refly framework is organized in the following components:

    #REFLY EDITOR FULL#

    The full source of the example is available in the demo. This concludes the introductory comparison example.

  • Output: (not shown in the example), Refly will create the directory structure mapping the namespaces and output a file for each class/ enum.
  • Smart helpers: wrapping a field by a property is a usual task.
  • Imagine the economy of work when you need to generate methods with dozens of lines. Expression and statement building has been highly simplified in Refly as you can see it in this 1 line example.
  • Expression and Statement construction: this.name = name.
  • Therefore, you avoid forgetting to add the type into the parent.
  • Add instances into their parents: in CodeDom, it is your job to add the new instance into their parents.
  • User.AddProperty(name, true, false, false) ComparisonĪt first look, the two versions do not look very different, let me point out some interesting differences: NamespaceDeclaration demo= new NamespaceDeclaration( " Refly.Demo") ĬlassDeclaration user = demo.AddClass( " User") įieldDeclaration name = user.AddField( typeof( string), " name") ĬonstructorDeclaration cstr = user.AddConstructor() Ĭ( typeof( string), " name", true) Although you do not know yet Refly, you will see that it is similar in many ways to CodeDom:

    refly editor

    Here comes the Refly version of the above. New CodeParameterDeclarationExpression( typeof( string), " name") ĬodeFieldReferenceExpression thisName = new CodeFieldReferenceExpression(ĬodeAssignStatement assign = new CodeAssignStatement(ĬodeMemberProperty p = new CodeMemberProperty()

    refly editor

    CodeNamespace demo = new CodeNamespace( " Refly.Demo") ĬodeTypeDeclaration user = new CodeTypeDeclaration( " User") ĬodeMemberField name = new CodeMemberField( typeof( string), " name") ĬodeConstructor cstr = new CodeConstructor() ĬodeParameterDeclarationExpression pname =














    Refly editor