Refactored arguments
This commit is contained in:
26
include/cmd/args/arg_input.hpp
Normal file
26
include/cmd/args/arg_input.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "cmd/args/arg_base.hpp"
|
||||
|
||||
namespace fsh{
|
||||
|
||||
class ArgInput : public _Argument {
|
||||
public:
|
||||
static std::istream& get(std::shared_ptr<_Argument> a) {
|
||||
return std::dynamic_pointer_cast<ArgInput>(a)->gvalue();
|
||||
}
|
||||
|
||||
ArgInput() {}
|
||||
|
||||
virtual void svalue(const std::string& val, const Lexer::TokenType& type) override;
|
||||
virtual std::istream& gvalue();
|
||||
|
||||
private:
|
||||
std::optional<std::stringstream> str;
|
||||
std::optional<std::ifstream> file;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user