[3.0] Update command-line string & comment for view mode
[platform/core/uifw/dali-adaptor.git] / adaptors / common / command-line-options.cpp
index a784a80..fd4b293 100644 (file)
@@ -24,9 +24,7 @@
 #include <string.h>
 #include <iostream>
 
-#include <dali/public-api/common/vector-wrapper.h>
-
-using namespace std;
+#include <dali/public-api/common/dali-vector.h>
 
 namespace Dali
 {
@@ -46,13 +44,13 @@ struct Argument
 
   void Print()
   {
-    const ios_base::fmtflags flags = cout.flags();
-    cout << left << "  --";
-    cout.width( 18 );
-    cout << opt;
-    cout << optDescription;
-    cout << endl;
-    cout.flags( flags );
+    const std::ios_base::fmtflags flags = std::cout.flags();
+    std::cout << std::left << "  --";
+    std::cout.width( 18 );
+    std::cout << opt;
+    std::cout << optDescription;
+    std::cout << std::endl;
+    std::cout.flags( flags );
   }
 };
 
@@ -62,7 +60,7 @@ Argument EXPECTED_ARGS[] =
   { "width",       "Stage Width"             },
   { "height",      "Stage Height"            },
   { "dpi",         "Emulated DPI"            },
-  { "view",        "Stereocopic 3D view mode ([0]=MONO, 1=STEREO_HORZ, 2=STEREO_VERT, 3=STEREO_INTERLACED)" },
+  { "view",        "Stereocopic 3D view mode ([0]=MONO, 1=STEREO_HORIZONTAL, 2=STEREO_VERTICAL, 3=STEREO_INTERLACED)" },
   { "stereo-base", "Distance in millimeters between left/right cameras [65.0]" },
   { "help",        "Help"                    },
   { NULL,          NULL                      }
@@ -79,11 +77,11 @@ enum Option
   OPTION_HELP
 };
 
-typedef vector< int > UnhandledContainer;
+typedef Dali::Vector< int > UnhandledContainer;
 
 void ShowHelp()
 {
-  cout << "Available options:" << endl;
+  std::cout << "Available options:" << std::endl;
   Argument* arg = EXPECTED_ARGS;
   while ( arg->opt )
   {
@@ -100,6 +98,12 @@ CommandLineOptions::CommandLineOptions(int *argc, char **argv[])
   viewMode(0),
   stereoBase(65)
 {
+  // Exit gracefully if no arguments provided
+  if ( !argc || !argv )
+  {
+    return;
+  }
+
   if ( *argc > 1 )
   {
     // We do not want to print out errors.
@@ -203,7 +207,7 @@ CommandLineOptions::CommandLineOptions(int *argc, char **argv[])
 
         default:
         {
-          unhandledOptions.push_back( optind - 1 );
+          unhandledOptions.PushBack( optind - 1 );
           break;
         }
       }
@@ -212,17 +216,17 @@ CommandLineOptions::CommandLineOptions(int *argc, char **argv[])
     // Take out the options we have processed
     if ( optionProcessed )
     {
-      if ( !unhandledOptions.empty() )
+      if ( unhandledOptions.Count() > 0 )
       {
         int index( 1 );
 
         // Overwrite the argv with the values from the unhandled indices
-        const UnhandledContainer::const_iterator endIter = unhandledOptions.end();
-        for ( UnhandledContainer::iterator iter = unhandledOptions.begin(); iter != endIter; ++iter )
+        const UnhandledContainer::ConstIterator endIter = unhandledOptions.End();
+        for ( UnhandledContainer::Iterator iter = unhandledOptions.Begin(); iter != endIter; ++iter )
         {
           (*argv)[ index++ ] = (*argv)[ *iter ];
         }
-        *argc = unhandledOptions.size() + 1; // +1 for the program name
+        *argc = unhandledOptions.Count() + 1; // +1 for the program name
       }
       else
       {