本文整理汇总了C++中readLongLong函数的典型用法代码示例。如果您正苦于以下问题:C++ readLongLong函数的具体用法?C++ readLongLong怎么用?C++ readLongLong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readLongLong函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processLineItem
static int processLineItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
int len;
if ((p = readLine(r,&len)) != NULL) {
if (cur->type == REDIS_REPLY_INTEGER) {
if (r->fn && r->fn->createInteger)
obj = r->fn->createInteger(cur,readLongLong(p));
else
obj = (void*)REDIS_REPLY_INTEGER;
} else {
/* Type will be error or status. */
if (r->fn && r->fn->createString)
obj = r->fn->createString(cur,p,len);
else
obj = (void*)(size_t)(cur->type);
}
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
/* Set reply if this is the root object. */
if (r->ridx == 0) r->reply = obj;
moveToNextTask(r);
return REDIS_OK;
}
return REDIS_ERR;
}
示例2: processBulkItem
static int processBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj = NULL;
char *p, *s;
#ifdef _WIN32
long long len;
#else
long len;
#endif
unsigned long bytelen;
int success = 0;
p = r->buf+r->pos;
s = seekNewline(p,r->len-r->pos);
if (s != NULL) {
p = r->buf+r->pos;
bytelen = (int)(s-(r->buf+r->pos)+2); /* include \r\n */
len = readLongLong(p);
if (len < 0) {
/* The nil object can always be created. */
if (r->fn && r->fn->createNil)
obj = r->fn->createNil(cur);
else
obj = (void*)REDIS_REPLY_NIL;
success = 1;
} else {
/* Only continue when the buffer contains the entire bulk item. */
bytelen += (unsigned long)len+2; /* include \r\n */
if (r->pos+bytelen <= r->len) {
if (r->fn && r->fn->createString)
obj = r->fn->createString(cur,s+2,(size_t)len);
else
obj = (void*)REDIS_REPLY_STRING;
success = 1;
}
}
/* Proceed when obj was created. */
if (success) {
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
r->pos += bytelen;
/* Set reply if this is the root object. */
if (r->ridx == 0) r->reply = obj;
moveToNextTask(r);
return REDIS_OK;
}
}
return REDIS_ERR;
}
示例3: decode
QFacebookPublishInbox QFacebookPublishInbox::decode(const QByteArray &content)
{
auto result = QFacebookPublishInbox{};
auto jsonReader = QFacebookJsonReader{content};
result.unseen = jsonReader.readInt("unseen");
result.unread = jsonReader.readInt("unread");
result.recentUnread = jsonReader.readInt("recent_unread");
result.seenTimestamp = jsonReader.readLongLong("seen_timestamp");
result.realtimeViewerFbId = jsonReader.readUid("realtime_viewer_fbid");
return result;
}
示例4: processMultiBulkItem
static int processMultiBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
long elements;
int root = 0;
/* Set error for nested multi bulks with depth > 1 */
if (r->ridx == 8) {
redisSetReplyReaderError(r,sdscatprintf(sdsempty(),
"No support for nested multi bulk replies with depth > 7"));
return -1;
}
if ((p = readLine(r,NULL)) != NULL) {
elements = readLongLong(p);
root = (r->ridx == 0);
if (elements == -1) {
if (r->fn && r->fn->createNil)
obj = r->fn->createNil(cur);
else
obj = (void*)REDIS_REPLY_NIL;
moveToNextTask(r);
} else {
if (r->fn && r->fn->createArray)
obj = r->fn->createArray(cur,elements);
else
obj = (void*)REDIS_REPLY_ARRAY;
/* Modify task stack when there are more than 0 elements. */
if (elements > 0) {
cur->elements = elements;
cur->obj = obj;
r->ridx++;
r->rstack[r->ridx].type = -1;
r->rstack[r->ridx].elements = -1;
r->rstack[r->ridx].idx = 0;
r->rstack[r->ridx].obj = NULL;
r->rstack[r->ridx].parent = cur;
r->rstack[r->ridx].privdata = r->privdata;
} else {
moveToNextTask(r);
}
}
/* Set reply if this is the root object. */
if (root) r->reply = obj;
return 0;
}
return -1;
}
示例5: processBulkItem
static int processBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj = NULL;
char *p, *s;
long len;
unsigned long bytelen;
int success = 0;
p = r->buf+r->pos;
s = seekNewline(p,r->len-r->pos);
if (s != NULL) {
p = r->buf+r->pos;
bytelen = s-(r->buf+r->pos)+2; /* include \r\n */
len = readLongLong(p);
if (len < 0) {
/* The nil object can always be created. */
obj = r->fn ? r->fn->createNil(cur) :
(void*)REDIS_REPLY_NIL;
success = 1;
} else {
/* Only continue when the buffer contains the entire bulk item. */
bytelen += len+2; /* include \r\n */
if (r->pos+bytelen <= r->len) {
obj = r->fn ? r->fn->createString(cur,s+2,len) :
(void*)REDIS_REPLY_STRING;
success = 1;
}
}
/* Proceed when obj was created. */
if (success) {
r->pos += bytelen;
/* Set reply if this is the root object. */
if (r->ridx == 0) r->reply = obj;
moveToNextTask(r);
return 0;
}
}
return -1;
}
示例6: processLineItem
static int processLineItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
int len;
if ((p = readLine(r,&len)) != NULL) {
if (r->fn) {
if (cur->type == REDIS_REPLY_INTEGER) {
obj = r->fn->createInteger(cur,readLongLong(p));
} else {
obj = r->fn->createString(cur,p,len);
}
} else {
obj = (void*)(size_t)(cur->type);
}
/* Set reply if this is the root object. */
if (r->ridx == 0) r->reply = obj;
moveToNextTask(r);
return 0;
}
return -1;
}
示例7: readLongLong
#include <sstream>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::word Foam::name(long long val)
{
std::ostringstream buf;
buf << val;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, long long& l)
{
l = readLongLong(is);
// Check state of Istream
is.check("Istream& operator>>(Istream&, long long&)");
return is;
}
long long Foam::readLongLong(Istream& is)
{
register long long result = 0;
char c = 0;
static const label zeroOffset = int('0');
示例8: processMultiBulkItem
static int processMultiBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
#ifdef _WIN32
long long elements;
#else
long elements;
#endif
int root = 0;
/* Set error for nested multi bulks with depth > 7 */
if (r->ridx == 8) {
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
"No support for nested multi bulk replies with depth > 7");
return REDIS_ERR;
}
if ((p = readLine(r,NULL)) != NULL) {
elements = readLongLong(p);
root = (r->ridx == 0);
if (elements == -1) {
if (r->fn && r->fn->createNil)
obj = r->fn->createNil(cur);
else
obj = (void*)REDIS_REPLY_NIL;
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
moveToNextTask(r);
} else {
if (r->fn && r->fn->createArray)
obj = r->fn->createArray(cur,(int)elements);
else
obj = (void*)REDIS_REPLY_ARRAY;
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
/* Modify task stack when there are more than 0 elements. */
if (elements > 0) {
cur->elements = (int)elements;
cur->obj = obj;
r->ridx++;
r->rstack[r->ridx].type = -1;
r->rstack[r->ridx].elements = -1;
r->rstack[r->ridx].idx = 0;
r->rstack[r->ridx].obj = NULL;
r->rstack[r->ridx].parent = cur;
r->rstack[r->ridx].privdata = r->privdata;
} else {
moveToNextTask(r);
}
}
/* Set reply if this is the root object. */
if (root) r->reply = obj;
return REDIS_OK;
}
return REDIS_ERR;
}
示例9: DO_RETURN_R
unsigned long long CCBuffer::readULongLong()
{
DO_RETURN_R((unsigned long long)(readLongLong()));
}
示例10: QString
void SfzRegion::readOp(const QString& b, const QString& data, SfzControl &c)
{
QString opcode = QString(b);
QString opcode_data_full = QString(data);
for(auto define : c.defines) {
opcode.replace(define.first, define.second);
opcode_data_full.replace(define.first, define.second);
}
QStringList splitData = opcode_data_full.split(" "); // no spaces in opcode values except for sample definition
QString opcode_data = splitData[0];
int i = opcode_data.toInt();
if (opcode == "amp_veltrack")
readDouble(opcode_data, &_veltrack);
else if (opcode == "ampeg_delay")
readDouble(opcode_data, &eg_delay);
else if (opcode == "ampeg_start")
readDouble(opcode_data, &eg_start);
else if (opcode == "ampeg_attack")
readDouble(opcode_data, &eg_attack);
else if (opcode == "ampeg_hold")
readDouble(opcode_data, &eg_hold);
else if (opcode == "ampeg_decay")
readDouble(opcode_data, &eg_decay);
else if (opcode == "ampeg_sustain")
readDouble(opcode_data, &eg_sustain);
else if (opcode == "ampeg_release")
readDouble(opcode_data, &eg_release);
else if (opcode == "ampeg_vel2delay")
readDouble(opcode_data, &eg_vel2delay);
else if (opcode == "ampeg_vel2attack")
readDouble(opcode_data, &eg_vel2attack);
else if (opcode == "ampeg_vel2hold")
readDouble(opcode_data, &eg_vel2hold);
else if (opcode == "ampeg_vel2decay")
readDouble(opcode_data, &eg_vel2decay);
else if (opcode == "ampeg_vel2sustain")
readDouble(opcode_data, &eg_vel2sustain);
else if (opcode == "ampeg_vel2release")
readDouble(opcode_data, &eg_vel2release);
else if (opcode == "sample") {
sample = path + "/" + c.defaultPath + "/" + opcode_data_full; // spaces are allowed
sample.replace("\\", "/");
sample = sample.trimmed();
}
else if (opcode == "default_path") {
c.defaultPath = opcode_data_full;
}
else if (opcode == "key") {
lokey = readKey(opcode_data, c);
hikey = lokey;
pitch_keycenter = lokey;
}
else if (opcode == "pitch_keytrack")
readDouble(opcode_data, &pitch_keytrack);
else if (opcode == "trigger") {
if (opcode_data == "attack")
trigger = Trigger::ATTACK;
else if (opcode_data == "release")
trigger = Trigger::RELEASE;
else if (opcode_data == "first")
trigger = Trigger::FIRST;
else if (opcode_data == "legato")
trigger = Trigger::LEGATO;
else
qDebug("SfzRegion: bad trigger value: %s", qPrintable(opcode_data));
}
else if (opcode == "loop_mode") {
if (opcode_data == "no_loop")
loop_mode = LoopMode::NO_LOOP;
else if (opcode_data == "one_shot")
loop_mode = LoopMode::ONE_SHOT;
else if (opcode_data == "loop_continuous")
loop_mode = LoopMode::CONTINUOUS;
else if (opcode_data == "loop_sustain")
loop_mode = LoopMode::SUSTAIN;
//if (loop_mode != LoopMode::ONE_SHOT)
// qDebug("SfzRegion: loop_mode <%s>", qPrintable(opcode_data));
}
else if(opcode == "loop_start")
readLongLong(opcode_data, loopStart);
else if(opcode == "loop_end")
readLongLong(opcode_data, loopEnd);
else if (opcode.startsWith("on_locc")) {
int idx = b.mid(7).toInt();
if (idx >= 0 && idx < 128)
on_locc[idx] = i;
}
else if (opcode.startsWith("on_hicc")) {
int idx = b.mid(7).toInt();
if (idx >= 0 && idx < 128)
on_hicc[idx] = i;
}
else if (opcode.startsWith("locc")) {
int idx = b.mid(4).toInt();
if (!use_cc)
use_cc = i != 0;
//.........这里部分代码省略.........