⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 advconsole.h

📁 C++ image processing.Mainly it occupies some filters to detect some prperties of image. Release.
💻 H
字号:
#ifndef _advconsole_h_
#define _advconsole_h_

/* 

This "SOFTWARE" is a free software.

You are allowed to download, use, modify and redistribute this software.
The software is provided "AS IS" without warranty of any kind.

Copyright: University of Koblenz-Landau

*/

/***********************************************
  Advanced Tools Version 1.0
  
  Copyright 2002, Patrick Sturm
************************************************/

#pragma warning( disable : 4786) // supress "Bezeichner wurde auf '255' Zeichen in den Browser-Informationen reduziert"

#include <string>
#include <map>
#include <vector>
#include <set>


/** Commandline parser. 
	Usage: Longname=Value OR shortname value OR -shortname value
	When using the parser: always access variables by longnames!
	Shortnames are only used at commandline!
	[style: e.g. command [option1, option2, ... switch1, option3, ..,] parameter_obligatory1, parameter_obligatory2, ..., parameter_obligatory_n]

	\bugs switches and obligatory parameters does not work 
*/
class advConsoleParameters
{
private:
  std::vector<std::string> obligatoryParameters;
  std::vector<std::string> obligatoryParameterValues;
  std::map<std::string, std::string> helpStr; // was optionSwitchHelp and optionPropertyHelp and obligatoryParameterHelp (db)
  std::map<std::string, bool> optionSwitchValues;
  std::map<std::string, std::string> optionFullnames;
  std::map<std::string, std::string> optionPropertyValues;
  std::string programName;

protected:
  virtual bool checkParameter(const std::string& name, const std::string& value);
  virtual void parseError(const std::string& message);

public:
  /// add a switch (=boolean property, set or not set)
  void addOptionSwitch(const std::string& LongName, const std::string& help = "");
  /// add a mandatory parameter
  void addObligatoryParameter(const std::string& LongName,  const std::string& help);
  /// get mandatory parameter. (still buggy)
  const std::string &getObligatoryParameter(const std::string& LongName);
  /// get switch. (still buggy)
  bool isSwitchEnabled(const std::string& name);

  advConsoleParameters(const std::string& initProgramName = "");
  virtual ~advConsoleParameters() {};
  /// add a property (name, value)
  void addOptionProperty(const std::string& shortName, const std::string& LongName, const std::string& defaultValue="", const std::string& help = "");
  /** get help string for property, obligatory parameter or switch. 
		\parameter name "full name" or "short name"
		\rvalue help string
  */
  std::string GetHelp(const std::string& LongName){return helpStr[LongName];}
  /// parse arc arguments of argv (parseCommandLine(argc-1, (const char**)&argv[1]); in most cases)
  int parseCommandLine(int argc, const char* argv[]);
  /// create a string with all options and help for options
  std::string GetHelp();
  /** get the value of an option. 
	\param name long name of option
  */
  const std::string &getOptionProperty(const std::string& LongName); 
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -