当前位置: 首页>>代码示例>>C++>>正文


C++ IONUMBER函数代码示例

本文整理汇总了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
}
开发者ID:Akiyah,项目名称:io,代码行数:14,代码来源:IoDate.c

示例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;
}
开发者ID:achoy,项目名称:io,代码行数:50,代码来源:IoFile.c

示例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;
}
开发者ID:Akiyah,项目名称:io,代码行数:15,代码来源:IoClutterActor.c

示例4: IONUMBER

IoObject *IoTheoraInfo_frameHeight(IoTheoraInfo *self, IoObject *locals, IoMessage *m)
{
	/*doc TheoraInfo frameHeight
	The encoded frame height.
	*/
	return IONUMBER(DATA(self)->frame_height);
}
开发者ID:anthem,项目名称:io,代码行数:7,代码来源:IoTheoraInfo.c

示例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);
}
开发者ID:BMeph,项目名称:io,代码行数:29,代码来源:IoDBI.c

示例6: IONUMBER

IoObject *IoAppleSensors_getKeyboardBrightness(IoAppleSensors *self, IoObject *locals, IoMessage *m)
{
	/*doc AppleSensors getKeyboardBrightness
		Returns a number for the keyboard brightness.
	*/
	return IONUMBER(getKeyboardBrightness());
}
开发者ID:Alessandroo,项目名称:io,代码行数:7,代码来源:IoAppleSensors.c

示例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);
}
开发者ID:Akiyah,项目名称:io,代码行数:33,代码来源:IoEvDNSRequest.c

示例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));
}
开发者ID:Alessandroo,项目名称:io,代码行数:7,代码来源:IoImage.c

示例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) );
}
开发者ID:Teslos,项目名称:io,代码行数:26,代码来源:IoFont.c

示例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);
}
开发者ID:Akiyah,项目名称:io,代码行数:7,代码来源:IoAsyncRequest.c

示例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;
}
开发者ID:ADTSH,项目名称:io,代码行数:29,代码来源:IoMemcached.c

示例12: IONUMBER

IoObject *IoTheoraComment_count(IoTheoraComment *self, IoObject *locals, IoMessage *m)
{
	/*doc TheoraComment count
	Returns the number of comments.
	*/
	return IONUMBER(DATA(self)->comments);
}
开发者ID:ADTSH,项目名称:io,代码行数:7,代码来源:IoTheoraComment.c

示例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)));
}
开发者ID:Akiyah,项目名称:io,代码行数:7,代码来源:IoTagDB.c

示例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);
}
开发者ID:Habaut,项目名称:GameBindings,代码行数:28,代码来源:IoSandbox.c

示例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);
}
开发者ID:ADTSH,项目名称:io,代码行数:7,代码来源:IoRegexMatches.c


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