Permalink
Browse files

Merge pull request #11 from steinwurf/fix-style

Fix style
  • Loading branch information...
petya2164 committed Sep 24, 2016
2 parents 47ca8ed + 516dde8 commit 613361d844d529ddb4a754cd80863b153ec8a226
Showing with 256 additions and 246 deletions.
  1. +23 −15 examples/simple/program.cpp
  2. +21 −21 src/skipper/any.hpp
  3. +143 −143 src/skipper/program.hpp
  4. +30 −30 src/skipper/range.hpp
  5. +27 −27 src/skipper/set.hpp
  6. +1 −1 test/skipper_tests.cpp
  7. +11 −9 test/src/test_program.cpp
@@ -9,34 +9,41 @@
int main()
{
// dummy functions called by the program
auto function_str =
[](std::string s){std::cout << "called with: " << s << std::endl;};
auto function_str = [](std::string s)
{
std::cout << "called with: " << s << std::endl;
};
auto function_int =
[](int i){std::cout << "called with: " << i << std::endl;};
auto function_int = [](int i)
{
std::cout << "called with: " << i << std::endl;
};
auto function_float =
[](float f){std::cout << "called with: " << f << std::endl;};
auto function_float = [](float f)
{
std::cout << "called with: " << f << std::endl;
};
auto print_function =
[](){std::cout << "prints some useful value" << std::endl;};
auto print_function = []()
{
std::cout << "prints some useful value" << std::endl;
};
using tuple_type = std::tuple<std::string, int>;
auto function_str_int_tuple = [](tuple_type t)
{
(void)t;
std::cout << "called with: "
<< std::get<0>(t) << ", " << std::get<1>(t) << std::endl;
std::cout << "called with: " << std::get<0>(t) << ", "
<< std::get<1>(t) << std::endl;
};
auto tuple_convert = [](std::istream& in)
{
auto v1 = skipper::default_convert<
typename std::tuple_element<0, tuple_type>::type>(in);
typename std::tuple_element<0, tuple_type>::type>(in);
auto v2 = skipper::default_convert<
typename std::tuple_element<1, tuple_type>::type>(in);
typename std::tuple_element<1, tuple_type>::type>(in);
return std::make_tuple(v1, v2);
};
@@ -57,8 +64,9 @@ int main()
// add a command that takes any string followed by any int as input
p.add_command<tuple_type>("d", "some help text for d",
function_str_int_tuple, skipper::any<tuple_type>(),
tuple_convert);
function_str_int_tuple,
skipper::any<tuple_type>(),
tuple_convert);
// add a command that prints something useful
p.add_command("p", "print something", print_function);
View
@@ -11,27 +11,27 @@
namespace skipper
{
/// validates true no matter what value provided
template<typename Type>
struct any
/// validates true no matter what value provided
template<typename Type>
struct any
{
/// check if a value is ok to use
/// @param value the value to check
/// @return wether the provided value checked
bool operator()(const Type value) const
{
/// check if a value is ok to use
/// @param value the value to check
/// @return wether the provided value checked
bool operator()(const Type value) const
{
(void) value;
return true;
}
(void) value;
return true;
}
/// print help text by overloading the << operator
/// @param os an output stream
/// @param s a set
/// @return friendly help stream
friend std::ostream& operator<<(std::ostream& os, const any &a)
{
(void) a;
return os << "of type " << typeid(Type).name() << " of any value";
}
};
/// print help text by overloading the << operator
/// @param os an output stream
/// @param s a set
/// @return friendly help stream
friend std::ostream& operator<<(std::ostream& os, const any& a)
{
(void) a;
return os << "of type " << typeid(Type).name() << " of any value";
}
};
}
Oops, something went wrong.

0 comments on commit 613361d

Please sign in to comment.