Loading...
Searching...
No Matches
valStela.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "stela/ast/stela.hpp"
5
6namespace by {
7
21 class _nout valStela: public stela {
22 BY(ADT(valStela, stela), VISIT())
23 // only the parser sees a spelling. a public setter would let the spelling disagree
24 // with the value, and the writer trusts the spelling.
25 friend class stelaParser;
26
27 protected:
28 valStela(const std::string& rawVal, const std::string& name = "");
29 valStela(const nchar* rawVal, const std::string& name = "");
30 valStela(nbool val, const std::string& name = "");
31 valStela(nint val, const std::string& name = "");
32 valStela(nflt val, const std::string& name = "");
33 valStela(const me& rhs, const std::string& name = "");
34
35 public:
36 const std::string& asStr() const override;
37 nchar asChar() const override;
38 nint asInt() const override;
39 nbool asBool() const override;
40
47 const std::string& getRepr() const;
48
49 private:
50 static std::string toLower(std::string it);
51
52 private:
53 std::string _rawVal;
54 std::string _repr;
55 };
56}
Definition stela.hpp:63
Parser for stela configuration language.
Definition stelaParser.hpp:39
Scalar value — the abstract base of every leaf form.
Definition valStela.hpp:21
const std::string & asStr() const override
Converts the stela object's value to a string.
nchar asChar() const override
Converts the stela object's value to a character.
const std::string & getRepr() const
The literal as it was written in source, e.g. 0xFF for a value of 255.
nint asInt() const override
Converts the stela object's value to an integer.
nbool asBool() const override
Converts the stela object's value to a boolean.
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34