Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
CCIGAMES committed Mar 2, 2024
1 parent d4b4fa8 commit abd1d04
Show file tree
Hide file tree
Showing 2 changed files with 459 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Part of the Oxygen Engine / Sonic 3 A.I.R. software distribution.
* Copyright (C) 2017-2024 by Eukaryot
*
* Published under the GNU GPLv3 open source software license, see license.txt
* or https://www.gnu.org/licenses/gpl-3.0.en.html
*/

#pragma once

#include "lemon/program/DataType.h"


namespace lemon
{
class Function;

class SourceCodeWriter
{
public:
inline SourceCodeWriter(String& output) : mOutput(output) {}

inline void increaseIndentation() { ++mIndentation; }
inline void decreaseIndentation() { --mIndentation; }

void writeLine(const String& line);
void writeEmptyLine();

void beginBlock(const char* lineContent = "{");
void endBlock(const char* lineContent = "}");

protected:
String& mOutput;
int mIndentation = 0;
};


class CppWriter : public SourceCodeWriter
{
public:
inline CppWriter(String& output) : SourceCodeWriter(output) {}

void writeFunctionHeader(const Function& function);

public:
static void addDataType(String& line, const DataTypeDefinition* dataType);
static void addIdentifier(String& line, std::string_view identifier);
};

}
Loading

0 comments on commit abd1d04

Please sign in to comment.