2012-01-06 04:12:57 +00:00
|
|
|
/* ASEPRITE
|
2012-01-06 03:52:11 +00:00
|
|
|
* Copyright (C) 2001-2012 David Capello
|
2010-01-29 00:53:53 +00:00
|
|
|
*
|
|
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2010-07-16 20:00:37 +00:00
|
|
|
#ifndef CHECK_ARGS_H_INCLUDED
|
|
|
|
#define CHECK_ARGS_H_INCLUDED
|
2010-01-29 00:53:53 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2010-09-28 18:36:03 +00:00
|
|
|
#include "base/string.h"
|
2010-03-13 01:16:05 +00:00
|
|
|
|
2010-09-18 20:36:21 +00:00
|
|
|
// Parses the input arguments in the command line.
|
2010-01-29 00:53:53 +00:00
|
|
|
class CheckArgs
|
|
|
|
{
|
|
|
|
public:
|
2010-09-18 20:36:21 +00:00
|
|
|
// Represents one specifial option specified in the parameters that
|
|
|
|
// need some special operation by the application class.
|
2010-01-29 00:53:53 +00:00
|
|
|
class Option
|
|
|
|
{
|
|
|
|
int m_type;
|
2010-09-28 18:36:03 +00:00
|
|
|
base::string m_data;
|
2010-01-29 00:53:53 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
OpenSprite,
|
|
|
|
};
|
|
|
|
|
2010-09-28 18:36:03 +00:00
|
|
|
Option(int type, const base::string& data) : m_type(type), m_data(data) { }
|
2010-01-29 00:53:53 +00:00
|
|
|
|
|
|
|
int type() const { return m_type; }
|
2010-09-28 18:36:03 +00:00
|
|
|
const base::string& data() const { return m_data; }
|
2010-01-29 00:53:53 +00:00
|
|
|
};
|
|
|
|
|
2010-09-18 20:36:21 +00:00
|
|
|
typedef std::vector<Option*> Options;
|
|
|
|
typedef Options::iterator iterator;
|
2012-01-05 22:45:03 +00:00
|
|
|
|
2010-09-28 18:36:03 +00:00
|
|
|
CheckArgs(const std::vector<base::string>& args);
|
2010-01-29 00:53:53 +00:00
|
|
|
~CheckArgs();
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
iterator begin() { return m_options.begin(); }
|
|
|
|
iterator end() { return m_options.end(); }
|
|
|
|
|
2010-09-28 18:36:03 +00:00
|
|
|
base::string getPaletteFilename() const { return m_paletteFilename; }
|
2010-01-29 00:53:53 +00:00
|
|
|
|
2010-09-18 20:36:21 +00:00
|
|
|
bool isConsoleOnly() const { return m_consoleOnly; }
|
|
|
|
bool isVerbose() const { return m_verbose; }
|
|
|
|
|
2010-01-29 00:53:53 +00:00
|
|
|
private:
|
2010-03-13 01:16:05 +00:00
|
|
|
void usage(bool showHelp);
|
2010-01-29 00:53:53 +00:00
|
|
|
|
2010-09-18 20:36:21 +00:00
|
|
|
Options m_options;
|
2010-09-28 18:36:03 +00:00
|
|
|
base::string m_paletteFilename;
|
|
|
|
base::string m_exeName;
|
2010-09-18 20:36:21 +00:00
|
|
|
bool m_consoleOnly;
|
|
|
|
bool m_verbose;
|
2010-01-29 00:53:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|