Add class to handle command line args in the Tools App

This commit is contained in:
2015-02-24 01:45:54 +00:00
parent 6ff4a53d87
commit e924a06a9e
6 changed files with 105 additions and 14 deletions
+1 -1
View File
@@ -9,9 +9,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../ )
set(plaYUver_Tools_SRCS
# Main
main.cpp
PlaYUVerTools.cpp
CommandLineHandle.cpp
)
ADD_EXECUTABLE( ${PROJECT_NAME}Tools ${plaYUver_Tools_SRCS} )
+41
View File
@@ -0,0 +1,41 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file CommandLineHandle.cpp
* \brief Handle for command line
*/
#include "CommandLineHandle.h"
namespace plaYUVer
{
CommandLineHandle::CommandLineHandle()
{
}
CommandLineHandle::~CommandLineHandle()
{
}
} // NAMESPACE
+46
View File
@@ -0,0 +1,46 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file CommandLineHandle.h
* \brief Handle for command line
*/
#ifndef __COMMANDLINEHANDLE_H__
#define __COMMANDLINEHANDLE_H__
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#include "lib/PlaYUVerCmdParser.h"
namespace plaYUVer
{
class CommandLineHandle: public PlaYUVerCmdParser
{
public:
CommandLineHandle();
~CommandLineHandle();
};
} // NAMESPACE
#endif // __COMMANDLINEHANDLE_H__
+3 -3
View File
@@ -52,7 +52,7 @@ Int PlaYUVerTools::openInputs()
*/
if( m_cCommandLineParser.getOptionsMap().count( "input" ) )
{
std::string resolutionString;
std::string resolutionString("");
if( m_cCommandLineParser.getOptionsMap().count( "size" ) )
{
resolutionString = m_cCommandLineParser.getOptionsMap()["size"].as<std::string>();
@@ -80,8 +80,8 @@ Int PlaYUVerTools::openInputs()
}
catch( const char *msg )
{
printf( "Cannot open input stream %s with the following error: \n%s", inputFileNames[i].c_str(), msg );
return false;
printf( "Cannot open input stream %s with the following error: \n%s\n", inputFileNames[i].c_str(), msg );
return 2;
}
}
m_uiNumberOfFrames = MAX_UINT;
+6 -6
View File
@@ -22,14 +22,14 @@
* \brief Main definition of the PlaYUVerTools app
*/
#ifndef __PLAYUVERAPP_H__
#define __PLAYUVERAPP_H__
#ifndef __PLAYUVERTOOLS_H__
#define __PLAYUVERTOOLS_H__
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#include <lib/PlaYUVerCmdParser.h>
#include <lib/PlaYUVerFrame.h>
#include <lib/PlaYUVerStream.h>
#include "lib/PlaYUVerFrame.h"
#include "lib/PlaYUVerStream.h"
#include "CommandLineHandle.h"
namespace plaYUVer
{
@@ -45,7 +45,7 @@ public:
Int Close();
private:
PlaYUVerCmdParser m_cCommandLineParser;
CommandLineHandle m_cCommandLineParser;
UInt m_uiOperation;
Int m_uiOperationIndex;