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

C++ IOASSERT函数代码示例

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

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



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

示例1: IoObject_getSlot_

IoObject *IoTokyoCabinetPrefixCursor_key(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc TokyoCabinetPrefixCursor key
	Returns current cursor key or nil.
	*/
	
	int size;
	char *ks;
	
	IoSeq *prefix = IoObject_getSlot_(self, IOSYMBOL("prefix"));
	IOASSERT(ISSEQ(prefix), "prefix must be a sequence");
	IOASSERT(TokyoCabinetPrefixCursor(self), "invalid TokyoCabinetPrefixCursor");
	ks = tcbdbcurkey(TokyoCabinetPrefixCursor(self), &size);

	if (ks)
	{
		UArray *k = UArray_newWithData_type_size_copy_(ks, CTYPE_uint8_t, size, 1);
	
		if (UArray_beginsWith_(k, IoSeq_rawUArray(prefix)))
		{
			//printf("prefix '%s'\n", UArray_bytes(IoSeq_rawUArray(prefix)));
			//printf("before clip '%s'\n", UArray_bytes(k));
			UArray_clipBeforeEndOf_(k, IoSeq_rawUArray(prefix));
			UArray_removeFirst(k); // remove separator
			//printf("after clip  '%s'\n", UArray_bytes(k));
			return IoSeq_newWithUArray_copy_(IOSTATE, k, 0);
		}

		UArray_free(k);
	}

	return IONIL(self);
}
开发者ID:ADTSH,项目名称:io,代码行数:33,代码来源:IoTokyoCabinetPrefixCursor.c


示例2: IO_METHOD

IO_METHOD(IoDate, setDay)
{
	/*doc Date setDay(aNumber)
	Sets the day of the receiver. Returns self.
	*/

	int v = IoMessage_locals_intArgAt_(m, locals, 0);
	int month = Date_month(DATA(self)) + 1;

	IOASSERT(v >= 1 && v <= 31, "day must be within range 1-31");

	if (month == 2)
	{
		if (Date_isLeapYear(DATA(self)))
		{
			IOASSERT(v >= 1 && v <= 29, "day must be within range 1-29");
		}
		else
		{
			IOASSERT(v >= 1 && v <= 28, "day must be within range 1-28");
		}
	}
	else if (month == 11)
	{
		IOASSERT(v >= 1 && v <= 30, "day must be within range 1-30");
	}
	else if (month == 12)
	{
		IOASSERT(v >= 1 && v <= 31, "day must be within range 1-31");
	}

	Date_setDay_(DATA(self), v);
	IoObject_isDirty_(self, 1);
	return self;
}
开发者ID:bomma,项目名称:io,代码行数:35,代码来源:IoDate.c


示例3: IoMessage_locals_listArgAt_

/*doc Memcached getMulti(keys)
Asks memcached to retrieve data corresponding to the list of keys.
Returns a Map with the results.
If some of the keys appearing in a retrieval request are not sent back
by the server in the item list this means that the server does not
hold items with such keys
*/
IoObject *IoMemcached_getMulti(IoMemcached *self, IoObject *locals, IoMessage *m)
{
	IoList *keys_list = IoMessage_locals_listArgAt_(m, locals, 0);
	size_t keys_list_size = IoList_rawSize(keys_list);

	IoObject *results_map = IoMap_new(IOSTATE);

	if(keys_list_size == 0)
		return results_map;

	int i;
	for(i = 0; i < keys_list_size; i++) {
		IoSeq *key = IoList_rawAt_(keys_list, i);
		IOASSERT(ISSEQ(key), "key must be a Sequence");
		IOASSERT(IOSEQ_LENGTH(key) > 0, "key cannot be an empty Sequence");
		IOASSERT(IOSEQ_LENGTH(key) < MEMCACHED_MAX_KEY, "key is too long");
	}

	const char **ckeys = (const char **) malloc(sizeof(const char *) * keys_list_size);
	size_t *ckey_lengths = (size_t *) malloc(sizeof(size_t) * keys_list_size);

	for(i = 0; i < keys_list_size; i++) {
		ckeys[i] = CSTRING(IoList_rawAt_(keys_list, i));
		ckey_lengths[i] = strlen(ckeys[i]);
	}

	memcached_return_t rc = memcached_mget(DATA(self)->mc, ckeys, ckey_lengths, keys_list_size);

	free(ckeys);
	free(ckey_lengths);

	char returned_key[MEMCACHED_MAX_KEY], *returned_value;
	size_t returned_key_length, returned_value_length;
	uint32_t flags;

	returned_value = memcached_fetch(DATA(self)->mc,
		returned_key, &returned_key_length,
		&returned_value_length, &flags, &rc
	);

	while(returned_value != NULL) {
		IoMap_rawAtPut(results_map,
			IoSeq_newSymbolWithData_length_(IOSTATE, returned_key, returned_key_length),
			IoMemcached_deserialize(self, returned_value, returned_value_length, flags)
		);

		free(returned_value);

		returned_value = memcached_fetch(DATA(self)->mc,
			returned_key, &returned_key_length,
			&returned_value_length, &flags, &rc
		);
	}

	return results_map;
}
开发者ID:ADTSH,项目名称:io,代码行数:63,代码来源:IoMemcached.c


示例4: IOASSERT

IoObject *IoTokyoCabinetPrefixCursor_remove(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc TokyoCabinetPrefixCursor remove
	Removes the current cursor postion. Returns self.
	*/

	IOASSERT(TokyoCabinetPrefixCursor(self), "invalid TokyoCabinetPrefixCursor");

	IOASSERT(tcbdbcurout(TokyoCabinetPrefixCursor(self)), tcbdberrmsg(tcbdbecode(TokyoCabinet(self))));

	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:12,代码来源:IoTokyoCabinetPrefixCursor.c


示例5: IoMessage_locals_seqArgAt_

IoObject *IoTokyoCabinetPrefixCursor_put(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc TokyoCabinetPrefixCursor put(value)
	Sets the value at the current cursor postion. Returns self.
	*/
	
	IoSeq *value = IoMessage_locals_seqArgAt_(m, locals, 0);

	IOASSERT(TokyoCabinetPrefixCursor(self), "invalid TokyoCabinetPrefixCursor");

	IOASSERT(tcbdbcurput(TokyoCabinetPrefixCursor(self), (const char *)IoSeq_rawBytes(value), IoSeq_rawSizeInBytes(value), BDBCPCURRENT), tcbdberrmsg(tcbdbecode(TokyoCabinet(self))));

	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:14,代码来源:IoTokyoCabinetPrefixCursor.c


示例6: IoObject_getSlot_

IoObject *IoEvConnection_connect(IoEvConnection *self, IoObject *locals, IoMessage *m)
{
	IoEventManager *em = IoObject_getSlot_(self, IOSYMBOL("eventManager"));
	IoSeq *address = IoObject_seqGetSlot_(self, IOSYMBOL("address"));
	int port = IoObject_doubleGetSlot_(self, IOSYMBOL("port"));

	IOASSERT(CONN(self) == 0x0, "already have connection");
	IOASSERT(ISEEVENTMANAGER(em), "eventManager slot not set properly");

	//printf("IoEventManager_rawBase(em) = %p\n", (void *)IoEventManager_rawBase(em));

	IoObject_setDataPointer_(self, evhttp_connection_new(CSTRING(address), port));
	evhttp_connection_set_base(CONN(self), IoEventManager_rawBase(em));
	evhttp_connection_set_closecb(CONN(self), IoEvConnection_ConnectionCloseCallback, self);
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:16,代码来源:IoEvConnection.c


示例7: th_decode_ycbcr_out

IoObject *IoTheoraDecodeContext_ycbcr(IoTheoraDecodeContext *self, IoObject *locals, IoMessage *m)
{
	/*doc TheoraDecodecontext ycbcr
	Returns an object containing the YUV data from the decoded frame.
	*/
        th_ycbcr_buffer buffer;
	int ret = th_decode_ycbcr_out(DATA(self)->ctx, buffer);
	IOASSERT(ret == 0, "th_decode_ycbcr_out failed");
	
	IoObject* yuv0 = IoObject_new(IOSTATE);
	IoObject* yuv1 = IoObject_new(IOSTATE);
	IoObject* yuv2 = IoObject_new(IOSTATE);
	IoObject_setSlot_to_(yuv0, IOSYMBOL("width"), IONUMBER(buffer[0].width));
	IoObject_setSlot_to_(yuv0, IOSYMBOL("height"), IONUMBER(buffer[0].height));
	IoObject_setSlot_to_(yuv0, IOSYMBOL("stride"), IONUMBER(buffer[0].stride));
	IoObject_setSlot_to_(yuv0, IOSYMBOL("data"), IOSEQ(buffer[0].data, buffer[0].stride * buffer[0].height));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("width"), IONUMBER(buffer[1].width));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("height"), IONUMBER(buffer[1].height));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("stride"), IONUMBER(buffer[1].stride));
	IoObject_setSlot_to_(yuv1, IOSYMBOL("data"), IOSEQ(buffer[1].data, buffer[1].stride * buffer[1].height));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("width"), IONUMBER(buffer[2].width));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("height"), IONUMBER(buffer[2].height));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("stride"), IONUMBER(buffer[2].stride));
	IoObject_setSlot_to_(yuv2, IOSYMBOL("data"), IOSEQ(buffer[2].data, buffer[2].stride * buffer[2].height));

	IoList* result = IoList_new(IOSTATE);
	IoList_rawAppend_(result, yuv0);
	IoList_rawAppend_(result, yuv1);
	IoList_rawAppend_(result, yuv2);
	return result;
}
开发者ID:ADTSH,项目名称:io,代码行数:31,代码来源:IoTheoraDecodeContext.c


示例8: IoState_currentCoroutine

IoObject *IoObject_performWithDebugger(IoCoroutine *self, IoObject *locals, IoMessage *m)
{
	IoState *state = IOSTATE;
	IoObject *currentCoroutine = IoState_currentCoroutine(state);

	if (IoCoroutine_rawDebuggingOn(currentCoroutine))
	{
		IoObject *debugger = state->debugger; // stack retain it?

		if (debugger)
		{
			IoObject_setSlot_to_(debugger, IOSYMBOL("messageCoroutine"), currentCoroutine);
			IoObject_setSlot_to_(debugger, IOSYMBOL("messageSelf"), self);
			IoObject_setSlot_to_(debugger, IOSYMBOL("messageLocals"), locals);
			IoObject_setSlot_to_(debugger, IOSYMBOL("message"), m);

			{
				IoObject *context;
				IoCoroutine *c = IoObject_rawGetSlot_context_(debugger, IOSYMBOL("debuggerCoroutine"), &context);
				IOASSERT(c, "Debugger needs a debuggerCoroutine slot");
				IoCoroutine_rawResume(c);
			}
		}
	}

	return IoObject_perform(self, locals, m);
}
开发者ID:jdp,项目名称:io,代码行数:27,代码来源:IoCoroutine.c


示例9: DATA

Uint64Array *IoTagDB_tagArrayForTagNames_(IoTagDB *self, IoMessage *m, IoList *tagNames)
{
	TagDB *tdb = DATA(self);
	Uint64Array *tags = Uint64Array_new();
	int i;

	for (i = 0; i < IoList_rawSize(tagNames); i ++)
	{
		IoSeq *tagName = IoList_rawAt_(tagNames, i);
		symbolid_t keyid;
		
		IOASSERT(ISSEQ(tagName), "tag names must be Sequences");

		keyid = TagDB_idForSymbol_size_(tdb, CSTRING(tagName), IoSeq_rawSize(tagName));

		Uint64Array_append_(tags, keyid);
		/*
		{
		Datum *keyDatum = TagDB_symbolForId_(tdb, keyid);	
		printf("%s -> %i && ", CSTRING(tagName), (int)keyid);
		printf("%i -> %s\n", (int)keyid, (char *)(keyDatum->data));
		Datum_free(keyDatum);
		}
		*/
	}

	return tags;
}
开发者ID:Akiyah,项目名称:io,代码行数:28,代码来源:IoTagDB.c


示例10: IOASSERT

IoObject *IoTokyoCabinetCursor_last(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc TokyoCabinetCursor last
	Move cursor to last record. Returns self
	*/

	IOASSERT(TokyoCabinetCursor(self), "invalid TokyoCabinetCursor");
	return IOBOOL(self, tcbdbcurlast(TokyoCabinetCursor(self)));
}
开发者ID:ADTSH,项目名称:io,代码行数:9,代码来源:IoTokyoCabinetCursor.c


示例11: IO_METHOD

IO_METHOD(IoSeq, insertSeqEvery)
{
	/*doc MutableSequence IoSeq_insertSeqEvery(aSequence, aNumberOfItems)
	Inserts aSequence every aNumberOfItems.  Returns self.
	*/

	IoSeq *otherSeq = IoMessage_locals_valueAsStringArgAt_(m, locals, 0);
	size_t itemCount = IoMessage_locals_sizetArgAt_(m, locals, 1);

	IO_ASSERT_NOT_SYMBOL(self);

	IOASSERT(itemCount > 0, "aNumberOfItems must be > 0");
	IOASSERT(itemCount <= UArray_size(DATA(self)), "aNumberOfItems out of sequence bounds");
	
	UArray_insert_every_(DATA(self), DATA(otherSeq), itemCount);

	return self;
}
开发者ID:Alessandroo,项目名称:io,代码行数:18,代码来源:IoSeq_mutable.c


示例12: IoMessage_locals_cStringArgAt_

//doc Loudmouth registerAccount(server, username, password) Registers a new account at XMPP server. Returns <code>true</code> or <code>false</code>.
IoObject *IoLoudmouth_registerAccount(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
  char *server    = IoMessage_locals_cStringArgAt_(m, locals, 0),
       *username  = IoMessage_locals_cStringArgAt_(m, locals, 1),
       *password  = IoMessage_locals_cStringArgAt_(m, locals, 2),
       *error_message = "Unknown error";
  LmConnection *connection = lm_connection_new(server);
  LmMessage *xmpp_msg, *xmpp_reply;
  LmMessageNode *query, *node;
  int success = 0;

  if(!lm_connection_open_and_block(connection, NULL)) {
    error_message = "Could not open connection";
    success = 0;
  } else {
    xmpp_msg = lm_message_new_with_sub_type(NULL, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_SET);
    query = lm_message_node_add_child(xmpp_msg->node, "query", NULL);
    lm_message_node_set_attributes(query,
      "xmlns", "jabber:iq:register",
      NULL);
    lm_message_node_add_child(query, "username", username);
    lm_message_node_add_child(query, "password", password);

    xmpp_reply = lm_connection_send_with_reply_and_block(connection, xmpp_msg, NULL);
    lm_connection_close(connection, NULL);
    lm_connection_unref(connection);

    if(!xmpp_reply) {
      success = 0;
      error_message = "No reply from server";
    } else {
      switch(lm_message_get_sub_type(xmpp_reply)) {
        case LM_MESSAGE_SUB_TYPE_RESULT:
          success = 1;
          break;
        case LM_MESSAGE_SUB_TYPE_ERROR:
        default:
          success = 0;
          node = lm_message_node_find_child(xmpp_reply->node, "error");
          error_message = (node == NULL) ? lm_message_node_get_value(node) : "Unknown error";

          lm_message_node_unref(node);
      }
    }

    lm_message_unref(xmpp_reply);
    lm_message_unref(xmpp_msg);
    lm_message_node_unref(query);
  }

  free(server);
  free(username);
  free(password);

  IOASSERT(success, error_message);
  free(error_message);
  return IOBOOL(self, success);
}
开发者ID:ADTSH,项目名称:io,代码行数:58,代码来源:IoLoudmouth.c


示例13: IOASSERT

IoObject *IoSkipDBM_compact(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc SkipDBM compact
	Compacts the database. Returns self.
	*/

	IOASSERT(SkipDBM_isOpen(SKIPDBM(self)), "skipdbm not open");
	SkipDBM_compact(SKIPDBM(self));
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:10,代码来源:IoSkipDBM.c


示例14: IOASSERT

IoObject *IoSkipDBCursor_previous(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc SkipDBCursor previous
	Move cursor to previous item. Returns self.
	*/

	IOASSERT(CURSOR(self), "SkipDBCursor invalid");
	SkipDBCursor_previous(CURSOR(self));
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:10,代码来源:IoSkipDBCursor.c


示例15: IOASSERT

IoObject *IoSkipDB_size(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc SkipDB size
	Returns the number of keys in the receiver.
	*/

	IOASSERT(SKIPDB(self) && SkipDB_isOpen(SKIPDB(self)), "invalid skipdb");

	return IONUMBER(SkipDB_count(SKIPDB(self)));
}
开发者ID:anthem,项目名称:io,代码行数:10,代码来源:IoSkipDB.c


示例16: IOASSERT

IoObject *IoLZODecoder_beginProcessing(IoLZODecoder *self, IoObject *locals, IoMessage *m)
{
	/*doc LZODecoder beginProcessing
	Initializes the algorithm.
	*/

	IOASSERT(lzo_init() == LZO_E_OK,  "Failed to init lzo");
	DATA(self)->isDone = 0;
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:10,代码来源:IoLZODecoder.c


示例17: IoMessage_locals_seqArgAt_

IoObject *IoTokyoCabinetPrefixCursor_jump(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc TokyoCabinetPrefixCursor jump(key)
	Move cursor to record before key. Returns self
	*/
	
	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);

	IOASSERT(TokyoCabinetPrefixCursor(self), "invalid TokyoCabinetPrefixCursor");
	return IOBOOL(self, tcbdbcurjump(TokyoCabinetPrefixCursor(self), (const void *)IoSeq_rawBytes(key), (int)IoSeq_rawSizeInBytes(key)));
}
开发者ID:eklitzke,项目名称:io,代码行数:11,代码来源:IoTokyoCabinetPrefixCursor.c


示例18: IoMessage_locals_seqArgAt_

IoObject *IoSkipDBCursor_goto(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc SkipDBCursor goto(aKey)
	Move cursor to the specified key or nearest preceeding key. Returns self
	*/

	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
	IOASSERT(CURSOR(self), "SkipDBCursor invalid");
	SkipDBCursor_goto_(CURSOR(self), IoSeq_asDatum(key));
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:11,代码来源:IoSkipDBCursor.c


示例19: IoMessage_locals_valueArgAt_

IoObject *IoBlowfish_setIsEncrypting(IoBlowfish *self, IoObject *locals, IoMessage *m)
{
	/*doc Blowfish setIsEncrypting(aBool)
	If aBool is true, encrypting mode is on, otherwise, decrypting mode is on.
	*/

	IoObject *v = IoMessage_locals_valueArgAt_(m, locals, 0);
	IOASSERT(ISTRUE(v) || ISFALSE(v), "requires boolean argument");
	DATA(self)->isEncrypting = ISTRUE(v);
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:11,代码来源:IoBlowfish.c


示例20: IoMessage_locals_seqArgAt_

IoObject *IoSkipDB_removeAt(IoObject *self, IoObject *locals, IoMessage *m)
{
	/*doc SkipDB atRemove(keySymbol)
	Removes the specified key. Returns self
	*/
	
	IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
	IOASSERT(SKIPDB(self) && SkipDB_isOpen(SKIPDB(self)), "invalid skipdb");
	SkipDB_removeAt_(SKIPDB(self), IoSeq_asDatum(key));
	return self;
}
开发者ID:anthem,项目名称:io,代码行数:11,代码来源:IoSkipDB.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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