From: Timo Lotterbach Date: Wed, 26 Oct 2011 10:33:01 +0000 (+0200) Subject: Mock Navi: added support for unsigned integer arguments X-Git-Tag: cassini_release~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7709d43113789b71e277624e2a8ed134e2028cbe;p=profile%2Fivi%2Flayer-management.git Mock Navi: added support for unsigned integer arguments --- diff --git a/LayerManagerExamples/EGLX11MockNavigation/include/Argument.h b/LayerManagerExamples/EGLX11MockNavigation/include/Argument.h index 8ca610e..0bca6f5 100644 --- a/LayerManagerExamples/EGLX11MockNavigation/include/Argument.h +++ b/LayerManagerExamples/EGLX11MockNavigation/include/Argument.h @@ -43,10 +43,19 @@ private: class IntArgument { public: IntArgument(string name, int default_value, int argc, const char * const argv[]); - float get(); + int get(); private: int value; }; +class UnsignedIntArgument { +public: + UnsignedIntArgument(string name, unsigned int default_value, int argc, const char * const argv[]); + unsigned int get(); + +private: + unsigned int value; +}; + #endif diff --git a/LayerManagerExamples/EGLX11MockNavigation/src/Argument.cpp b/LayerManagerExamples/EGLX11MockNavigation/src/Argument.cpp index cf1ff5b..f3cbea0 100644 --- a/LayerManagerExamples/EGLX11MockNavigation/src/Argument.cpp +++ b/LayerManagerExamples/EGLX11MockNavigation/src/Argument.cpp @@ -85,7 +85,34 @@ IntArgument::IntArgument(string name, int default_value, int argc, const char * } } -float IntArgument::get() +int IntArgument::get() +{ + return value; +} + + +UnsignedIntArgument::UnsignedIntArgument(string name, unsigned int default_value, int argc, const char * const argv[]) +: value(default_value) +{ + for (int arg = 1; arg < argc; ++arg) + { + char dummy[] = ""; + const char* lpArgNow = argv[arg]; + const char* lpArgNext = dummy; + + if (arg != argc - 1) + { + lpArgNext = argv[arg + 1]; + } + + if ((lpArgNow[0] == '-') && (name == &lpArgNow[1])) + { + value = atoll(lpArgNext); + } + } +} + +unsigned int UnsignedIntArgument::get() { return value; }