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"); }
public ForElement(CSType type, CSIdentifier ident, CSBaseExpression expr) : base() { Type = type; Ident = ident; Expr = expr; }
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; }
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); }
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)); }
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); } }
public CSForEach(CSType type, string ident, CSBaseExpression expr, CSCodeBlock body) : this(type, new CSIdentifier(ident), expr, body) { }
public static CSLine Assign(CSBaseExpression name, CSAssignmentOperator op, CSBaseExpression value) { return(new CSLine(new CSAssignment(name, op, value))); }
public CSBaseExpression Dot(CSBaseExpression rhs) { return(new CSBinaryExpression(CSBinaryOperator.Dot, this, rhs)); }
public CSAssignment(CSBaseExpression lhs, CSAssignmentOperator op, CSBaseExpression rhs) { Target = Exceptions.ThrowOnNull(lhs, "lhs"); Value = Exceptions.ThrowOnNull(rhs, "rhs"); Operation = op; }
public static CSLine Assign(CSBaseExpression name, CSBaseExpression value) { return(Assign(name, CSAssignmentOperator.Assign, value)); }
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); }
public CSIndexExpression(CSBaseExpression aggregate, bool addParensAroundAggregate, params CSBaseExpression [] parameters) : this(aggregate, new CommaListElementCollection <CSBaseExpression> (parameters), addParensAroundAggregate) { }
public CSIfElse(CSBaseExpression expr, IEnumerable <ICodeElement> ifClause, IEnumerable <ICodeElement> elseClause) : this(expr, new CSCodeBlock(ifClause), elseClause != null ? new CSCodeBlock(elseClause) : null) { }
public CSIndexExpression(CSBaseExpression aggregate, CommaListElementCollection <CSBaseExpression> paramList, bool addParensAroundAggregate) { AddParensAroundAggregate = addParensAroundAggregate; Aggregate = Exceptions.ThrowOnNull(aggregate, "aggregate"); Parameters = Exceptions.ThrowOnNull(paramList, "paramList"); }
public CSIfElement(CSBaseExpression condition) : base() { Condition = condition; }
public CSThrow(CSBaseExpression expr) { Expr = Exceptions.ThrowOnNull(expr, "expr"); }