From 3b8109daecc1c12359d27896686ff63b7ec03a22 Mon Sep 17 00:00:00 2001 From: Denis Oliver Kropp Date: Thu, 21 Oct 2010 10:25:07 +0200 Subject: new update mechanism --- src/Options.cxx | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/Options.cxx') diff --git a/src/Options.cxx b/src/Options.cxx index 27e8924..f68b0f3 100644 --- a/src/Options.cxx +++ b/src/Options.cxx @@ -196,6 +196,48 @@ class Options } }; + public class OptionRectangle extends Option { + private DFBRectangle &m_value; + + public OptionRectangle( const char *short_name, + const char *long_name, + const char *arg_name, + const char *arg_desc, + DFBRectangle &value ) : Option( short_name, long_name, arg_name, arg_desc ), m_value( value ) + { + } + + public virtual bool Parse( const char *arg ) { + if (sscanf( arg, "%d,%d-%dx%d", &m_value.x, &m_value.y, &m_value.w, &m_value.h ) != 4) { + D_ERROR( "Option/Rectangle: Invalid argument to '%s' or '%s'!\n", m_short_name, m_long_name ); + return false; + } + + return true; + } + }; + + public class OptionLocation extends Option { + private DFBLocation &m_value; + + public OptionLocation( const char *short_name, + const char *long_name, + const char *arg_name, + const char *arg_desc, + DFBLocation &value ) : Option( short_name, long_name, arg_name, arg_desc ), m_value( value ) + { + } + + public virtual bool Parse( const char *arg ) { + if (sscanf( arg, "%f,%f-%fx%f", &m_value.x, &m_value.y, &m_value.w, &m_value.h ) != 4) { + D_ERROR( "Option/Location: Invalid argument to '%s' or '%s'!\n", m_short_name, m_long_name ); + return false; + } + + return true; + } + }; + private vector m_options; -- cgit