1 using System;
2 using CodeFormatter = System.Text.CodeFormatter;
3
4 namespace cmsx.intermediate
5 {
6 public abstract class Operand
7 {
8 public virtual default ~Operand();
9 public virtual nothrow void Print(CodeFormatter& formatter)
10 {
11 }
12 }
13
14 public class LiteralOperand : Operand
15 {
16 public nothrow LiteralOperand() : value(0u)
17 {
18 }
19 public nothrow LiteralOperand(ulong value_) : value(value_)
20 {
21 }
22 public inline nothrow void SetValue(ulong value_)
23 {
24 value = value_;
25 }
26 public override nothrow void Print(CodeFormatter& formatter)
27 {
28 formatter << ToString(value);
29 }
30 public ulong value;
31 }
32
33 public class FloatingLiteralOperand : Operand
34 {
35 public nothrow FloatingLiteralOperand() : value(0.0)
36 {
37 }
38 public nothrow FloatingLiteralOperand(double value_) : value(value_)
39 {
40 }
41 public inline nothrow void SetValue(double value_)
42 {
43 value = value_;
44 }
45 public override nothrow void Print(CodeFormatter& formatter)
46 {
47 formatter << ToString(value, 1, 15);
48 }
49 public double value;
50 }
51
52 public class SymbolOperand : Operand
53 {
54 public nothrow SymbolOperand(const string& value_) : value(value_)
55 {
56 }
57 public override nothrow void Print(CodeFormatter& formatter)
58 {
59 formatter << value;
60 }
61 public string value;
62 }
63
64 public class StringOperand : Operand
65 {
66 public nothrow StringOperand(const string& value_) : value(value_)
67 {
68 }
69 public override nothrow void Print(CodeFormatter& formatter)
70 {
71 formatter << '"' << value << '"';
72 }
73 public string value;
74 }
75
76 public class ClsIdOperand : Operand
77 {
78 public nothrow ClsIdOperand(const string& typeId_) : typeId(typeId_)
79 {
80 }
81 public override nothrow void Print(CodeFormatter& formatter)
82 {
83 formatter << "$CLSID(" << typeId << ')';
84 }
85 public string typeId;
86 }
87 }