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

C++ setKey函数代码示例

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

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



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

示例1: setKey

void ConfigManager::setBool(const UString &key, bool value, bool update) {
	setKey(key, ConfigDomain::fromBool(value), update);
}
开发者ID:bazhenovc,项目名称:xoreos,代码行数:3,代码来源:configman.cpp


示例2: N_

HelpDialog::HelpDialog()
{
	ui = new Ui_helpDialogForm;

	// Make some key and mouse bindings translatable. Keys starting with
	// "!NUMBER-" are made up; the number is there to keep the entries
	// sorted (at least relative to each other).
	specialKeys["Space"] = N_("Space");
	specialKeys["!01-arrows-and-left-drag"] = N_("Arrow keys & left mouse drag");
	specialKeys["!02-page-up/down"] = N_("Page Up/Down");
	specialKeys["!03-ctrl+up/down"] = N_("CTRL + Up/Down");
	specialKeys["!04-left-click"] = N_("Left click");
	specialKeys["!05-right-click"] = N_("Right click");
	specialKeys["!06-ctrl+left-click"] = N_("CTRL + Left click");

	// Add keys for those keys which do not have actions.
	QString group = N_("Movement and Selection");
	setKey(group, "", "!01-arrows-and-left-drag", N_("Pan view around the sky"));
	setKey(group, "", "!02-page-up/down", N_("Zoom in/out"));
	setKey(group, "", "!03-ctrl+up/down", N_("Zoom in/out"));
	setKey(group, "", "!04-left-click", N_("Select object"));
	setKey(group, "", "!05-right-click", N_("Clear selection"));
#ifdef Q_OS_MAC
	setKey(group, "", "!06-ctrl+left-click", N_("Clear selection"));
#endif

	group = N_("When a Script is Running");

	setKey(group, "", "4", N_("Stop currently running script"));
	setKey(group, "", "5", N_("Pause script execution"));
	setKey(group, "", "6", N_("Resume script execution"));
	setKey(group, "", "J", N_("Slow down the script execution rate"));
	setKey(group, "", "L", N_("Speed up the script execution rate"));
	setKey(group, "", "K", N_("Set the normal script execution rate"));

        // Add keys for those plugins which do not have GUI actions.
        group = N_("Plugin Key Bindings");
        setKey(group, "", "Alt+M", N_("Text User Interface"));
}
开发者ID:ammarshadiq,项目名称:stellarium-0.11.4,代码行数:39,代码来源:HelpDialog.cpp


示例3: parseLine

void parseLine(xmlNodePtr root_node, SHAPE *shape)
{
	int i, l, m, v;
	int k = 0;
	int n = -1;
	int o = -1;

	int start_vertex, end_vertex;
	char val[1024];

	xmlNodePtr osmWay;
	SHPObject *obj = NULL;
	NODE node;
	KEYVAL tags;

	for (i = 0; i < shape->num_entities; i++)
	{
		obj = SHPReadObject(shape->handleShp, k);

		for (m = 0; m < obj->nParts; m++) 
		{
			osmWay = wayElement(o);
			
			if (m == obj->nParts-1)
			{
				// is linestring
				end_vertex = obj->nVertices;
			} else {
				// is multilinestring
				end_vertex = obj->panPartStart[m+1];
			}

			start_vertex = obj->panPartStart[m];

			for (v = start_vertex; v < end_vertex; v++)
			{
				node.id = n;
				node.x = obj->padfX[v];
				node.y = obj->padfY[v];
				xmlAddChild(root_node, nodeElement(node));
				xmlAddChild(osmWay, nodeRef(node));
				n--;
			}

			if (shape->num_fields > 0)
			{
				// has tags
				for (l = 0; l < shape->num_fields; l++)
				{
					setKey(&tags, shape->field_names[l]);

					// set tag value
					snprintf(val, 1024, "%s", DBFReadStringAttribute(shape->handleDbf, k, l));
					setValue(&tags, val);

					xmlAddChild(osmWay, tagElement(&tags));
				}
			}

			xmlAddChild(root_node, osmWay);
			o--;
		}

		k++;
	}
}
开发者ID:filbertkm,项目名称:osmutils,代码行数:66,代码来源:osm.c


示例4: setKey

void QSFMLCanvas::mouseReleaseEvent(QMouseEvent* event)
{
  setKey(K_A,false);
  QWidget::mouseReleaseEvent(event);
}
开发者ID:jsmtux,项目名称:Op3nD,代码行数:5,代码来源:QSFMLCanvas.cpp


示例5: sortCommand


//.........这里部分代码省略.........

    /* We are ready to sort the vector... perform a bit of sanity check
     * on the LIMIT option too. We'll use a partial version of quicksort. */
    start = (limit_start < 0) ? 0 : limit_start;
    end = (limit_count < 0) ? vectorlen-1 : start+limit_count-1;
    if (start >= vectorlen) {
        start = vectorlen-1;
        end = vectorlen-2;
    }
    if (end >= vectorlen) end = vectorlen-1;

    if (dontsort == 0) {
        server.sort_desc = desc;
        server.sort_alpha = alpha;
        server.sort_bypattern = sortby ? 1 : 0;
        if (sortby && (start != 0 || end != vectorlen-1))
            pqsort(vector,vectorlen,sizeof(redisSortObject),sortCompare, start,end);
        else
            qsort(vector,vectorlen,sizeof(redisSortObject),sortCompare);
    }

    /* Send command output to the output buffer, performing the specified
     * GET/DEL/INCR/DECR operations if any. */
    outputlen = getop ? getop*(end-start+1) : end-start+1;
    if (storekey == NULL) {
        /* STORE option not specified, sent the sorting result to client */
        addReplyMultiBulkLen(c,outputlen);
        for (j = start; j <= end; j++) {
            listNode *ln;
            listIter li;

            if (!getop) addReplyBulk(c,vector[j].obj);
            listRewind(operations,&li);
            while((ln = listNext(&li))) {
                redisSortOperation *sop = ln->value;
                robj *val = lookupKeyByPattern(c->db,sop->pattern,
                    vector[j].obj);

                if (sop->type == REDIS_SORT_GET) {
                    if (!val) {
                        addReply(c,shared.nullbulk);
                    } else {
                        addReplyBulk(c,val);
                        decrRefCount(val);
                    }
                } else {
                    redisAssert(sop->type == REDIS_SORT_GET); /* always fails */
                }
            }
        }
    } else {
        robj *sobj = createZiplistObject();

        /* STORE option specified, set the sorting result as a List object */
        for (j = start; j <= end; j++) {
            listNode *ln;
            listIter li;

            if (!getop) {
                listTypePush(sobj,vector[j].obj,REDIS_TAIL);
            } else {
                listRewind(operations,&li);
                while((ln = listNext(&li))) {
                    redisSortOperation *sop = ln->value;
                    robj *val = lookupKeyByPattern(c->db,sop->pattern,
                        vector[j].obj);

                    if (sop->type == REDIS_SORT_GET) {
                        if (!val) val = createStringObject("",0);

                        /* listTypePush does an incrRefCount, so we should take care
                         * care of the incremented refcount caused by either
                         * lookupKeyByPattern or createStringObject("",0) */
                        listTypePush(sobj,val,REDIS_TAIL);
                        decrRefCount(val);
                    } else {
                        /* always fails */
                        redisAssert(sop->type == REDIS_SORT_GET);
                    }
                }
            }
        }
        if (outputlen) setKey(c->db,storekey,sobj);
        decrRefCount(sobj);
        server.dirty += outputlen;
        addReplyLongLong(c,outputlen);
    }

    /* Cleanup */
    if (sortval->type == REDIS_LIST || sortval->type == REDIS_SET)
        for (j = 0; j < vectorlen; j++)
            decrRefCount(vector[j].obj);
    decrRefCount(sortval);
    listRelease(operations);
    for (j = 0; j < vectorlen; j++) {
        if (alpha && vector[j].u.cmpobj)
            decrRefCount(vector[j].u.cmpobj);
    }
    zfree(vector);
}
开发者ID:PhotoSoc,项目名称:PhotoSoc,代码行数:101,代码来源:sort.c


示例6: r8192_wx_set_enc_ext

/* hw security need to reorganized. */
static int r8192_wx_set_enc_ext(struct net_device *dev,
					struct iw_request_info *info,
					union iwreq_data *wrqu, char *extra)
{
	int ret = 0;
	struct r8192_priv *priv = ieee80211_priv(dev);
	struct ieee80211_device *ieee = priv->ieee80211;


	down(&priv->wx_sem);
	ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra);

	{
		u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
		u8 zero[6] = {0};
		u32 key[4] = {0};
		struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
		struct iw_point *encoding = &wrqu->encoding;
		u8 idx = 0, alg = 0, group = 0;

		if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE)
			/* none is not allowed to use hwsec WB 2008.07.01 */
			goto end_hw_sec;

		/* as IW_ENCODE_ALG_CCMP is defined to be 3 and KEY_TYPE_CCMP is defined to 4; */
		alg =  (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg;
		idx = encoding->flags & IW_ENCODE_INDEX;
		if (idx)
			idx--;
		group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;

		if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg ==  KEY_TYPE_WEP40)) {
			if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
				alg = KEY_TYPE_WEP104;
			ieee->pairwise_key_type = alg;
			EnableHWSecurityConfig8192(dev);
		}
		memcpy((u8 *)key, ext->key, 16); /* we only get 16 bytes key.why? WB 2008.7.1 */

		if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) {

			setKey(dev,
					idx,	/* EntryNao */
					idx,	/* KeyIndex */
					alg,	/* KeyType */
					zero,	/* MacAddr */
					0,	/* DefaultKey */
					key);	/* KeyContent */
		} else if (group) {
			ieee->group_key_type = alg;
			setKey(dev,
					idx,	/* EntryNo */
					idx,	/* KeyIndex */
					alg,	/* KeyType */
					broadcast_addr,	/* MacAddr */
					0,		/* DefaultKey */
					key);		/* KeyContent */
		} else {	/* pairwise key */
			setKey(dev,
					4,	/* EntryNo */
					idx,	/* KeyIndex */
					alg,	/* KeyType */
					(u8 *)ieee->ap_mac_addr,/* MacAddr */
					0,			/* DefaultKey */
					key);			/* KeyContent */
		}


	}

end_hw_sec:

	up(&priv->wx_sem);
	return ret;

}
开发者ID:Chong-Li,项目名称:cse522,代码行数:77,代码来源:r8192U_wx.c


示例7: main

int
main(int argc, char *argv[])
{
	int i;
	int opt;
	int temp;
	char *newKeyFile = NULL;

	while(1) {
		opt = getopt_long(argc, argv, "a:dfk:K:m:p:r:vVW:", long_options, NULL);
		if(opt == -1)
			break;
		switch(opt) {
		case 'd':
			mode = MD_DECRYPT;
			break;
		case 'W':
			mode = MD_WRITE_KEYFILE;
			newKeyFile = optarg;
			break;
		case 'k':
			keyfile = optarg;
			break;
		case 'p':
			keyprog = optarg;
			break;
		case 'f':
			optionForce = 1;
			break;
		case 'r':
			randomKeyLen = atoi(optarg);
			if(randomKeyLen > 64*1024) {
				fprintf(stderr, "ERROR: keys larger than 64KiB are "
					"not supported\n");
				exit(1);
			}
			break;
		case 'K':
			fprintf(stderr, "WARNING: specifying the actual key "
				"via the command line is highly insecure\n"
				"Do NOT use this for PRODUCTION use.\n");
			cry_key = optarg;
			cry_keylen = strlen(cry_key);
			break;
		case 'a':
			temp = rsgcryAlgoname2Algo(optarg);
			if(temp == GCRY_CIPHER_NONE) {
				fprintf(stderr, "ERROR: algorithm \"%s\" is not "
					"kown/supported\n", optarg);
				exit(1);
			}
			cry_algo = temp;
			break;
		case 'm':
			temp = rsgcryModename2Mode(optarg);
			if(temp == GCRY_CIPHER_MODE_NONE) {
				fprintf(stderr, "ERROR: cipher mode \"%s\" is not "
					"kown/supported\n", optarg);
				exit(1);
			}
			cry_mode = temp;
			break;
		case 'v':
			verbose = 1;
			break;
		case 'V':
			fprintf(stderr, "rsgtutil " VERSION "\n");
			exit(0);
			break;
		case '?':
			break;
		default:fprintf(stderr, "getopt_long() returns unknown value %d\n", opt);
			return 1;
		}
	}

	setKey();

	if(mode == MD_WRITE_KEYFILE) {
		if(optind != argc) {
			fprintf(stderr, "ERROR: no file parameters permitted in "
				"--write-keyfile mode\n");
			exit(1);
		}
		write_keyfile(newKeyFile);
	} else {
		if(optind == argc)
			decrypt("-");
		else {
			for(i = optind ; i < argc ; ++i)
				decrypt(argv[i]);
		}
	}

	memset(cry_key, 0, cry_keylen); /* zero-out key store */
	cry_keylen = 0;
	return 0;
}
开发者ID:Xat59,项目名称:rsyslog,代码行数:98,代码来源:rscryutil.c


示例8: setKey

void COverlayText::load(QDataStream& s)
{
    QString key;
    s >> rect >> comment >> key;
    setKey(key);
}
开发者ID:Nikoli,项目名称:qlandkartegt,代码行数:6,代码来源:COverlayText.cpp


示例9: rfcBytes

bool HMACAuth::setKey(const QUuid& uidKey) {
    const QByteArray rfcBytes(uidKey.toRfc4122());
    return setKey(rfcBytes.constData(), rfcBytes.length());
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:4,代码来源:HMACAuth.cpp


示例10: r8192_wx_set_enc

static int r8192_wx_set_enc(struct net_device *dev,
			    struct iw_request_info *info,
			    union iwreq_data *wrqu, char *key)
{
	struct r8192_priv *priv = ieee80211_priv(dev);
	struct ieee80211_device *ieee = priv->ieee80211;
	int ret;
	u32 hwkey[4] = {0, 0, 0, 0};
	u8 mask = 0xff;
	u32 key_idx = 0;
	u8 zero_addr[4][6] = {	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
				{0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
				{0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
				{0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
	int i;

	if (!priv->up)
		return -ENETDOWN;

	down(&priv->wx_sem);

	RT_TRACE(COMP_SEC, "Setting SW wep key");
	ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);

	up(&priv->wx_sem);



	/* sometimes, the length is zero while we do not type key value */
	if (wrqu->encoding.length != 0) {

		for (i = 0; i < 4; i++) {
			hwkey[i] |=  key[4*i+0]&mask;
			if (i == 1 && (4*i+1) == wrqu->encoding.length)
				mask = 0x00;
			if (i == 3 && (4*i+1) == wrqu->encoding.length)
				mask = 0x00;
			hwkey[i] |= (key[4*i+1]&mask)<<8;
			hwkey[i] |= (key[4*i+2]&mask)<<16;
			hwkey[i] |= (key[4*i+3]&mask)<<24;
		}

		#define CONF_WEP40  0x4
		#define CONF_WEP104 0x14

		switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
		case 0:
			key_idx = ieee->tx_keyidx;
			break;
		case 1:
			key_idx = 0;
			break;
		case 2:
			key_idx = 1;
			break;
		case 3:
			key_idx = 2;
			break;
		case 4:
			key_idx	= 3;
			break;
		default:
			break;
		}

		if (wrqu->encoding.length == 0x5) {
				ieee->pairwise_key_type = KEY_TYPE_WEP40;
			EnableHWSecurityConfig8192(dev);

			setKey(dev,
				key_idx,                /* EntryNo */
				key_idx,                /* KeyIndex */
				KEY_TYPE_WEP40,         /* KeyType */
				zero_addr[key_idx],
				0,                      /* DefaultKey */
				hwkey);                 /* KeyContent */

		}

		else if (wrqu->encoding.length == 0xd) {
				ieee->pairwise_key_type = KEY_TYPE_WEP104;
				EnableHWSecurityConfig8192(dev);

			setKey(dev,
				key_idx,                /* EntryNo */
				key_idx,                /* KeyIndex */
				KEY_TYPE_WEP104,        /* KeyType */
				zero_addr[key_idx],
				0,                      /* DefaultKey */
				hwkey);                 /* KeyContent */

		} else {
			printk("wrong type in WEP, not WEP40 and WEP104\n");
		}

	}

	return ret;
}
开发者ID:Chong-Li,项目名称:cse522,代码行数:99,代码来源:r8192U_wx.c


示例11: switch

void WzMainWindow::realHandleKeyEvent(QKeyEvent *event, bool pressed)
{
	unsigned int lastKey;
	bool isKeypad = event->modifiers() & Qt::KeypadModifier;

	switch (event->text().size())
	{
		case 0:
			debug(LOG_INPUT, "Key%s 0x%04X, isKeypad=%d", pressed ? "Down" : "Up  ", event->key(), isKeypad);
		case 1:
			debug(LOG_INPUT, "Key%s 0x%04X, isKeypad=%d, 0x%04X", pressed ? "Down" : "Up  ", event->key(), isKeypad, event->text().unicode()[0].unicode());
			break;
		case 2:
			debug(LOG_INPUT, "Key%s 0x%04X, isKeypad=%d, 0x%04X, 0x%04X", pressed ? "Down" : "Up  ", event->key(), isKeypad, event->text().unicode()[0].unicode(), event->text().unicode()[1].unicode());
			break;
		case 3:
			debug(LOG_INPUT, "Key%s 0x%04X, isKeypad=%d, 0x%04X, 0x%04X, ...", pressed ? "Down" : "Up  ", event->key(), isKeypad, event->text().unicode()[0].unicode(), event->text().unicode()[1].unicode());
			break;
	}

	if (!isKeypad)
	{
		switch (event->key())
		{
			case Qt::Key_Shift              :	lastKey = setKey(KEY_LSHIFT, pressed); break;

			case Qt::Key_Control            :	lastKey = setKey(KEY_LCTRL, pressed); break;

			case Qt::Key_Alt                :	lastKey = setKey(KEY_LALT, pressed); break;
			case Qt::Key_AltGr              :	lastKey = setKey(KEY_RALT, pressed); break;

			case Qt::Key_Meta               :	lastKey = setKey(KEY_LMETA, pressed); break;

			case Qt::Key_Escape             :	lastKey = setKey(KEY_ESC, pressed); break;
			case Qt::Key_Backspace          :	lastKey = setKey(KEY_BACKSPACE, pressed); break;
			case Qt::Key_QuoteLeft          :	lastKey = setKey(KEY_BACKQUOTE, pressed); break;
			case Qt::Key_1                  :	lastKey = setKey(KEY_1, pressed); break;
			case Qt::Key_2                  :	lastKey = setKey(KEY_2, pressed); break;
			case Qt::Key_3                  :	lastKey = setKey(KEY_3, pressed); break;
			case Qt::Key_4                  :	lastKey = setKey(KEY_4, pressed); break;
			case Qt::Key_5                  :	lastKey = setKey(KEY_5, pressed); break;
			case Qt::Key_6                  :	lastKey = setKey(KEY_6, pressed); break;
			case Qt::Key_7                  :	lastKey = setKey(KEY_7, pressed); break;
			case Qt::Key_8                  :	lastKey = setKey(KEY_8, pressed); break;
			case Qt::Key_9                  :	lastKey = setKey(KEY_9, pressed); break;
			case Qt::Key_0                  :	lastKey = setKey(KEY_0, pressed); break;
			case Qt::Key_Minus              :	lastKey = setKey(KEY_MINUS, pressed); break;
			case Qt::Key_Equal              :	lastKey = setKey(KEY_EQUALS, pressed); break;
			case Qt::Key_Backtab:
			case Qt::Key_Tab                :	lastKey = setKey(KEY_TAB, pressed); break;
			case Qt::Key_Q                  :	lastKey = setKey(KEY_Q, pressed); break;
			case Qt::Key_W                  :	lastKey = setKey(KEY_W, pressed); break;
			case Qt::Key_E                  :	lastKey = setKey(KEY_E, pressed); break;
			case Qt::Key_R                  :	lastKey = setKey(KEY_R, pressed); break;
			case Qt::Key_T                  :	lastKey = setKey(KEY_T, pressed); break;
			case Qt::Key_Y                  :	lastKey = setKey(KEY_Y, pressed); break;
			case Qt::Key_U                  :	lastKey = setKey(KEY_U, pressed); break;
			case Qt::Key_I                  :	lastKey = setKey(KEY_I, pressed); break;
			case Qt::Key_O                  :	lastKey = setKey(KEY_O, pressed); break;
			case Qt::Key_P                  :	lastKey = setKey(KEY_P, pressed); break;
			case Qt::Key_BracketLeft        :	lastKey = setKey(KEY_LBRACE, pressed); break;
			case Qt::Key_BracketRight       :	lastKey = setKey(KEY_RBRACE, pressed); break;
			case Qt::Key_Enter              :	lastKey = setKey(KEY_RETURN, pressed); break;
			case Qt::Key_Return             :	lastKey = setKey(KEY_RETURN, pressed); break;
			case Qt::Key_A                  :	lastKey = setKey(KEY_A, pressed); break;
			case Qt::Key_S                  :	lastKey = setKey(KEY_S, pressed); break;
			case Qt::Key_D                  :	lastKey = setKey(KEY_D, pressed); break;
			case Qt::Key_F                  :	lastKey = setKey(KEY_F, pressed); break;
			case Qt::Key_G                  :	lastKey = setKey(KEY_G, pressed); break;
			case Qt::Key_H                  :	lastKey = setKey(KEY_H, pressed); break;
			case Qt::Key_J                  :	lastKey = setKey(KEY_J, pressed); break;
			case Qt::Key_K                  :	lastKey = setKey(KEY_K, pressed); break;
			case Qt::Key_L                  :	lastKey = setKey(KEY_L, pressed); break;
			case Qt::Key_Semicolon          :	lastKey = setKey(KEY_SEMICOLON, pressed); break;
			case Qt::Key_QuoteDbl           :	lastKey = setKey(KEY_QUOTE, pressed); break;		// ?
			case Qt::Key_Apostrophe         :	lastKey = setKey(KEY_BACKQUOTE, pressed); break;	// ?
			case Qt::Key_Backslash          :	lastKey = setKey(KEY_BACKSLASH, pressed); break;
			case Qt::Key_Z                  :	lastKey = setKey(KEY_Z, pressed); break;
			case Qt::Key_X                  :	lastKey = setKey(KEY_X, pressed); break;
			case Qt::Key_C                  :	lastKey = setKey(KEY_C, pressed); break;
			case Qt::Key_V                  :	lastKey = setKey(KEY_V, pressed); break;
			case Qt::Key_B                  :	lastKey = setKey(KEY_B, pressed); break;
			case Qt::Key_N                  :	lastKey = setKey(KEY_N, pressed); break;
			case Qt::Key_M                  :	lastKey = setKey(KEY_M, pressed); break;
			case Qt::Key_Comma              :	lastKey = setKey(KEY_COMMA, pressed); break;
			case Qt::Key_Period             :	lastKey = setKey(KEY_FULLSTOP, pressed); break;
			case Qt::Key_Slash              :	lastKey = setKey(KEY_FORWARDSLASH, pressed); break;
			case Qt::Key_Space              :	lastKey = setKey(KEY_SPACE, pressed); break;
			case Qt::Key_CapsLock           :	lastKey = setKey(KEY_CAPSLOCK, pressed); break;
			case Qt::Key_F1                 :	lastKey = setKey(KEY_F1, pressed); break;
			case Qt::Key_F2                 :	lastKey = setKey(KEY_F2, pressed); break;
			case Qt::Key_F3                 :	lastKey = setKey(KEY_F3, pressed); break;
			case Qt::Key_F4                 :	lastKey = setKey(KEY_F4, pressed); break;
			case Qt::Key_F5                 :	lastKey = setKey(KEY_F5, pressed); break;
			case Qt::Key_F6                 :	lastKey = setKey(KEY_F6, pressed); break;
			case Qt::Key_F7                 :	lastKey = setKey(KEY_F7, pressed); break;
			case Qt::Key_F8                 :	lastKey = setKey(KEY_F8, pressed); break;
			case Qt::Key_F9                 :	lastKey = setKey(KEY_F9, pressed); break;
			case Qt::Key_F10                :	lastKey = setKey(KEY_F10, pressed); break;
			case Qt::Key_NumLock            :	lastKey = setKey(KEY_NUMLOCK, pressed); break;
//.........这里部分代码省略.........
开发者ID:Emdek,项目名称:warzone2100,代码行数:101,代码来源:wzapp_qt.cpp


示例12: result

		bool CalendarTemplateElement::loadFromRecord( const Record& record, util::Env& env )
		{
			bool result(false);

			if(record.isDefined(TABLE_COL_ID))
			{
				RegistryKeyType value(record.getDefault<RegistryKeyType>(TABLE_COL_ID, 0));
				if(value != getKey())
				{
					result = true;
					setKey(value);
				}
			}

			// Rank
			if(record.isDefined(CalendarTemplateElementTableSync::COL_RANK))
			{
				size_t value(
					record.getDefault<size_t>(CalendarTemplateElementTableSync::COL_RANK, 0)
				);
				if(value != getRank())
				{
					result = true;
					setRank(value);
				}
			}

			// Min date
			if(record.isDefined(CalendarTemplateElementTableSync::COL_MIN_DATE))
			{
				date value(neg_infin);
				if(!record.get<string>(CalendarTemplateElementTableSync::COL_MIN_DATE).empty())
				{
					try
					{
						value = from_string(record.get<string>(CalendarTemplateElementTableSync::COL_MIN_DATE));
					}
					catch(...)
					{
					}
				}
				if(value != getMinDate())
				{
					result = true;
					setMinDate(value);
				}
			}

			// Max date
			if(record.isDefined(CalendarTemplateElementTableSync::COL_MAX_DATE))
			{
				date value(pos_infin);
				if(!record.get<string>(CalendarTemplateElementTableSync::COL_MAX_DATE).empty())
				{
					try
					{
						value = from_string(record.get<string>(CalendarTemplateElementTableSync::COL_MAX_DATE));
					}
					catch(...)
					{
					}
				}
				if(value != getMaxDate())
				{
					result = true;
					setMaxDate(value);
				}
			}

			// Days modulo
			if(record.isDefined(CalendarTemplateElementTableSync::COL_INTERVAL))
			{
				days value(
					record.getDefault<long>(CalendarTemplateElementTableSync::COL_INTERVAL, 0)
				);
				if(value != getStep())
				{
					result = true;
					setStep(value);
				}
			}

			// Operation
			if(record.isDefined(CalendarTemplateElementTableSync::COL_POSITIVE))
			{
				Operation value(
					static_cast<Operation>(
						record.getDefault<int>(CalendarTemplateElementTableSync::COL_POSITIVE, 0)
				)	);
				if(value != getOperation())
				{
					result = true;
					setOperation(value);
				}
			}

			// Included calendar
//			if(linkLevel > FIELDS_ONLY_LOAD_LEVEL)
			{
				if(record.isDefined(CalendarTemplateElementTableSync::COL_INCLUDE_ID))
//.........这里部分代码省略.........
开发者ID:Tisseo,项目名称:synthese,代码行数:101,代码来源:CalendarTemplateElement.cpp


示例13: setKey

void CBibleKeyChooser::refreshContent() {
    setKey(m_key);
}
开发者ID:bibletime,项目名称:historic-bibletime-svn,代码行数:3,代码来源:cbiblekeychooser.cpp


示例14: settings


//.........这里部分代码省略.........
        std::cerr << "You need define CA signature of your public key" << std::endl;
        settings.setValue("ca_signature","");
        settings.sync();
        abort();
    }
    else
    {
        const std::vector<char> tempData=hexatoBinary(settings.value("ca_signature"));
        if(tempData.size()==ED25519_SIGNATURE_SIZE)
            memcpy(ca_signature,tempData.data(),ED25519_SIGNATURE_SIZE);
        else
        {
            std::cerr << "You need define CA signature of your public key " <<
                         std::to_string(tempData.size()) << "!=" << std::to_string(ED25519_SIGNATURE_SIZE) << std::endl;
            abort();
        }
    }
    if(!settings.contains("ca_publickey"))
    {
        std::cerr << "You need define CA public key" << std::endl;
        settings.setValue("ca_publickey","");
        settings.sync();
        abort();
    }
    else
    {
        const std::vector<char> tempData=hexatoBinary(settings.value("ca_publickey"));
        if(tempData.size()==ED25519_KEY_SIZE)
            memcpy(ca_publickey,tempData.data(),ED25519_KEY_SIZE);
        else
        {
            std::cerr << "You need define CA public key " <<
                         std::to_string(tempData.size()) << "!=" << std::to_string(ED25519_KEY_SIZE) << std::endl;
            abort();
        }
    }

    if(!settings.contains("known_node"))
        settings.setValue("known_node","");

    if(!settings.contains("port"))
        settings.setValue("port",rand()%40000+10000);
    port=stringtouint16(settings.value("port"));

    const std::vector<std::string> &known_nodes=stringsplit(settings.value("known_node"),',');
    if((known_nodes.size()%2)!=0)
    {
        std::cerr << "(known_nodes.size()%2)!=0" << std::endl;
        abort();
    }
    size_t index=0;
    while(index<known_nodes.size())
    {
        bool ok=false;

        P2PServerUDP::HostToConnect hostToConnect;
        const std::string host=known_nodes.at(index);
        const std::string &portstring=known_nodes.at(index+1);
        const uint16_t port=stringtouint16(portstring,&ok);
        if(ok)
        {
            sockaddr_in6 serv_addr;
            memset(&serv_addr, 0, sizeof(serv_addr));
            serv_addr.sin6_port = htobe16(port);
            const char * const hostC=host.c_str();
            int convertResult=inet_pton(AF_INET6,hostC,&serv_addr.sin6_addr);
            if(convertResult!=1)
            {
                convertResult=inet_pton(AF_INET,hostC,&serv_addr.sin6_addr);
                if(convertResult!=1)
                    std::cerr << "not IPv4 and IPv6 address, host: \"" << host << "\", portstring: \"" << portstring
                              << "\", errno: " << std::to_string(errno) << std::endl;
                else
                    serv_addr.sin6_family = AF_INET;
            }
            else
                serv_addr.sin6_family = AF_INET6;
            if(convertResult==1)
            {
                hostToConnect.round=0;
                hostToConnect.serv_addr=serv_addr;
                hostToConnect.serialised_serv_addr=P2PServerUDP::sockSerialised(serv_addr);

                const std::string &serialisedPeer=P2PPeer::toString(serv_addr,",");
                knownPeers.insert(serialisedPeer);
                if(serialisedPeer!=(host+",",portstring))
                    std::cerr << serialisedPeer <<"!=" << (host+",",portstring) << ", ip list change" << std::endl;

                //pass to temp list because P2PServerUDP::p2pserver not init for now
                hostToConnectTemp.push_back(hostToConnect);
            }
        }

        index+=2;
    }

    settings.sync();

    setKey(privatekey,ca_publickey,ca_signature);
}
开发者ID:alphaonex86,项目名称:CatchChallenger,代码行数:101,代码来源:P2PServerUDPSettings.cpp


示例15: Category_Form

 // Constructor
 Category_Form(cgiScript & script):Category(),forms_base(script){setKey(*this);}  
开发者ID:davidmc,项目名称:w3metasite,代码行数:2,代码来源:category_ui.cpp


示例16: file

void picGen::loadShare1()
{

    std::string absPath="asset1";
    std::string absPath1="assetT";

//    s1->load(absPath.c_str());
//    QFile file(absPath.c_str());
//    if (!file.open(QIODevice::ReadOnly | QIODevice::Truncate)) {
//        // error processing here
//        //QMessageBox::warning(this, tr("Warning"),tr("File writting error"),QMessageBox::Ok);
//        return;

//    }

//    QTextStream ts(&file);
//    QString saved;
    string aesKey = "b7bd865cb99216307a49b2a6a7a66efd"; //128 bits key
    string aesIV = "ABCDEF0123456789";//128 bits
    string cipherText,plainText;

    //read seed and decrypt it

    //read the hashed val
    ifstream file(/*absPath.c_str()*/"asset1");
    file>>cipherText;
    plainText=CTR_AESDecryptStr(aesKey, aesIV, cipherText.c_str());
    //cout << plainText<<endl;
    int seed;
    //compute the original seed
    std::stringstream ss;
    ss<<std::hex<<plainText;
    ss>>seed;
    //seed%=100000;
    plainText.clear();
    cipherText.clear();
    file.close();


    //read time of regisitration and decrrypt it
    ifstream file1(/*absPath1.c_str()*/"assetT");
    file1>>cipherText;
    plainText=CTR_AESDecryptStr(aesKey, aesIV, cipherText.c_str());

    std::stringstream ossT(std::stringstream::out|std::stringstream::in);
    ossT<<plainText;
    time_t rTime;
    ossT>>rTime;
    time_t t= time(NULL);
    //find time difference
    int timeD=(t-rTime)/120;


    //to compute the real seed
    seed+=rTime;
    seed=abs(seed);
    seed%=100000;

    //cout<<seed<<endl;
    //to conpute the final seed
    std::stringstream ssC;
    ssC<<seed;

    std::string convert;
    convert=ssC.str();

    std::ostringstream ossC1;

    ossC1<<timeD;
    convert+=ossC1.str();

    std::stringstream ossC2;
    ossC2<<convert;
    ossC2>>seed;

    //std::cout<<seed<<endl;
    setKey(seed);
    share1Gen();


}
开发者ID:allen7593,项目名称:mainWindow,代码行数:81,代码来源:picgen.cpp


示例17: setKey

void InputHandler::setMouseBtn(Uint8 btn, const std::string& action) {
  setKey(SDLKey(SDLK_LAST + btn), action);
}
开发者ID:jsj2008,项目名称:Zombie-Blobs,代码行数:3,代码来源:input_handler.cpp


示例18: create

/*!
  Constructs a shared memory object with the given \a parent and with
  its key set to \a key. Because its key is set, its create() and
  attach() functions can be called.

  \sa setKey(), create(), attach()
 */
QSharedMemory::QSharedMemory(const QString &key, QObject *parent)
    : QObject(*new QSharedMemoryPrivate, parent)
{
    setKey(key);
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:12,代码来源:qsharedmemory.cpp


示例19: setKey

//------------------------------------------------------------------------
void CMenuItem::setVirtualKey (int32_t inVirtualKeyCode, int32_t inKeyModifiers)
{
	setKey (0, inKeyModifiers);
	virtualKeyCode = inVirtualKeyCode;
}
开发者ID:EQ4,项目名称:vstgui,代码行数:6,代码来源:coptionmenu.cpp


示例20: detach

/*!
  The destructor clears the key, which forces the shared memory object
  to \l {detach()} {detach} from its underlying shared memory
  segment. If this shared memory object is the last one connected to
  the shared memory segment, the detach() operation destroys the
  shared memory segment.

  \sa detach() isAttached()
 */
QSharedMemory::~QSharedMemory()
{
    setKey(QString());
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:13,代码来源:qsharedmemory.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setLED函数代码示例发布时间:2022-05-30
下一篇:
C++ setItemDelegate函数代码示例发布时间: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