• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MACRO函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MACRO函数的典型用法代码示例。如果您正苦于以下问题:C++ MACRO函数的具体用法?C++ MACRO怎么用?C++ MACRO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: switch

/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case PSWD1:
            return (record->event.pressed ?
                    MACRO( I(0), T(1), T(2), T(3), T(4), T(5), T(6), T(7), T(8), T(ENT), END ) :
                    MACRO_NONE );
        case PSWD2:
            return (record->event.pressed ?
                    MACRO( I(0), T(1), T(2), T(3), T(4), T(5), T(6), T(7), T(8), T(ENT), END ) :
                    MACRO_NONE );
        case PSWD3:
            return (record->event.pressed ?
                    MACRO( I(0), T(1), T(2), T(3), T(4), T(5), T(6), T(7), T(8), T(ENT), END ) :
                    MACRO_NONE );
        //case VOLUP:
        //    return (record->event.pressed ?
        //            MACRO( D(VOLU), U(VOLU), END ) :
        //            MACRO_NONE );
        //case ALT_TAB:
        //    return (record->event.pressed ?
        //            MACRO( D(LALT), D(TAB), END ) :
        //            MACRO( U(TAB), END ));
    }
    return MACRO_NONE;
}
开发者ID:Attsun1031,项目名称:qmk_firmware,代码行数:29,代码来源:justin.c


示例2: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
  // MACRODOWN only works in this function
      switch(id) {
        case 0:
          if (record->event.pressed) {
            register_code(KC_RSFT);
            backlight_step();
          } else {
            unregister_code(KC_RSFT);
          }
        break;
      case 1:
        if (record->event.pressed) {
          return MACRO( I(100), KC_LBRC, KC_RBRC, KC_LEFT, END );
        }
        break;
      case 2:
        if (record->event.pressed) {
          return MACRO( I(100), KC_LCBR, KC_RCBR, KC_LEFT, END );
        }
        break;
      case 3:
        if (record->event.pressed) {
          return MACRO( I(100), KC_LPRN, KC_RPRN, KC_LEFT, END );
        }
        break;
      case 4:
        if (record->event.pressed) {
          return MACRO( I(100), LSFT(KC_COMM), LSFT(KC_DOT), KC_LEFT, END );
        }
        break;
       }
    return MACRO_NONE;
};
开发者ID:plattfot,项目名称:qmk_firmware,代码行数:35,代码来源:keymap_plattfot.c


示例3: dprintf

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
  dprintf( "record.\n"
           "  event.pressed = %u\n"
           "  tap.count = %u\n"
           "  tap.interrupted = %u\n"
              , record->event.pressed
              , record->tap.count
              , record->tap.interrupted );
  dprintf( "id = %u\n", id );
  dprintf( "opt = %u\n", opt );

  switch(id) {

    case UM_MHEN: {
      return MACRO_TAP_HOLD_LAYER( record, MACRO(TYPE(KC_MHEN), END), KL_LOWER );
    } break;

    case UM_HENK: {
      return MACRO_TAP_HOLD_LAYER( record, MACRO(TYPE(KC_HENK), END), KL_RAISE );
    } break;

    case UM_DEBUG: {
      if (record->event.pressed) {
        debug_enable = !debug_enable;
        if (debug_enable) {
          dprint("\nDEBUG: enabled.\n");
          SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
        }
      }
    } break;

  }
  return MACRO_NONE;
};
开发者ID:Talljoe,项目名称:qmk_firmware,代码行数:35,代码来源:keymap.c


示例4: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{ 
    keyevent_t event = record->event;
    switch (id) {
        case M_Q0:
            return event.pressed ?
                MACRO( D(LSFT), T(SCLN), U(LSFT), T(SLSH), END ) :
                MACRO_NONE;
        case M_Q1:
            return event.pressed ?
                MACRO( D(LSFT), T(SCLN), T(9), U(LSFT), END ) :
                MACRO_NONE;
        case M_Q2:
            return event.pressed ?
                MACRO( D(LSFT), T(0), T(SCLN), U(LSFT), END ) :
                MACRO_NONE;
        case M_Q3:
            return event.pressed ?
                MACRO( D(LSFT), T(9), T(SCLN), U(LSFT), END ) :
                MACRO_NONE;
        case M_Q4:
            return event.pressed ?
                MACRO( D(LSFT), T(SCLN), T(0), U(LSFT), END ) :
                MACRO_NONE;

    }
    return MACRO_NONE;
}
开发者ID:Attsun1031,项目名称:qmk_firmware,代码行数:28,代码来源:keymap_joe.c


示例5: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  if (record->event.pressed) {
    switch(id) {
  case 0:
    return MACRO( D(LSFT), T(9), U(LSFT), D(LSFT), T(0), U(LSFT), T(LEFT), END );
  case 1:
    return MACRO( D(LSFT), T(LBRC), U(LSFT), D(LSFT), T(RBRC), U(LSFT), T(LEFT), END );
  case 2:
    return MACRO( T(LBRC), T(RBRC), T(LEFT), END);
  case 3:
    clear_keyboard();
  case 4:
    return MACRO( D(LSFT), T(SCOLON), U(LSFT), D(LSFT), T(9), U(LSFT), D(LSFT), T(0), U(LSFT), D(LSFT), T(LBRACKET), U(LSFT), D(LSFT), T(9), U(LSFT), D(LSFT), T(SCOLON), U(LSFT), D(LSFT), T(0), U(LSFT), D(LSFT), T(BSLASH), U(LSFT), D(LSFT), T(SCOLON), U(LSFT), D(LSFT), T(7), U(LSFT), D(LSFT), T(RBRACKET), U(LSFT), T(SCOLON), D(LSFT), T(SCOLON), U(LSFT), END );
  case WINSH:
    set_unicode_input_mode(UC_WIN);
    return false;
    break;
  case WIN:
    set_unicode_input_mode(UC_WINC);
    return false;
    break;
  case OSX:
    set_unicode_input_mode(UC_OSX);
    return false;
    break;
   }
  }
 return MACRO_NONE;
};
开发者ID:20lives,项目名称:qmk_firmware,代码行数:29,代码来源:keymap.c


示例6: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
  // MACRODOWN only works in this function
    switch(id) {
        case 0 ... END_UC:
            if (record->event.pressed) {
                send_unicode(unicode_chars[id]);
            }
            break;
        case M_CSA_SFT:
            // BÉPO over CSA: toggle shift layer
            layer_invert(LR_CSA_SFT);
            if (record->event.pressed) {
                hold_shift();
            } else {
                release_shift();
            }
            break;
        case M_CSA_SFT_AGR:
            // BÉPO over CSA: from shift layer, momentary altgr+shift layer
            layer_invert(LR_CSA_AGR);
            layer_invert(LR_CSA_AGR_SFT);
            if (record->event.pressed) {
                // shift not needed for LR_CSA_AGR_SFT
                release_shift();
            } else {
                // back to shift layer
                hold_shift();
            }
            break;
        case M_CSA_AGR_SFT:
            // BÉPO over CSA: from altgr layer, momentary altgr+shift layer
            layer_invert(LR_CSA_SFT);
            layer_invert(LR_CSA_AGR_SFT);
            break;
        case M_1 ... M_0:
        case M_DEGR:
        case M_SCLN:
        case M_GRV:
        case M_NBSP:
            // macros of the shift layer that require to release shift
            if (record->event.pressed) {
                release_shift();
                switch (id) {
                    case M_1 ... M_0:
                        register_code(KC_1 + (id - M_1));
                        break;
                    case M_DEGR:
                        return MACRO(DOWN(CSA_ALTGR), D(SCLN), END);
                    case M_SCLN:
                        return MACRO(D(SCLN), END);
                    case M_GRV:
                        return MACRO(I(75), DOWN(CSA_ALTGR), TYPE(CSA_DCRC), UP(CSA_ALTGR), T(SPACE), END);
                    case M_NBSP:
                        // use weak mod such that pressing another key will not be affected
                        add_weak_mods(MOD_BIT(CSA_ALTGR));
                        return MACRO(D(SPACE), END);
                }
            } else {
开发者ID:2k0ri,项目名称:qmk_firmware,代码行数:59,代码来源:keymap.c


示例7: switch

/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case ALT_TAB:
            return (record->event.pressed ?
                    MACRO( D(LALT), D(TAB), END ) :
                    MACRO( U(TAB), END ));
    }
    return MACRO_NONE;
}
开发者ID:0xdec,项目名称:tmk_keyboard,代码行数:13,代码来源:keymap_hasu.c


示例8: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    keyevent_t event = record->event;

    switch (id) {
        case TILDE_NO:
            return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE);
        case LESS_NO:
            return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE);
        case GRTR_NO:
            return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE);
        case CIRC_NO:
            return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE);
        case ACUT_NO:
            return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC),  END ) : MACRO_NONE);
        case GRV_NO:
            return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT),  END ) : MACRO_NONE);
        case LESS_NO_MAC:
            return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE);
        case GRTR_NO_MAC:
            return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE);
        case ACUT_NO_MAC:
            return (event.pressed ? MACRO( T(EQL), T(SPC),  END ) : MACRO_NONE);
    }
    return MACRO_NONE;
};
开发者ID:JK40,项目名称:qmk_firmware,代码行数:26,代码来源:keymap.c


示例9: switch

// The Macros
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
    if (record->event.pressed) {
        switch(id) {
            case 0:
                return MACRO(D(LGUI), D(LSFT), T(3), U(LSFT), U(LGUI), END);                   // Mac print screen
            case 1:
                return MACRO(D(LGUI), D(LSFT), T(4), U(LSFT), U(LGUI), END);                   // Mac print area
            case 2:
                return MACRO(D(LCTL), D(LSFT), D(LGUI), T(3), D(LCTL), D(LSFT), D(LGUI), END); // Mac print screen to clipboard
            case 3:
                return MACRO(D(LCTL), D(LSFT), D(LGUI), T(4), D(LCTL), D(LSFT), D(LGUI), END); // Mac print area to clipboard
            case 4:
                return MACRO(D(LCTL), T(UP), U(LCTL), END);                                    // Mac mission control
            case 5:
                return MACRO(D(LCTL), T(DOWN), U(LCTL), END);                                  // Mac app windows
            case 6:
                return MACRO(D(LGUI), T(SPC), U(LGUI), END);                                   // Mac spotlight search
            case 7:
                return MACRO(D(LCTL), T(LEFT), U(LCTL), END);                                  // Mac mission left
            case 8:
                return MACRO(D(LCTL), T(RGHT), U(LCTL), END);                                  // Mac mission right
            case 9:
                rgblight_setrgb(0xff, 0xff, 0xff);                                             // White rgb shortcut
                break;
        }
    }
    return MACRO_NONE;
};
开发者ID:Twey,项目名称:qmk_firmware,代码行数:29,代码来源:keymap.c


示例10: switch

/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case ALT_TAB:
            return (record->event.pressed ? MACRO( D(LSFT) ,T(H) , U(LSFT), T(E), T(L), T(L), T(O), END ) :MACRO( END ));
        case ALT_TAB2:
            return (record->event.pressed ? MACRO(D(LSFT),T(A),T(S),T(D),U(LSFT),T(F),T(G),T(H), END ) :MACRO( END ));

    }
    return MACRO_NONE;
}
开发者ID:Psykyck,项目名称:Neutrino_Firmware,代码行数:14,代码来源:keymap_neutrino.c


示例11: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
  // MACRODOWN only works in this function
      switch(id) {
        case 0:
          return (record->event.pressed ? MACRO( D(LSFT) ,T(H) , U(LSFT), T(E), T(L), T(L), T(O), END ) :MACRO( END ));
          break;
        case 1:
          return (record->event.pressed ? MACRO(D(LSFT),T(A),T(S),T(D),U(LSFT),T(F),T(G),T(H), END ) :MACRO( END ));
          break;
      }
    return MACRO_NONE;
};
开发者ID:arg0sy,项目名称:qmk_firmware,代码行数:13,代码来源:keymap_yang.c


示例12: switch

/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    keyevent_t event = record->event;
    tap_t tap = record->tap;

    switch (id) {
        case LSHIFT_PAREN:
            if (tap.count > 0 && !tap.interrupted) {
                return (event.pressed ?
                        MACRO( D(LSHIFT), D(9), U(9), U(LSHIFT), END ) : MACRO_NONE);
            } else {
                return (event.pressed ?
                        MACRO( D(LSHIFT), END ) : MACRO( U(LSHIFT), END ) );
            }
        case RSHIFT_PAREN:
            if (tap.count > 0 && !tap.interrupted) {
                return (event.pressed ?
                        MACRO( D(RSHIFT), D(0), U(0), U(RSHIFT), END ) : MACRO_NONE);
            } else {
                return (event.pressed ?
                        MACRO( D(RSHIFT), END ) : MACRO( U(RSHIFT), END ) );
            }
        case HELLO:
            return (event.pressed ?
                    MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
                    MACRO_NONE );
        case VOLUP:
            return (event.pressed ?
                    MACRO( D(VOLU), U(VOLU), END ) :
                    MACRO_NONE );
    }
    return MACRO_NONE;
}
开发者ID:Jickelsen,项目名称:tmk_keyboard,代码行数:36,代码来源:keymap_jickel.c


示例13: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  // MACRODOWN only works in this function
  switch(id) {
    case MACRO_TMUX_ESC:
      if (record->event.pressed) {
        return MACRO(D(LCTRL), T(A), U(LCTRL), D(ESC), END);
      }
      return MACRO(U(ESC), END);
    case MACRO_TMUX_PASTE:
      if (record->event.pressed) {
        return MACRO(D(LCTRL), T(A), U(LCTRL), D(P), END);
      }
      return MACRO(U(P), END);
    case MACRO_OSX_COPY:
      if (record->event.pressed) {
        return MACRO(D(LGUI), D(C), END);
      }
      return MACRO(U(C), U(LGUI), END);
    case MACRO_OSX_PASTE:
      if (record->event.pressed) {
        return MACRO(D(LGUI), D(V), END);
      }
      return MACRO(U(V), U(LGUI), END);
  }
  return MACRO_NONE;
};
开发者ID:GrandpaGhostTim,项目名称:qmk_firmware,代码行数:26,代码来源:keymap.c


示例14: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
  // MACRODOWN only works in this function
    switch(id) {
      case 0:
      return (record->event.pressed) ?
        MACRO( T(MPRV), T(MRWD) ) :
        MACRO_NONE;
      case 1:
      return (record->event.pressed) ?
        MACRO( T(MNXT), T(MFFD) ) :
        MACRO_NONE;
      break;
    }
    return MACRO_NONE;
};
开发者ID:nyarly,项目名称:qmk_firmware,代码行数:16,代码来源:keymap.c


示例15: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    // MACRODOWN only works in this function
    switch(id) {
        case 0:
            if (record->event.pressed) {
                SEND_STRING("The");
                return false;
            }
            break;
        case 1:
            if (record->event.pressed) {
                SEND_STRING("Custom");
                return false;
            }
            break;
        case 2:
            if (record->event.pressed) {
                SEND_STRING("Keyboard");
                return false;
            }
            break;
        case 3:
            if (record->event.pressed) {
                return MACRO( D(LCTL), T(C), U(LCTL), T(RGHT), D(LCTL), T(V), U(LCTL), END );
            }
            break;
    }
    return MACRO_NONE;
};
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:30,代码来源:keymap.c


示例16: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    // MACRODOWN only works in this function
    switch(id) {
        case 0:
            return (record->event.pressed ?
                    MACRO( D(RALT), T(SPC), U(RALT), END )
                    :MACRO( END ));
            break;
        case 1:
            return (record->event.pressed ?
                    MACRO( D(LALT), T(F2), U(LALT), END )
                    :MACRO( END ));
            break;
    }
    return MACRO_NONE;
};
开发者ID:Talljoe,项目名称:qmk_firmware,代码行数:17,代码来源:keymap.c


示例17: main

int main(int argc, char* argv[])
{
    MACRO()

    foo(0);

    return 0;
}
开发者ID:MatenViro,项目名称:gcovr,代码行数:8,代码来源:example1.cpp


示例18: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
		static uint16_t start;
  // MACRODOWN only works in this function
      switch(id) {
        case 0:
		if (record->event.pressed) {
		  register_code(KC_RSFT);
		} else {
		  unregister_code(KC_RSFT);
		}
		break;
	case 1:
		if (record->event.pressed) {
			start = timer_read();
			return MACRO(D(LCTRL), END);
		} else {
			if (timer_elapsed(start) > 150) {
			    return MACRO(U(LCTRL), END);
			} else {
			    return MACRO(U(LCTRL), D(LGUI), T(V), U(LGUI), END);
			}
		}
		break;
	case 2:
		if (record->event.pressed) {
			start = timer_read();
			return MACRO(D(LCTRL),END);
		} else {
			if (timer_elapsed(start) > 150){
				return MACRO(U(LCTRL),END);
			} else {
				return MACRO(U(LCTRL),D(LGUI),T(C),U(LGUI),END);
			}
		}
		break;
	case 3:
		if (record->event.pressed) {
			start = timer_read();
			return MACRO(D(LCTRL),D(LSFT),D(LALT),END);
		} else {
			if (timer_elapsed(start) > 150){
				return MACRO(U(LCTRL),U(LSFT),U(LALT),END);
			} else {
				return MACRO(U(LCTRL),U(LALT),T(EQL),U(LSFT),END); //cannot use DE_ACUT here, as macro needs KC_ prefix
			}
		}
		break;
      }
    return MACRO_NONE;
};
开发者ID:arizqi,项目名称:qmk_firmware,代码行数:51,代码来源:keymap_osx_de.c


示例19: switch

/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case HELLO:
            return (record->event.pressed ?
                    MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
                    MACRO_NONE );
        case VOLUP:
            return (record->event.pressed ?
                    MACRO( D(VOLU), U(VOLU), END ) :
                    MACRO_NONE );
        case ALT_TAB:
            return (record->event.pressed ?
                    MACRO( D(LALT), D(TAB), END ) :
                    MACRO( U(TAB), END ));
    }
    return MACRO_NONE;
}
开发者ID:ageaenes,项目名称:tmk_keyboard,代码行数:21,代码来源:keymap_henz.c


示例20: switch

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    keyevent_t event = record->event;
    //uint8_t tap_count = record->tap_count;

    switch (id) {
        case AIDS:
            return (event.pressed ?
                   MACRO(T(A), T(I), T(D), T(S), END ) :
                    MACRO( END ) );
      case PRISM:
            return (event.pressed ?
                   MACRO(T(SLSH), T(P), T(R), T(I), T(S), T(M), T(SPC), END ) :
                    MACRO( END ) );
     
    }
    return MACRO_NONE;
};
开发者ID:tominabox1,项目名称:tmk_keyboard,代码行数:18,代码来源:keymap_poker.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MAC_函数代码示例发布时间:2022-05-30
下一篇:
C++ MACH_PORT_VALID函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap