Fixed some windows issues

This commit is contained in:
2024-12-06 16:27:19 +01:00
parent fd62fb822d
commit f73ca0eaec
4 changed files with 27 additions and 13 deletions

View File

@ -95,12 +95,12 @@ class ArgManager {
template<typename T>
std::optional<T> get(const int id) {
if(id < pos_argument.size()) return Argument<T>::get(pos_argument[id]);
std::optional<T> get(const unsigned int id) {
if((unsigned int) id < pos_argument.size()) return Argument<T>::get(pos_argument[id]);
return std::make_optional<T>();
}
std::istream& get_input(const int id) {
std::istream& get_input(const unsigned int id) {
if(id < pos_argument.size()) return ArgInput::get(pos_argument[id]);
return util::cin;
}
@ -171,7 +171,7 @@ class ArgFactory {
if(flag) {
parse_flag(manager, flag);
}
int i = 0;
unsigned int i = 0;
for(const auto& arg : vec) {
std::shared_ptr<_Argument> a;
if(i >= pos_arg_rules.size()) throw std::invalid_argument("More arguments then excpected");

View File

@ -3,6 +3,10 @@
#include <istream>
#include <streambuf>
#ifdef _WIN32
#include <iostream>
#endif
namespace fsh::util
{
@ -16,7 +20,7 @@ namespace fsh::util
*/
void prepTerminal();
#if defined(__unix__) || defined(__APPLE__)
#ifndef _WIN32
class CursorIStreamBuffer : public std::streambuf {
public:
@ -52,9 +56,12 @@ public:
private:
CursorIStreamBuffer buffer;
};
extern CursorIStream cin;
#else
extern std::istream& cin;
#endif