osci-render/Source/parser/FileParser.h

43 wiersze
1.2 KiB
C
Czysty Zwykły widok Historia

#pragma once
#include "FrameSource.h"
#include "../shape/Shape.h"
#include "../obj/WorldObject.h"
#include "../svg/SvgParser.h"
2023-02-05 20:36:51 +00:00
#include "../txt/TextParser.h"
#include "../lua/LuaParser.h"
2023-08-27 18:33:42 +00:00
class FileParser {
public:
FileParser(std::function<void(int, juce::String, juce::String)> errorCallback = nullptr);
void parse(juce::String fileName, juce::String extension, std::unique_ptr<juce::InputStream>, juce::Font);
2023-08-27 18:33:42 +00:00
std::vector<std::unique_ptr<Shape>> nextFrame();
2024-01-07 16:17:20 +00:00
Point nextSample(lua_State*& L, const LuaVariables vars, long& step, double& phase);
void closeLua(lua_State*& L);
2023-08-27 18:33:42 +00:00
bool isSample();
bool isActive();
void disable();
void enable();
2023-07-04 13:58:36 +00:00
std::shared_ptr<WorldObject> getObject();
std::shared_ptr<SvgParser> getSvg();
std::shared_ptr<TextParser> getText();
std::shared_ptr<LuaParser> getLua();
private:
bool active = true;
bool sampleSource = false;
juce::SpinLock lock;
2023-02-05 19:36:50 +00:00
std::shared_ptr<WorldObject> object;
std::shared_ptr<SvgParser> svg;
2023-02-05 20:36:51 +00:00
std::shared_ptr<TextParser> text;
std::shared_ptr<LuaParser> lua;
juce::String fallbackLuaScript = "return { 0.0, 0.0 }";
2023-12-20 17:13:38 +00:00
std::function<void(int, juce::String, juce::String)> errorCallback;
};