nStr.hpp
Go to the documentation of this file.
1
2#pragma once
3
6
7namespace by {
8
13 class _nout nStr: public primitiveObj<std::string>, public tucontainable<nStr> {
14 struct _nout nStrType: public ntype {
15 public:
16 nbool isImmutable() const override;
17 const std::string& getName() const override;
18
19 protected:
20 const ases& _getAses() const override;
21 };
22 BY(CLASS(nStr, primitiveObj, nStrType), VISIT())
23
24 typedef typename tucontainable<nStr>::iter iter;
26
27 public:
28 nStr() = default;
29 nStr(nchar character);
30 nStr(const nchar* val);
31 nStr(const std::string& val);
32
33 public:
34 nchar operator[](nint n) const;
35
36 public:
37 nint len() const override;
38
39 const baseObj& getOrigin() const override;
40
41 tstr<arithmeticObj> bitwiseNot() const override;
42
44 tstr<nStr> substr(nint start, nint end);
45
46 nbool in(nidx n) const;
47
48 using super::get;
49 nchar get(nidx n) const;
50
52 void add(const iter& here, const iter& from, const iter& to) override;
53 nbool add(const iter& at, const nStr& new1) override;
54
56 nbool set(const iter& at, const nStr& new1) override;
57
59 nbool del(const iter& at) override;
60 nbool del(const iter& from, const iter& end) override;
61
62 void rel() override;
63
64
65 protected:
66 iteration* _onMakeIteration(ncnt step, nbool isReversed) const override;
67
68 tstr<arithmeticObj> _add(const arithmeticObj& rhs, nbool reversed) const override;
69 tstr<arithmeticObj> _sub(const arithmeticObj& rhs, nbool reversed) const override;
70 tstr<arithmeticObj> _mul(const arithmeticObj& rhs, nbool reversed) const override;
71 tstr<arithmeticObj> _div(const arithmeticObj& rhs, nbool reversed) const override;
72 tstr<arithmeticObj> _mod(const arithmeticObj& rhs, nbool reversed) const override;
73 tstr<arithmeticObj> _bitwiseAnd(const arithmeticObj& rhs, nbool reversed) const override;
74 tstr<arithmeticObj> _bitwiseXor(const arithmeticObj& rhs, nbool reversed) const override;
75 tstr<arithmeticObj> _bitwiseOr(const arithmeticObj& rhs, nbool reversed) const override;
76 tstr<arithmeticObj> _lshift(const arithmeticObj& rhs, nbool reversed) const override;
77 tstr<arithmeticObj> _rshift(const arithmeticObj& rhs, nbool reversed) const override;
78
79 nbool _eq(const arithmeticObj& rhs) const override;
80 nbool _ne(const arithmeticObj& rhs) const override;
81 nbool _gt(const arithmeticObj& rhs) const override;
82 nbool _lt(const arithmeticObj& rhs) const override;
83 nbool _ge(const arithmeticObj& rhs) const override;
84 nbool _le(const arithmeticObj& rhs) const override;
85 nbool _logicalAnd(const arithmeticObj& rhs) const override;
86 nbool _logicalOr(const arithmeticObj& rhs) const override;
87
88 arithmeticObj& _mov(const arithmeticObj& rhs) override;
89 };
90} // namespace by
Base class for arithmetic operations on primitive types.
Definition: arithmeticObj.hpp:13
Collection of type converters.
Definition: ases.hpp:12
Base class for all objects in byeol language.
Definition: baseObj.hpp:24
Deferred execution utility like defer keyword in other languages.
Definition: end.hpp:14
String primitive type in byeol language.
Definition: nStr.hpp:13
tstr< nStr > substr(nint start, nint end)
Native type system for byeol language.
Definition: ntype.hpp:19
Definition: primitiveObj.hpp:13
Strong reference smart pointer with strict type checking.
Definition: tstr.hpp:13
Template unidirectional container interface.
Definition: tucontainable.hpp:19
Bidirectional iterator for key-value containers.
Definition: biter.hpp:9
Definition: biteration.hpp:5