本文整理汇总了C++中setKey函数的典型用法代码示例。如果您正苦于以下问题:C++ setKey函数的具体用法?C++ setKey怎么用?C++ setKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setKey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setKey
void ConfigManager::setBool(const UString &key, bool value, bool update) {
setKey(key, ConfigDomain::fromBool(value), update);
}
示例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"));
}
示例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++;
}
}
示例4: setKey
void QSFMLCanvas::mouseReleaseEvent(QMouseEvent* event)
{
setKey(K_A,false);
QWidget::mouseReleaseEvent(event);
}
示例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);
}
示例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;
}
示例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;
}
示例8: setKey
void COverlayText::load(QDataStream& s)
{
QString key;
s >> rect >> comment >> key;
setKey(key);
}
示例9: rfcBytes
bool HMACAuth::setKey(const QUuid& uidKey) {
const QByteArray rfcBytes(uidKey.toRfc4122());
return setKey(rfcBytes.constData(), rfcBytes.length());
}
示例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;
}
示例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;
//.........这里部分代码省略.........
示例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))
//.........这里部分代码省略.........
示例13: setKey
void CBibleKeyChooser::refreshContent() {
setKey(m_key);
}
示例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);
}
示例15: Category_Form
// Constructor
Category_Form(cgiScript & script):Category(),forms_base(script){setKey(*this);}