Skip to content
Snippets Groups Projects
Commit e1d15c98 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

raw file type

parent 8d5f9dff
No related branches found
No related tags found
No related merge requests found
Pipeline #
LIBRARY:=alib2cli
TESTBIN:=alib2test
 
LINK_LIBRARIES=alib2str alib2data alib2xml alib2common alib2abstraction alib2measure alib2std
LINK_LIBRARIES=alib2raw alib2str alib2data alib2xml alib2common alib2abstraction alib2measure alib2std
SYSTEM_LIBRARIES=xml2 stdc++fs
SYSTEM_INCLUDE_PATHS=/usr/include/libxml2
TEST_LINK_LIBRARIES=
......
......@@ -2,6 +2,7 @@
 
#include <registry/XmlRegistry.h>
#include <registry/StringReaderRegistry.hpp>
#include <registry/RawReaderRegistry.hpp>
 
#include <abstraction/ImmediateValueAbstraction.hpp>
#include <abstraction/XmlTokensParserAbstraction.hpp>
......@@ -77,8 +78,31 @@ namespace {
return res;
}
 
std::shared_ptr < abstraction::OperationAbstraction > dummy4 ( const std::string & typehint, const ext::vector < std::string > & ) {
ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > abstractions;
ext::vector < std::string > templateParams;
ext::vector < std::string > paramTypes { ext::to_string < std::string > ( ) };
abstraction::AlgorithmCategories::AlgorithmCategory category = abstraction::AlgorithmCategories::AlgorithmCategory::NONE;
abstractions.push_back ( abstraction::Registry::getAlgorithmAbstraction ( "cli::builtin::ReadFile", templateParams, paramTypes, category ) );
auto rawParserAbstractionFinder = [ = ] ( const std::string & ) {
return abstraction::RawReaderRegistry::getAbstraction ( typehint );
};
abstractions.push_back ( std::make_shared < abstraction::WrapperAbstraction < abstraction::UnspecifiedType, std::string && > > ( rawParserAbstractionFinder ) );
std::shared_ptr < abstraction::PackingAbstraction < 1 > > res = std::make_shared < abstraction::PackingAbstraction < 1 > > ( std::move ( abstractions ), 1 );
res->setInnerConnection ( 0, 1, 0, true );
res->setOuterConnection ( 0, 0, 0 );
return res;
}
auto xmlInputFileHandler = registration::InputFileRegister ( "xml", dummy );
auto fileInputFileHandler = registration::InputFileRegister ( "file", dummy2 );
auto stringInputFileHandler = registration::InputFileRegister ( "string", dummy3 );
auto rawInputFileHandler = registration::InputFileRegister ( "raw", dummy4 );
 
}
......@@ -4,6 +4,7 @@
 
#include <registry/XmlRegistry.h>
#include <registry/StringWriterRegistry.hpp>
#include <registry/RawWriterRegistry.hpp>
 
#include <abstraction/ImmediateValueAbstraction.hpp>
#include <abstraction/XmlTokensComposerAbstraction.hpp>
......@@ -54,8 +55,28 @@ namespace {
return res;
}
 
std::shared_ptr < abstraction::OperationAbstraction > dummy4 ( const std::string & typehint ) {
ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > abstractions;
abstractions.push_back ( abstraction::RawWriterRegistry::getAbstraction ( typehint ) );
ext::vector < std::string > templateParams;
ext::vector < std::string > paramTypes { ext::to_string < std::string > ( ), ext::to_string < std::string > ( ) };
abstraction::AlgorithmCategories::AlgorithmCategory category = abstraction::AlgorithmCategories::AlgorithmCategory::NONE;
abstractions.push_back ( abstraction::Registry::getAlgorithmAbstraction ( "cli::builtin::WriteFile", templateParams, paramTypes, category ) );
std::shared_ptr < abstraction::PackingAbstraction < 2 > > res = std::make_shared < abstraction::PackingAbstraction < 2 > > ( std::move ( abstractions ), 1 );
res->setInnerConnection ( 0, 1, 1, true );
res->setOuterConnection ( 0, 1, 0 ); // filename
res->setOuterConnection ( 1, 0, 0 ); // data
return res;
}
auto xmlOutputFileHandler = registration::OutputFileRegister ( "xml", dummy );
auto fileOutputFileHandler = registration::OutputFileRegister ( "file", dummy2 );
auto stringOutputFileHandler = registration::OutputFileRegister ( "string", dummy3 );
auto rawOutputFileHandler = registration::OutputFileRegister ( "raw", dummy4 );
 
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment