本文整理汇总了C++中Keymap::LoadCurrent方法的典型用法代码示例。如果您正苦于以下问题:C++ Keymap::LoadCurrent方法的具体用法?C++ Keymap::LoadCurrent怎么用?C++ Keymap::LoadCurrent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keymap
的用法示例。
在下文中一共展示了Keymap::LoadCurrent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: app
int
main(int argc, char **argv)
{
const char* output = NULL;
const char* input = NULL;
enum {
kUnspecified,
kLoadBinary,
kLoadText,
kSaveText,
kRestore,
kCompile,
kSaveHeader,
} mode = kUnspecified;
static struct option const kLongOptions[] = {
{"output", required_argument, 0, 'o'},
{"dump", optional_argument, 0, 'd'},
{"load", optional_argument, 0, 'l'},
{"load-source", optional_argument, 0, 's'},
{"restore", no_argument, 0, 'r'},
{"compile", optional_argument, 0, 'c'},
{"header", optional_argument, 0, 'h'},
{"help", no_argument, 0, 'H'},
{NULL}
};
int c;
while ((c = getopt_long(argc, argv, "o:dblsrchH", kLongOptions,
NULL)) != -1) {
switch (c) {
case 0:
break;
case 'o':
output = optarg;
break;
case 'd':
mode = kSaveText;
input = optarg;
break;
case 'l':
case 'b':
mode = kLoadBinary;
input = optarg;
break;
case 's':
mode = kLoadText;
input = optarg;
break;
case 'r':
mode = kRestore;
break;
case 'c':
mode = kCompile;
input = optarg;
break;
case 'h':
mode = kSaveHeader;
input = optarg;
break;
case 'H':
default:
usage();
break;
}
}
if (argc > optind && input == NULL)
input = argv[optind];
BApplication app("application/x-vnd.Antares-keymap-cli");
Keymap keymap;
switch (mode) {
case kUnspecified:
usage();
break;
case kLoadBinary:
case kLoadText:
{
load_keymap(keymap, input, mode == kLoadText);
status_t status = keymap.SaveAsCurrent();
if (status != B_OK) {
fprintf(stderr, "%s: error when saving as current: %s",
sProgramName, strerror(status));
return 1;
}
printf("Key map loaded.\n");
break;
}
case kSaveText:
{
if (input == NULL) {
status_t status = keymap.LoadCurrent();
if (status != B_OK) {
//.........这里部分代码省略.........