cpp-subprocess/test/test_main.cc
xoviat f6799fcc34 WIP: add windows compatibility (#32)
* windows: add util functions

* windows: add cmake files

* windows: add travis.yml

* windows: address compatibility
- set cxx standard
- conditionally exclude codecvt

* windows: improve test coverage

* windows: improve test coverage

* windows: consolidate tests

* windows: disable failing test

* windows: modify read_atmost_n to use file object

* windows: modify read_all to use file object

* windows: update read_all test to use new api

* windows: implement main subprocess logic

* windows: add macro names

* windows: setup comm channels

* windows: compatibility fixes
2019-05-09 22:02:58 +05:30

43 lines
944 B
C++

#include <iostream>
#include <utility>
struct bufsize { int siz_; };
struct executable { std::string exe_; };
class Ex {
public:
template <typename... Args>
Ex(Args&&... args) {
set_options(std::forward<Args>(args)...);
}
template <typename T>
void set_options(T&& arg) {
set_option(std::forward<T>(arg));
}
template <typename T, typename... Args>
void set_options(T&& first, Args&&... rem_args) {
set_option(std::forward<T>(first));
set_options(std::forward<Args>(rem_args)...);
}
void set_option(bufsize&& bufs) {
std::cout << "bufsize opt" << std::endl;
bufsiz_ = bufs.siz_;
}
void set_option(executable&& exe) {
std::cout << "exe opt" << std::endl;
exe_name_ = std::move(exe.exe_);
}
private:
int bufsiz_ = 0;
std::string exe_name_;
};
int main() {
Ex e(bufsize{1}, executable{"finger"});
return 0;
}