当前位置: 首页>>代码示例>>C++>>正文


C++ CommandLine::AddKey方法代码示例

本文整理汇总了C++中CommandLine::AddKey方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLine::AddKey方法的具体用法?C++ CommandLine::AddKey怎么用?C++ CommandLine::AddKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommandLine的用法示例。


在下文中一共展示了CommandLine::AddKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char* argv[])
{
  int               i;
  double            msec;
  double            decTime;
  double            encTime;
  Ipp8u*            buf;
  IM_TYPE           fmtIn;
  IM_TYPE           fmtOut;
  ExcStatus         res;
  CIppImage         image;
  CommandLine       cmdline;
  CFormatDetector   detector;
  BaseStream::TSize cnt;
  BaseStream::TSize size;
  bool              help_flag;
  bool              is_raw = false;

  CStdFileInput   fi;
  CStdFileOutput  fo;
  CMemBuffInput   mi;
  CMemBuffOutput  mo;

  CmdOptions cmdOptions;
  cmdOptions.loops = 1;
  ippStaticInit();

  copyright_();

  // Common params
  cmdline.AddKey("i","input file name", cmdOptions.src, 1, (StringA)"uic_test_image.jpg", IT_UNKNOWN);
  cmdline.AddKey("o","output file name (out.jp2 - default)", cmdOptions.dst, 1, (StringA)"out.jp2", IT_UNKNOWN);
  cmdline.AddKey("r","treat input image as raw (0 - default)", is_raw, 0, 0, IT_UNKNOWN);
  cmdline.AddKey("t","advanced timing, 0 - disable (default); 1 - enable", cmdOptions.timing, 1, 0, IT_UNKNOWN);
  cmdline.AddKey("m","number of loops for advanced timing (1 - default)", cmdOptions.loops, 1, 1, IT_UNKNOWN);
  cmdline.AddKey("d", "print problem diagnostics messages", cmdOptions.verbose_mode, 0, 0, IT_UNKNOWN);
  cmdline.AddKey("n","number of threads", cmdOptions.nthreads, 1, 0, IT_UNKNOWN);
  cmdline.AddKey("h","help key", help_flag, 0, 0, IT_UNKNOWN);

  cmdline.AddKey("W","width resolution", cmdOptions.res_width, 1, 0, IT_RAW);
  cmdline.AddKey("H","height resolution", cmdOptions.res_height, 1, 0, IT_RAW);
  cmdline.AddKey("D","data offset", cmdOptions.data_offset, 1, 0, IT_RAW);
  cmdline.AddKey("C","color format: gray, rgb (default), rgba, cmyk", cmdOptions.color_format, 1, (StringA)"rgb", IT_RAW);
  cmdline.AddKey("P","pixel format: 8u (default), 16u, 16s, 32u, 32s, 32f", cmdOptions.pixel_format, 1, (StringA)"8u", IT_RAW);

  cmdline.AddKey("q","quality [1...100]", cmdOptions.jpg_quality, 1, 100, IT_JPEG);
  cmdline.AddKey("s","sampling, 0 - 444 (default); 1 - 422; 2 - 411", cmdOptions.sampling, 1, 0, IT_JPEG);
  cmdline.AddKey("j","jpeg encoder mode: b - BASELINE (8-bit lossy); e - EXTENDED (12-bit lossy); p - PROGRESSIVE  (8-bit progressive); l - LOSSLESS (2-16 bit lossless)", cmdOptions.jmode, 1, (StringA)"b", IT_JPEG);

  cmdline.AddKey("q","quality [1...100]", cmdOptions.jpg_quality, 1, 100, IT_JPEG2000);
  cmdline.AddKey("l","encoding mode, 0 - lossy encode (default); 1 - lossless encoding", cmdOptions.lossless, 1, 0, IT_JPEG2000);

  cmdline.AddKey("f","activate all filters", cmdOptions.png_filter[4], 0, 0, IT_PNG);
  cmdline.AddKey("fs","add sub filter", cmdOptions.png_filter[0], 0, 0, IT_PNG);
  cmdline.AddKey("fu","add up filter", cmdOptions.png_filter[1], 0, 0, IT_PNG);
  cmdline.AddKey("fa","add average filter", cmdOptions.png_filter[2], 0, 0, IT_PNG);
  cmdline.AddKey("fp","add Paeth filter", cmdOptions.png_filter[3], 0, 0, IT_PNG);

  cmdline.AddKey("q","quality [1...255] (1 - lossless, default; less is better)", cmdOptions.jxr_quality, 1, 1, IT_JPEGXR);
  cmdline.AddKey("Q","planar alpha quality [1...255] (1 - lossless, default; less is better)", cmdOptions.jxr_aquality, 1, 1, IT_JPEGXR);
//  cmdline.AddKey("s","sampling, 0 - 444 (default); 1 - 422; 2 - 420", cmdOptions.sampling, 1, 0, IT_JPEGXR);
//  cmdline.AddKey("f","bitstream order, 0 - spatial (default); 1 - frequency", cmdOptions.bitstream, 1, 0, IT_JPEGXR);
  cmdline.AddKey("l","overlap mode, 0 - no overlap (default); 1 -  overlap one; 2 - overlap two", cmdOptions.overlap, 1, 0, IT_JPEGXR);
  cmdline.AddKey("a","alpha mode, 0 - interleaved alpha (default); 1 - planar alpha", cmdOptions.alpha_mode, 1, 0, IT_JPEGXR);
  cmdline.AddKey("F","trim flexbits [0...15] (0 - all flexbits, default; 15 - no flexbits)", cmdOptions.trim, 1, 0, IT_JPEGXR);
  cmdline.AddKey("b","bands mode, 0 - all bands (default); 1 - no flexbits; 2 - no highpass; 3 - dc only", cmdOptions.bands, 1, 0, IT_JPEGXR);
  cmdline.AddKey("c","encode CMYK images directly, without color conversion", cmdOptions.cmyk_direct, 0, 0, IT_JPEGXR);
  cmdline.AddKey("v","color conversion bits shift value for 16-bit and 32-bit images [0...32]", cmdOptions.bits_shift, 1, -1, IT_JPEGXR);
  cmdline.AddKey("U","amount of tiles per rows and columns (1 1 - default)", cmdOptions.tiles_amount[0], 2, 1, IT_JPEGXR);
  cmdline.AddKey("X","maximum tiles size in macroblocks (0 0 - default; 1 = 16px; override U argument)", cmdOptions.tiles_sizes[0], 2, 0, IT_JPEGXR);
#ifdef USE_TBB
  cmdline.AddKey("u","multithread mode, 0 - pipeline threading (threads limited to 3); 1 - tile threading (threads limited to number of tiles); 2 - mixed threading (default; threads limited to number of tiles + 3)", cmdOptions.jxr_thread_mode, 1, 2, IT_JPEGXR);
#endif

  if(argc == 1)
  {
    cmdline.HelpMessage(format_str);
    return -1;
  }

  if(!cmdline.Parse(argv, argc, IT_UNKNOWN, IT_UNKNOWN))
  {
    cmdline.HelpMessage(format_str);
    printf("Invalid argument!\n");
    return -1;
  }

  if(help_flag)
    cmdline.HelpMessage(format_str);

  fmtOut = ImageFormatFromExtension((const char*)cmdOptions.dst);
  if(IT_UNKNOWN == fmtOut || IT_DICOM == fmtOut)
  {
    printf("Unsupported output image format!\n");
    return -1;
  }

  if(!BaseStream::IsOk(fi.Open(cmdOptions.src)))
  {
    printf("Can not open input file!\n");
//.........这里部分代码省略.........
开发者ID:vinnie38170,项目名称:klImageCore,代码行数:101,代码来源:uic_transcoder_con.cpp

示例2: ui_HandleKeypress

sint32 ui_HandleKeypress(WPARAM wParam, LPARAM lParam)
{
    WORLD_DIRECTION	d;
    BOOL			move = FALSE;
#ifdef _PLAYTEST
    int i;
#endif
	BOOL isMyTurn = !g_network.IsActive() || g_network.IsMyTurn();
	Unit city;

	
	if ( g_isKMScreen) {
		switch(wParam) {
			case VK_ESCAPE:
			case VK_LEFT + 256:
			case VK_RIGHT + 256:
			case VK_UP + 256:
			case VK_DOWN + 256:
			case 29: 
			case 28: 
				
				return TRUE;
			default:
				
				km_screen_remapKey( wParam, lParam );
				return TRUE;
		}
	}
	
#ifdef _PLAYTEST
	if(commandMode) {
		switch(wParam) {
			case '\r' + 128: wParam = '\r'; break;
			case '\t' + 128: wParam = '\t'; break;
			case 8 + 128: wParam = 8; break;
		}
		commandMode = g_commandLine.AddKey(static_cast<char>(wParam));
		return TRUE;
	}
#endif






	
	if (wParam == VK_ESCAPE) {
		
		extern OptionsWindow *g_optionsWindow;
		
		if(g_c3ui->TopWindow() && g_c3ui->TopWindow() == DipWizard::GetWindow()) {
			
			
		} else if(g_keyboardHandlers.GetTail()) {
			g_keyboardHandlers.GetTail()->kh_Close();
		} else if (g_civApp->IsGameLoaded()) {
			if(g_currentMessageWindow && 
			   g_currentMessageWindow->GetMessage() &&
			   (g_theMessagePool->IsValid(*g_currentMessageWindow->GetMessage()))) {
				g_currentMessageWindow->GetMessage()->Minimize();
			} else if(g_modalMessage) {
				
				Message *msg = g_modalMessage->GetMessage();
				if(msg && g_theMessagePool->IsValid(*msg)) {
					Assert(msg->IsAlertBox());
					MessageData *data = msg->AccessData();
					if(data->GetNumButtons() <= 2 && data->GetNumButtons() > 0) {
						data->GetButton(0)->Callback();
					}
				}	
			} else if (g_optionsWindow && g_c3ui->GetWindow(g_optionsWindow->Id())) {
				
				optionsscreen_removeMyWindow(AUI_BUTTON_ACTION_EXECUTE);
			} else if(g_c3ui->TopWindow() && g_c3ui->TopWindow()->HandleKey(wParam)) {
				
			} else if(g_battleViewWindow) {
				battleview_ExitButtonActionCallback( NULL, AUI_BUTTON_ACTION_EXECUTE, 0, NULL);
			} else {
				
				optionsscreen_Initialize();
				optionsscreen_displayMyWindow(1);
			}
		}
		return TRUE;
	}

	
	aui_Window *topWindow = g_c3ui->TopWindow();
	if(topWindow && (!g_controlPanel || topWindow != g_controlPanel->GetWindow()) && topWindow != g_statusWindow) {
		if(topWindow->HandleKey(wParam))
			return 0;
	}

	
	
	if (!theKeyMap) return 0;

	
	if (g_slicEngine && g_slicEngine->RunKeyboardTrigger(static_cast<char>(wParam))) 
//.........这里部分代码省略.........
开发者ID:talentlesshack,项目名称:C2P2,代码行数:101,代码来源:keypress.cpp


注:本文中的CommandLine::AddKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。