本文整理汇总了C++中IONUMBER函数的典型用法代码示例。如果您正苦于以下问题:C++ IONUMBER函数的具体用法?C++ IONUMBER怎么用?C++ IONUMBER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IONUMBER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IO_METHOD
IO_METHOD(IoDate, gmtOffsetSeconds)
{
/*doc Date gmtOffsetSeconds
Returns the system's seconds east of UTC.
*/
time_t t = time(NULL);
const struct tm *tp = localtime(&t);
#if defined(__CYGWIN__) || defined(_WIN32)
return IONUMBER(_timezone);
#else
return IONUMBER(tp->tm_gmtoff);
#endif
}
示例2: IO_METHOD
IO_METHOD(IoFile, foreach)
{
/*doc File foreach(optionalIndex, value, message)
For each byte, set index to the index of the byte
and value to the number containing the byte value and execute aMessage.
Example usage:
<p>
<pre>
aFile foreach(i, v, writeln("byte at ", i, " is ", v))
aFile foreach(v, writeln("byte ", v))
</pre>
*/
IoObject *result;
IoSymbol *indexSlotName, *characterSlotName;
IoMessage *doMessage;
int i = 0;
IoFile_assertOpen(self, locals, m);
result = IONIL(self);
IoMessage_foreachArgs(m, self, &indexSlotName, &characterSlotName, &doMessage);
for (;;)
{
int c = getc(DATA(self)->stream);
if (c == EOF)
{
break;
}
if (indexSlotName)
{
IoObject_setSlot_to_(locals, indexSlotName, IONUMBER(i));
}
IoObject_setSlot_to_(locals, characterSlotName, IONUMBER(c));
result = IoMessage_locals_performOn_(doMessage, locals, locals);
if (IoState_handleStatus(IOSTATE))
{
break;
}
i ++;
}
return result;
}
示例3: IO_METHOD
IO_METHOD(IoClutterActor, getRotation) {
ClutterRotateAxis axis = IoMessage_locals_intArgAt_(m, locals, 0);
float x = 0,
y = 0,
z = 0;
double angle = clutter_actor_get_rotation(IOCACTOR(self), axis, &x, &y, &z);
IoObject *rotation = IoObject_new(IOSTATE);
IoObject_setSlot_to_(rotation, IOSYMBOL("x"), IONUMBER(x));
IoObject_setSlot_to_(rotation, IOSYMBOL("y"), IONUMBER(y));
IoObject_setSlot_to_(rotation, IOSYMBOL("z"), IONUMBER(z));
IoObject_setSlot_to_(rotation, IOSYMBOL("angle"), IONUMBER(angle));
return rotation;
}
示例4: IONUMBER
IoObject *IoTheoraInfo_frameHeight(IoTheoraInfo *self, IoObject *locals, IoMessage *m)
{
/*doc TheoraInfo frameHeight
The encoded frame height.
*/
return IONUMBER(DATA(self)->frame_height);
}
示例5: IoMessage_locals_valueArgAt_
IoObject *IoDBI_initWithDriversPath(IoDBI *self, IoObject *locals,
IoMessage *m)
{
/*doc DBI initWithDriversPath
Initialize the DBI environment with the specified libdbi driver path.
*/
IoObject *dir = IoMessage_locals_valueArgAt_(m, locals, 0);
if (ISSYMBOL(dir))
{
DATA(self)->driverCount = dbi_initialize(CSTRING(dir));
}
else
{
IoState_error_(IOSTATE, m, "argument 0 to method '%s' must be a Symbol, not a '%s'\n",
CSTRING(IoMessage_name(m)), IoObject_name(dir));
}
if (DATA(self)->driverCount == -1)
{
IoState_error_(IOSTATE, m, "*** IoDBI error during dbi_initialize\n");
}
else
{
DATA(self)->didInit = 1;
}
return IONUMBER(DATA(self)->driverCount);
}
示例6: IONUMBER
IoObject *IoAppleSensors_getKeyboardBrightness(IoAppleSensors *self, IoObject *locals, IoMessage *m)
{
/*doc AppleSensors getKeyboardBrightness
Returns a number for the keyboard brightness.
*/
return IONUMBER(getKeyboardBrightness());
}
示例7: IoEvDNSRequest_callback
void IoEvDNSRequest_callback(int result, char type, int count, int ttl, void *addresses, void *arg)
{
IoEvDNSRequest *self = arg;
//type is either DNS_IPv4_A or DNS_PTR or DNS_IPv6_AAAA
IoObject_setSlot_to_(self, IOSYMBOL("ttl"), IONUMBER(ttl));
if(result == DNS_ERR_NONE)
{
IoList *ioAddresses = IoList_new(IOSTATE);
IoObject_setSlot_to_(self, IOSYMBOL("addresses"), ioAddresses);
int i;
for (i = 0; i < count; i ++)
{
//addresses needs to be cast according to type
uint32_t a = ((uint32_t *)addresses)[i];
struct in_addr addr;
char *ip;
addr.s_addr = htonl(get32(rr->rdata));
ip = (char *)inet_ntoa(addr);
IoList_rawAppend_(ioAddresses, IOSYMBOL(ip));
}
}
else
{
IoObject_setSlot_to_(self, IOSYMBOL("error"), IOSYMBOL("fail"));
}
IoMessage *m = IoMessage_newWithName_label_(IOSTATE, IOSYMBOL("handleResponse"), IOSYMBOL("IoEvDNSRequest"));
IoMessage_locals_performOn_(m, self, self);
}
示例8: IONUMBER
IoObject *IoImage_decodingHeightHint(IoImage *self, IoObject *locals, IoMessage *m)
{
/*doc Image decodingHeightHint
Returns the decoding height hint.
*/
return IONUMBER(Image_decodingHeightHint(DATA(self)->image));
}
示例9: IoMessage_locals_seqArgAt_
IoObject *IoFont_lengthOfString(IoFont *self, IoObject *locals, IoMessage *m)
{
/*doc Font widthOfString(aString)
Returns a Number with the width that aString would render
to with the receiver's current settings.
*/
IoSymbol *text = IoMessage_locals_seqArgAt_(m, locals, 0);
int startIndex = 0;
int max = IoSeq_rawSize(text);
int endIndex = max;
if (IoMessage_argCount(m) == 2)
{
startIndex = IoNumber_asInt(IoMessage_locals_numberArgAt_(m, locals, 1));
if (startIndex > max) startIndex = max;
}
if (IoMessage_argCount(m) > 2)
{
endIndex = IoNumber_asInt(IoMessage_locals_numberArgAt_(m, locals, 2));
if (startIndex > max) endIndex = max;
}
return IONUMBER( GLFont_lengthOfString( DATA(self)->font, CSTRING(text), startIndex, endIndex) );
}
示例10: IONUMBER
IoObject *IoAsyncRequest_descriptor(IoAsyncRequest *self, IoObject *locals, IoMessage *m)
{
/*doc AsyncRequest descriptor
Returns the descriptor for the request.
*/
return IONUMBER(IOCB(self)->aio_fildes);
}
示例11: switch
IoObject *IoMemcached_deserialize(IoMemcached *self, char *cvalue, size_t size, uint32_t flags) {
IoObject *object;
switch(flags) {
case _FLAG_NUMBER:
object = IONUMBER(atof(cvalue));
break;
case _FLAG_NIL:
object = IOSTATE->ioNil;
break;
case _FLAG_BOOLEAN:
if(strncmp(cvalue, "1", 1) == 0)
object = IOSTATE->ioTrue;
else
object = IOSTATE->ioFalse;
break;
case _FLAG_OBJECT:
//object = IoState_doCString_(self, cvalue);
IoState_pushRetainPool(IOSTATE);
IoSeq *serialized = IoSeq_newWithCString_length_(IOSTATE, cvalue, size);
object = IoObject_rawDoString_label_(self, serialized, IOSYMBOL("IoMemcached_deserialize"));
IoState_popRetainPoolExceptFor_(IOSTATE, object);
break;
default:
object = IoSeq_newWithCString_length_(IOSTATE, cvalue, size);
}
return object;
}
示例12: IONUMBER
IoObject *IoTheoraComment_count(IoTheoraComment *self, IoObject *locals, IoMessage *m)
{
/*doc TheoraComment count
Returns the number of comments.
*/
return IONUMBER(DATA(self)->comments);
}
示例13: IONUMBER
IoObject *IoTagDB_size(IoTagDB *self, IoObject *locals, IoMessage *m)
{
/*doc TagDB size
Returns number of keys in the database.
*/
return IONUMBER(TagDB_size(DATA(self)));
}
示例14: IO_METHOD
IO_METHOD(IoSandbox, doSandboxString)
{
/*doc Sandbox doSandboxString(aString)
Evaluate aString inside the Sandbox.
*/
IoState *boxState = IoSandbox_boxState(self);
char *s = IoMessage_locals_cStringArgAt_(m, locals, 0);
IoObject *result = IoState_doSandboxCString_(boxState, s);
if (ISSYMBOL(result))
{
return IOSYMBOL(CSTRING(result));
}
if (ISSEQ(result))
{
return IOSEQ(IOSEQ_BYTES(result), IOSEQ_LENGTH(result));
}
if (ISNUMBER(result))
{
return IONUMBER(CNUMBER(result));
}
return IONIL(self);
}
示例15: IONUMBER
IoObject *IoRegexMatches_position(IoRegexMatches *self, IoObject *locals, IoMessage *m)
{
/*doc RegexMatches position
Returns the search position as an index in the string.
*/
return IONUMBER(DATA(self)->position);
}