-
Notifications
You must be signed in to change notification settings - Fork 0
/
variable.hpp
39 lines (33 loc) · 1.81 KB
/
variable.hpp
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
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: GPL-3.0-only
/**
* @file variable.hpp
*
* @copyright Copyright (C) 2021-2024 srcML, LLC. (www.srcML.org)
*
* This file is part of the Stereocode application.
*/
#ifndef VARIABLE_HPP
#define VARIABLE_HPP
#include "utils.hpp"
// Used to store data members (attributes or fields), locals, and parameters
//
class variable {
public:
void setName (const std::string& t) { name = t; }
void setType (const std::string& t) { type = t; }
void setNonPrimitiveExternal (const bool m) { nonPrimitiveExternal = m; }
void setNonPrimitive (const bool m) { nonPrimitive = m; }
void setPos (const int p) { pos = p; }
std::string getName () const { return name; }
std::string getType () const { return type; }
bool getNonPrimitiveExternal () const { return nonPrimitiveExternal;}
bool getNonPrimitive () const { return nonPrimitive; }
int getPos () const { return pos; }
private:
std::string name; // Variable name
std::string type; // Variable type
bool nonPrimitiveExternal{false}; // True if variable is non-primitive and not of same type as class it belongs to
bool nonPrimitive{false}; // True if variable is non-primitive
int pos{-1}; // Position of variable (Starting at 0)
};
#endif