Bash++
Bash++ compiler internal documentation
bpp_object.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 Andrew S. Rightenburg
3 * Bash++: Bash with classes
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7#pragma once
8
9#include <string>
10#include <memory>
11
12#include "bpp.h"
13#include "bpp_entity.h"
14
15namespace bpp {
16
22class bpp_object : public bpp_entity {
23 protected:
24 std::string address;
25 std::string assignment_value;
26 std::string pre_access_code;
27 std::string post_access_code;
28 bool m_is_pointer = false;
29 std::shared_ptr<bpp::bpp_object> copy_from = nullptr;
30 public:
31 void set_class(std::shared_ptr<bpp_class> object_class);
32 void set_pointer(bool is_pointer);
33 void set_address(const std::string& address);
34 void set_assignment_value(const std::string& assignment_value);
35 void set_pre_access_code(const std::string& pre_access_code);
36 void set_post_access_code(const std::string& post_access_code);
37 void set_nullptr();
38
39 std::string get_address() const override;
40 std::string get_assignment_value() const;
41 std::string get_pre_access_code() const;
42 std::string get_post_access_code() const;
43 std::shared_ptr<bpp::bpp_object> get_copy_from() const;
44
45 bool is_pointer() const;
46};
47
48} // namespace bpp
The base class for all entities in the Bash++ compiler.
Definition bpp_entity.h:25
An object in Bash++.
Definition bpp_object.h:22
std::string get_pre_access_code() const
Definition bpp_object.cpp:49
bool is_pointer() const
Definition bpp_object.cpp:57
void set_pre_access_code(const std::string &pre_access_code)
Definition bpp_object.cpp:27
void set_pointer(bool is_pointer)
Definition bpp_object.cpp:15
void set_address(const std::string &address)
Definition bpp_object.cpp:19
std::string address
Definition bpp_object.h:24
void set_post_access_code(const std::string &post_access_code)
Definition bpp_object.cpp:31
std::string get_post_access_code() const
Definition bpp_object.cpp:53
std::string get_assignment_value() const
Definition bpp_object.cpp:45
void set_assignment_value(const std::string &assignment_value)
Definition bpp_object.cpp:23
std::string pre_access_code
Definition bpp_object.h:26
void set_nullptr()
Definition bpp_object.cpp:35
std::string post_access_code
Definition bpp_object.h:27
bool m_is_pointer
Definition bpp_object.h:28
std::string assignment_value
Definition bpp_object.h:25
std::shared_ptr< bpp::bpp_object > get_copy_from() const
Definition bpp_object.cpp:61
std::string get_address() const override
Definition bpp_object.cpp:41
void set_class(std::shared_ptr< bpp_class > object_class)
Definition bpp_object.cpp:11
std::shared_ptr< bpp::bpp_object > copy_from
Definition bpp_object.h:29
Definition bash_case.cpp:9