arithmeticObj.hpp
Go to the documentation of this file.
1
2#pragma once
3
5#include "core/ast/scope.hpp"
6
7namespace by {
8
13 class _nout arithmeticObj: public baseObj {
14 BY(ADT(arithmeticObj, baseObj))
15
16 public:
17 tstr<me> add(const me& rhs) const;
18 tstr<me> add(const me* it) const BY_SIDE_FUNC(add);
19
20 using super::sub;
21 tstr<me> sub(const me& rhs) const;
22 tstr<me> sub(const me* it) const BY_SIDE_FUNC(sub);
23
24 tstr<me> mul(const me& rhs) const;
25 tstr<me> mul(const me* it) const BY_SIDE_FUNC(mul);
26
27 tstr<me> div(const me& rhs) const;
28 tstr<me> div(const me* it) const BY_SIDE_FUNC(div);
29
30 tstr<me> mod(const me& rhs) const;
31 tstr<me> mod(const me* it) const BY_SIDE_FUNC(mod);
32
33 tstr<me> bitwiseAnd(const me& rhs) const;
34 tstr<me> bitwiseAnd(const me* it) const BY_SIDE_FUNC(bitwiseAnd);
35 tstr<me> bitwiseXor(const me& rhs) const;
36 tstr<me> bitwiseXor(const me* it) const BY_SIDE_FUNC(bitwiseXor);
37 tstr<me> bitwiseOr(const me& rhs) const;
38 tstr<me> bitwiseOr(const me* it) const BY_SIDE_FUNC(bitwiseOr);
39 tstr<me> lshift(const me& rhs) const;
40 tstr<me> lshift(const me* it) const BY_SIDE_FUNC(lshift);
41 tstr<me> rshift(const me& rhs) const;
42 tstr<me> rshift(const me* it) const BY_SIDE_FUNC(rshift);
43 virtual tstr<me> bitwiseNot() const = 0;
44
45 nbool eq(const me& rhs) const;
46 nbool eq(const me* it) const BY_SIDE_FUNC(eq);
47 nbool ne(const me& rhs) const;
48 nbool ne(const me* it) const BY_SIDE_FUNC(ne);
49 nbool gt(const me& rhs) const;
50 nbool gt(const me* it) const BY_SIDE_FUNC(gt);
51 nbool lt(const me& rhs) const;
52 nbool lt(const me* it) const BY_SIDE_FUNC(lt);
53 nbool ge(const me& rhs) const;
54 nbool ge(const me* it) const BY_SIDE_FUNC(ge);
55 nbool le(const me& rhs) const;
56 nbool le(const me* it) const BY_SIDE_FUNC(le);
57 nbool logicalAnd(const me& rhs) const;
58 nbool logicalAnd(const me* it) const BY_SIDE_FUNC(logicalAnd);
59 nbool logicalOr(const me& rhs) const;
60 nbool logicalOr(const me* it) const BY_SIDE_FUNC(logicalOr);
61
63 tstr<me> mov(const me& rhs);
64 tstr<me> mov(const me* it) BY_SIDE_FUNC(mov);
65
66 private:
67 virtual tstr<me> _add(const me& rhs, nbool reversed) const = 0;
68 virtual tstr<me> _sub(const me& rhs, nbool reversed) const = 0;
69 virtual tstr<me> _mul(const me& rhs, nbool reversed) const = 0;
70 virtual tstr<me> _div(const me& rhs, nbool reversed) const = 0;
71 virtual tstr<me> _mod(const me& rhs, nbool reversed) const = 0;
72 virtual tstr<me> _bitwiseAnd(const me& rhs, nbool reversed) const = 0;
73 virtual tstr<me> _bitwiseXor(const me& rhs, nbool reversed) const = 0;
74 virtual tstr<me> _bitwiseOr(const me& rhs, nbool reversed) const = 0;
75 virtual tstr<me> _lshift(const me& rhs, nbool reversed) const = 0;
76 virtual tstr<me> _rshift(const me& rhs, nbool reversed) const = 0;
77
78 virtual nbool _eq(const me& rhs) const = 0;
79 virtual nbool _ne(const me& rhs) const = 0;
80 virtual nbool _gt(const me& rhs) const = 0;
81 virtual nbool _lt(const me& rhs) const = 0;
82 virtual nbool _ge(const me& rhs) const = 0;
83 virtual nbool _le(const me& rhs) const = 0;
84 virtual nbool _logicalAnd(const me& rhs) const = 0;
85 virtual nbool _logicalOr(const me& rhs) const = 0;
86
87 virtual me& _mov(const me& rhs) = 0;
88 };
89} // namespace by
Base class for arithmetic operations on primitive types.
Definition: arithmeticObj.hpp:13
tstr< me > mov(const me &rhs)
same to 'assign'.
Base class for all objects in byeol language.
Definition: baseObj.hpp:24
Strong reference smart pointer with strict type checking.
Definition: tstr.hpp:13