Exemplo n.º 1
0
 public CSFixedCodeBlock(CSType type, CSIdentifier ident, CSBaseExpression expr, IEnumerable <ICodeElement> body)
     : base(body)
 {
     Type       = Exceptions.ThrowOnNull(type, "type");
     Identifier = Exceptions.ThrowOnNull(ident, "ident");
     Expr       = Exceptions.ThrowOnNull(expr, "expr");
 }
Exemplo n.º 2
0
 public ForElement(CSType type, CSIdentifier ident, CSBaseExpression expr)
     : base()
 {
     Type  = type;
     Ident = ident;
     Expr  = expr;
 }
Exemplo n.º 3
0
 public CSTernary(CSBaseExpression predicate, CSBaseExpression onTrue, CSBaseExpression onFalse, bool addParentheses)
 {
     Predicate      = Exceptions.ThrowOnNull(predicate, "predicate");
     OnTrue         = Exceptions.ThrowOnNull(onTrue, "onTrue");
     OnFalse        = Exceptions.ThrowOnNull(onFalse, "onFalse");
     AddParentheses = addParentheses;
 }
Exemplo n.º 4
0
        public static CSMethod PInvoke(CSVisibility vis, CSType type, string name, CSBaseExpression dllName, string externName, CSParameterList parms)
        {
            CSMethod method = new CSMethod(vis, CSMethodKind.StaticExtern, Exceptions.ThrowOnNull(type, "type"),
                                           new CSIdentifier(name), parms, null);

            CSAttribute.DllImport(dllName, externName).AttachBefore(method);

            return(method);
        }
Exemplo n.º 5
0
 public CSForEach(CSType type, CSIdentifier ident, CSBaseExpression expr, CSCodeBlock body)
 {
     Type  = type;
     Ident = Exceptions.ThrowOnNull(ident, nameof(ident));
     Expr  = Exceptions.ThrowOnNull(expr, nameof(expr));
     Body  = body ?? new CSCodeBlock();
     Add(new ForElement(type, ident, expr));
     Add(Body);
 }
        public static CSAttribute DllImport(CSBaseExpression dllName, string entryPoint = null)
        {
            CSArgumentList args = new CSArgumentList();

            args.Add(dllName);
            if (entryPoint != null)
            {
                args.Add(new CSAssignment("EntryPoint", CSAssignmentOperator.Assign, CSConstant.Val(entryPoint)));
            }
            return(new CSAttribute(new CSIdentifier("DllImport"), args, true));
        }
Exemplo n.º 7
0
        public CSIfElse(CSBaseExpression condition, CSCodeBlock ifClause, CSCodeBlock elseClause = null)
            : base()
        {
            Condition  = new CSIfElement(Exceptions.ThrowOnNull(condition, "condition"));
            IfClause   = Exceptions.ThrowOnNull(ifClause, "ifClause");
            ElseClause = elseClause;

            Add(Condition);
            Add(IfClause);
            if (ElseClause != null && ElseClause.Count > 0)
            {
                Add(new SimpleLineElement("else", false, true, false));
                Add(ElseClause);
            }
        }
Exemplo n.º 8
0
 public CSForEach(CSType type, string ident, CSBaseExpression expr, CSCodeBlock body)
     : this(type, new CSIdentifier(ident), expr, body)
 {
 }
Exemplo n.º 9
0
 public static CSLine Assign(CSBaseExpression name, CSAssignmentOperator op, CSBaseExpression value)
 {
     return(new CSLine(new CSAssignment(name, op, value)));
 }
Exemplo n.º 10
0
 public CSBaseExpression Dot(CSBaseExpression rhs)
 {
     return(new CSBinaryExpression(CSBinaryOperator.Dot, this, rhs));
 }
Exemplo n.º 11
0
 public CSAssignment(CSBaseExpression lhs, CSAssignmentOperator op, CSBaseExpression rhs)
 {
     Target    = Exceptions.ThrowOnNull(lhs, "lhs");
     Value     = Exceptions.ThrowOnNull(rhs, "rhs");
     Operation = op;
 }
Exemplo n.º 12
0
 public static CSLine Assign(CSBaseExpression name, CSBaseExpression value)
 {
     return(Assign(name, CSAssignmentOperator.Assign, value));
 }
Exemplo n.º 13
0
 public CSAssignment(string lhs, CSAssignmentOperator op, CSBaseExpression rhs)
     : this(new CSIdentifier(Exceptions.ThrowOnNull(lhs, "lhs")), op, rhs)
 {
 }
		public static CSFunctionCall Sizeof (CSBaseExpression expr)
		{
			CommaListElementCollection<CSBaseExpression> parms = new CommaListElementCollection<CSBaseExpression> ();
			parms.Add (expr);
			return new CSFunctionCall (iSizeof, parms, false);
		}
Exemplo n.º 15
0
 public CSIndexExpression(CSBaseExpression aggregate, bool addParensAroundAggregate, params CSBaseExpression [] parameters)
     : this(aggregate, new CommaListElementCollection <CSBaseExpression> (parameters), addParensAroundAggregate)
 {
 }
Exemplo n.º 16
0
        public CSIfElse(CSBaseExpression expr, IEnumerable <ICodeElement> ifClause, IEnumerable <ICodeElement> elseClause)
            : this(expr, new CSCodeBlock(ifClause),
                   elseClause != null ? new CSCodeBlock(elseClause) : null)

        {
        }
Exemplo n.º 17
0
 public CSIndexExpression(CSBaseExpression aggregate, CommaListElementCollection <CSBaseExpression> paramList, bool addParensAroundAggregate)
 {
     AddParensAroundAggregate = addParensAroundAggregate;
     Aggregate  = Exceptions.ThrowOnNull(aggregate, "aggregate");
     Parameters = Exceptions.ThrowOnNull(paramList, "paramList");
 }
Exemplo n.º 18
0
 public CSIfElement(CSBaseExpression condition)
     : base()
 {
     Condition = condition;
 }
Exemplo n.º 19
0
 public CSThrow(CSBaseExpression expr)
 {
     Expr = Exceptions.ThrowOnNull(expr, "expr");
 }