Bash++
Bash++ compiler internal documentation
bash_command_sequence.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
11#include "bpp.h"
12#include "bpp_string.h"
13
14namespace bpp {
15
36 protected:
37 std::string joined_code;
39
40 bool perfect_forwarding = false;
41
42 void join();
43 public:
44 void add_connective(bool is_and);
45
46 void add_code(const std::string& code, bool add_newline = true) override;
47
48 std::string get_code() const override;
49 std::string get_pre_code() const override;
50 std::string get_post_code() const override;
51
52 void set_perfect_forwarding(bool enable);
53};
54
55} // namespace bpp
A sequence of bash commands connected by '&&' and '||'.
Definition bash_command_sequence.h:35
std::string joined_code
Definition bash_command_sequence.h:37
std::string get_code() const override
Return the contents of the main code buffer as a string.
Definition bash_command_sequence.cpp:105
void set_perfect_forwarding(bool enable)
Definition bash_command_sequence.cpp:109
bool perfect_forwarding
Definition bash_command_sequence.h:40
void add_connective(bool is_and)
Add a connective to the command sequence, finalizing the previously-received pipeline....
Definition bash_command_sequence.cpp:73
void join()
Definition bash_command_sequence.cpp:11
void add_code(const std::string &code, bool add_newline=true) override
Add code to the code entity.
Definition bash_command_sequence.cpp:86
std::string get_post_code() const override
Return the contents of the post-code buffer as a string.
Definition bash_command_sequence.cpp:101
bool contains_multiple_commands
Definition bash_command_sequence.h:38
std::string get_pre_code() const override
Return the contents of the pre-code buffer as a string.
Definition bash_command_sequence.cpp:97
std::shared_ptr< std::ostream > code
Definition bpp_code_entity.h:37
The practical difference between bpp_code_entity and bpp_string is how we handle the code buffers.
Definition bpp_string.h:77
Definition bash_case.cpp:9