aboutsummaryrefslogtreecommitdiffstats
path: root/value.cpp
blob: acf80ce40bd09735208e1c31d43b6517a6db3849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "value.h"
#include <string>

Value::Value(std::string& lexeme) {
    if (lexeme.find_first_not_of("0123456789")) {
        m_type = Value::Type::Integer;
        m_intData = std::stoi(lexeme, nullptr, 10);
    }
    else {
        m_type = Value::Type::String;
        m_strData = lexeme;
    }
}


const Value::Type Value::getType() const {
    return m_type;
}

const int Value::getIntData() const {
    return m_intData;
}

const std::string& Value::getStrData() const {
    return m_strData;
}