From 0641e7e5bedbba81adf85f920efaf4c0c49c864e Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 17 Jan 2008 17:56:45 +0000 Subject: [PATCH] Move the knowledge about which flags require an extra value into a separate function. We're going to need it to fix bug #1695735. git-svn-id: http://svn.voria.com/code@1396 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/tool/main.cpp | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/synfig-core/trunk/src/tool/main.cpp b/synfig-core/trunk/src/tool/main.cpp index 63a387c..7e5b189 100644 --- a/synfig-core/trunk/src/tool/main.cpp +++ b/synfig-core/trunk/src/tool/main.cpp @@ -520,6 +520,15 @@ int process_global_flags(arg_list_t &arg_list) return SYNFIGTOOL_OK; } +/* true if the given flag takes an extra parameter */ +bool flag_requires_value(String flag) { + return (flag=="-a" || flag=="-c" || flag=="-g" || flag=="-h" || flag=="-o" || + flag=="-Q" || flag=="-s" || flag=="-t" || flag=="-T" || flag=="-w" || + flag=="--append" || flag=="--begin-time" || flag=="--dpi" || flag=="--dpi-x" || + flag=="--dpi-y" || flag=="--end-frame" || flag=="--end-time" || flag=="--fps" || + flag=="--frame" || flag=="--start-frame" || flag=="--start-time" || flag=="--time" ); +} + int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster) { arg_list_t::iterator iter, next; @@ -532,29 +541,7 @@ int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster) return SYNFIGTOOL_OK; } - if( - *iter=="-t" || - *iter=="-w" || - *iter=="-h" || - *iter=="-a" || - *iter=="-g" || - *iter=="-o" || - *iter=="-s" || - *iter=="-Q" || - *iter=="-c" || - *iter=="--fps" || - *iter=="--start-time" || - *iter=="--begin-time" || - *iter=="--end-time" || - *iter=="--start-frame" || - *iter=="--end-frame" || - *iter=="--time" || - *iter=="--frame" || - *iter=="--dpi" || - *iter=="--dpi-x" || - *iter=="--dpi-y" || - *iter=="--append" || - *iter=="-T" ) + if (flag_requires_value(*iter)) { cluster.push_back(*iter); arg_list.erase(iter); -- 2.7.4