diff options
Diffstat (limited to 'src/Options.cxx')
-rw-r--r-- | src/Options.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
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<Option*> m_options; |