optionparser.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA 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 3 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 MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ph_optionparser_hh
#define ph_optionparser_hh
#include <list>
#include <map>
#include <string>
#include <vector>
#include <mia/core/defines.hh>
NS_MIA_BEGIN
typedef std::map<std::string, std::string> CParsedOptions;
class EXPORT_CORE CComplexOptionParser
{
public:
typedef char SSeperators[];
typedef std::vector<std::pair<std::string, CParsedOptions>> CParts;
typedef CParts::const_iterator const_iterator;
CComplexOptionParser(const std::string& param);
const_iterator begin()const;
const_iterator end() const;
CParts::size_type size()const;
static void set_seperators(SSeperators sep);
private:
int split(const std::string& s, char c, std::list<std::string>& result)const;
CParsedOptions::value_type split_pair_b(const std::string& s, char c)const;
CParsedOptions::value_type split_pair(const std::string& s, char c)const;
CParts m_Parts;
static char m_parts_seperator;
static char m_part_options;
static char m_option_seperator;
static char m_assignment_seperator;
};
NS_MIA_END
#endif
CComplexOptionParser::begin
const_iterator begin() const
CComplexOptionParser::set_seperators
static void set_seperators(SSeperators sep)
CComplexOptionParser::const_iterator
CParts::const_iterator const_iterator
the iterator over the parts of a complex option
Definition optionparser.hh:67
CComplexOptionParser::CParts
std::vector< std::pair< std::string, CParsedOptions > > CParts
Type for a map of parts of a complex option.
Definition optionparser.hh:64
CComplexOptionParser::CComplexOptionParser
CComplexOptionParser(const std::string &param)
CComplexOptionParser::SSeperators
char SSeperators[]
Definition optionparser.hh:61
CComplexOptionParser::end
const_iterator end() const
CComplexOptionParser::size
CParts::size_type size() const
defines.hh
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
CParsedOptions
std::map< std::string, std::string > CParsedOptions
Definition optionparser.hh:38