Add auto-included fart/common.h

This commit is contained in:
josh committed 2026-11-01 14:18:02 -05:00
1 parent 1947ea553c
commit d71be68fae
6 files changed
+14 -9

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ end
env do |env|
env.add_builder(Propane)
env["CCFLAGS"] += %w[-Wall -O2 -std=c++23]
env["CCFLAGS"] += %w[-Wall -O2 -std=c++23 -include fart/common.h]
env["CPPPATH"] += %W[src #{env.build_root}/src]
env.Propane("^/src/propane.cpp", "src/fart.propane")
+2 -2
View File
@@ -3,9 +3,9 @@
#include <stdio.h>
#include <filesystem>
ImageWriter * ImageWriter::build(const std::string & fname)
ImageWriter * ImageWriter::build(const string & fname)
{
std::string ext = std::filesystem::path(fname).extension().string();
string ext = std::filesystem::path(fname).extension().string();
if (ext == ".png")
{
return new PngImageWriter(fname);
+3 -3
View File
@@ -6,11 +6,11 @@
class ImageWriter
{
public:
static ImageWriter * build(const std::string & fname);
static ImageWriter * build(const string & fname);
virtual ~ImageWriter() = default;
virtual bool write(const Image & image) = 0;
protected:
ImageWriter(const std::string & fname) : fname(fname) {}
std::string fname;
ImageWriter(const string & fname) : fname(fname) {}
string fname;
};
+1 -1
View File
@@ -5,6 +5,6 @@
class PngImageWriter : public ImageWriter
{
public:
PngImageWriter(const std::string & fname) : ImageWriter(fname) {}
PngImageWriter(const string & fname) : ImageWriter(fname) {}
bool write(const Image & image) override;
};
+2 -2
View File
@@ -5,8 +5,8 @@
struct RenderParams
{
std::string input_file;
std::string output_file;
string input_file;
string output_file;
size_t width = 0u;
size_t height = 0u;
};
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#include <string>
using string = std::string;