OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine/base64.cpp

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

#include <eagine/main.hpp>
#include <iostream>
namespace eagine {
auto main(main_ctx& ctx) -> int {
std::string na{"-"};
std::string temp;
for(auto& arg : ctx.args()) {
if(!arg.starts_with("-")) {
if(arg.prev().is_tag("-f", "--file")) {
file_contents fc(arg.get());
std::cout << arg << '|'
<< extract_or(base64_encode(fc.block(), temp), na)
<< std::endl;
} else if(arg.prev().is_tag("-s", "--string")) {
std::cout << arg << '|'
<< extract_or(base64_encode(arg.block(), temp), "-")
<< std::endl;
}
}
}
return 0;
}
} // namespace eagine
Common code is placed in this namespace.
Definition: eagine.hpp:21

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).