Bash++
Bash++ compiler internal documentation
bpp_string.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_code_entity.h"
13
14namespace bpp {
15
78 public:
79 void add_code(const std::string& code, bool add_newline = true) override;
80 void add_code_to_previous_line(const std::string& code) override;
81 void add_code_to_next_line(const std::string& code) override;
82
83 std::string get_code() const override;
84 std::string get_pre_code() const override;
85 std::string get_post_code() const override;
86};
87
88} // namespace bpp
An entity which can contain code.
Definition bpp_code_entity.h:35
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
std::string get_pre_code() const override
Return the contents of the pre-code buffer as a string.
Definition bpp_string.cpp:39
void add_code(const std::string &code, bool add_newline=true) override
Add code to the primary buffer.
Definition bpp_string.cpp:17
void add_code_to_previous_line(const std::string &code) override
Add code to the pre-code buffer.
Definition bpp_string.cpp:24
void add_code_to_next_line(const std::string &code) override
Add code to the post-code buffer.
Definition bpp_string.cpp:31
std::string get_code() const override
Return the contents of the main code buffer as a string.
Definition bpp_string.cpp:35
std::string get_post_code() const override
Return the contents of the post-code buffer as a string.
Definition bpp_string.cpp:47
Definition bash_case.cpp:9