changeset 500:d8ed4da7688c

Options: new braces style
author David Demelier <markand@malikania.fr>
date Wed, 27 Jan 2016 19:53:10 +0100
parents ff8f81775564
children 4c786b58eacd
files modules/options/options.cpp
diffstat 1 files changed, 10 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/modules/options/options.cpp	Wed Jan 27 19:45:19 2016 +0100
+++ b/modules/options/options.cpp	Wed Jan 27 19:53:10 2016 +0100
@@ -52,15 +52,13 @@
 	auto arg = *it++;
 	auto opt = definition.find(arg);
 
-	if (opt == definition.end()) {
+	if (opt == definition.end())
 		throw InvalidOption{arg};
-	}
 
 	/* Need argument? */
 	if (opt->second) {
-		if (it == end || isOption(*it)) {
+		if (it == end || isOption(*it))
 			throw MissingValue{arg};
-		}
 
 		result.insert(std::make_pair(arg, *it++));
 		it = args.erase(args.begin(), it);
@@ -84,15 +82,13 @@
 		auto arg = *it++;
 		auto opt = definition.find(arg);
 
-		if (opt == definition.end()) {
+		if (opt == definition.end())
 			throw InvalidOption{arg};
-		}
 
 		/* Need argument? */
 		if (opt->second) {
-			if (it == end || isOption(*it)) {
+			if (it == end || isOption(*it))
 				throw MissingValue{arg};
-			}
 
 			result.insert(std::make_pair(arg, *it++));
 			it = args.erase(args.begin(), it);
@@ -118,16 +114,14 @@
 			auto arg = std::string{'-'} + value[i];
 			auto opt = definition.find(arg);
 
-			if (opt == definition.end()) {
+			if (opt == definition.end())
 				throw InvalidOption{arg};
-			}
 
 			if (opt->second) {
 				if (i == (len - 1)) {
 					/* End of string, get the next argument (see 2.) */
-					if (++it == end || isOption(*it)) {
+					if (++it == end || isOption(*it))
 						throw MissingValue{arg};
-					}
 
 					result.insert(std::make_pair(arg, *it));
 					toremove += 1;
@@ -155,15 +149,13 @@
 	auto end = args.end();
 
 	while (it != end) {
-		if (!isOption(*it)) {
+		if (!isOption(*it))
 			break;
-		}
 
-		if (isLongOption(*it)) {
+		if (isLongOption(*it))
 			parseLongOption(result, args, it, end, definition);
-		} else {
+		else
 			parseShortOption(result, args, it, end, definition);
-		}
 	}
 
 	return result;
@@ -173,9 +165,8 @@
 {
 	std::vector<std::string> args;
 
-	for (int i = 0; i < argc; ++i) {
+	for (int i = 0; i < argc; ++i)
 		args.push_back(argv[i]);
-	}
 
 	auto before = args.size();
 	auto result = read(args, definition);