Fix gst_base_transform_get_unit_size bindings, fixes bug 565978
[vala-lang.git] / ccode / valaccodeunaryexpression.vala
blob0f33478afe1334f576332257930a1cd11cc2b9d9
1 /* valaccodeunaryexpression.vala
3 * Copyright (C) 2006 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
23 using GLib;
25 /**
26 * Represents an expression with one operand in the C code.
28 public class Vala.CCodeUnaryExpression : CCodeExpression {
29 /**
30 * The unary operator.
32 public CCodeUnaryOperator operator { get; set; }
34 /**
35 * The operand.
37 public CCodeExpression inner { get; set; }
39 public CCodeUnaryExpression (CCodeUnaryOperator op, CCodeExpression expr) {
40 operator = op;
41 inner = expr;
44 public override void write (CCodeWriter writer) {
45 if (operator == CCodeUnaryOperator.PLUS) {
46 writer.write_string ("+");
47 } else if (operator == CCodeUnaryOperator.MINUS) {
48 writer.write_string ("-");
49 } else if (operator == CCodeUnaryOperator.LOGICAL_NEGATION) {
50 writer.write_string ("!");
51 } else if (operator == CCodeUnaryOperator.BITWISE_COMPLEMENT) {
52 writer.write_string ("~");
53 } else if (operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
54 writer.write_string ("*");
55 } else if (operator == CCodeUnaryOperator.ADDRESS_OF) {
56 writer.write_string ("&");
57 } else if (operator == CCodeUnaryOperator.PREFIX_INCREMENT) {
58 writer.write_string ("++");
59 } else if (operator == CCodeUnaryOperator.PREFIX_DECREMENT) {
60 writer.write_string ("--");
63 inner.write_inner (writer);
65 if (operator == CCodeUnaryOperator.POSTFIX_INCREMENT) {
66 writer.write_string ("++");
67 } else if (operator == CCodeUnaryOperator.POSTFIX_DECREMENT) {
68 writer.write_string ("--");
72 public override void write_inner (CCodeWriter writer) {
73 writer.write_string ("(");
74 this.write (writer);
75 writer.write_string (")");
79 public enum Vala.CCodeUnaryOperator {
80 PLUS,
81 MINUS,
82 LOGICAL_NEGATION,
83 BITWISE_COMPLEMENT,
84 POINTER_INDIRECTION,
85 ADDRESS_OF,
86 PREFIX_INCREMENT,
87 PREFIX_DECREMENT,
88 POSTFIX_INCREMENT,
89 POSTFIX_DECREMENT