2019-11-22 11:57:17 +00:00
|
|
|
#include <ClassBuilder.hpp>
|
|
|
|
#include <Builders.hpp>
|
|
|
|
|
|
|
|
|
2019-11-22 14:22:52 +00:00
|
|
|
ClassBuilder::ClassBuilder(const cxxopts::ParseResult& results_,
|
|
|
|
const DeviceInfo& deviceInfo_,
|
|
|
|
const std::vector<Peripheral>& peripherals_) :
|
|
|
|
results(results_),
|
|
|
|
deviceInfo(deviceInfo_),
|
|
|
|
peripherals(peripherals_){}
|
2019-11-22 11:57:17 +00:00
|
|
|
|
|
|
|
void ClassBuilder::setupBuilders(){
|
|
|
|
builders.push_back(std::make_unique<ZeroPointerBuilder>());
|
2019-12-02 09:10:29 +00:00
|
|
|
builders.push_back(std::make_unique<FieldDefineBuilder>());
|
2019-11-22 11:57:17 +00:00
|
|
|
for(auto& peripheral : peripherals){
|
|
|
|
builders.push_back(std::make_unique<PeripheralBuilder>(peripheral));
|
|
|
|
}
|
2019-12-02 09:10:29 +00:00
|
|
|
builders.push_back(std::make_unique<FunctionsBuilder>());
|
2019-11-22 11:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ClassBuilder::build(){
|
|
|
|
for(auto& builder : builders){
|
|
|
|
builder->build(outputStream);
|
|
|
|
}
|
2019-12-02 09:47:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const std::stringstream& ClassBuilder::getStream() const{
|
|
|
|
return outputStream;
|
2019-11-22 11:57:17 +00:00
|
|
|
}
|