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


C++ VALID函数代码示例

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


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

示例1: initialize

void initialize()
{
    static int a_buf[7*FIELDS], *a = a_buf;
    static int ac_buf[7*FIELDS], *ac = ac_buf;
    static const int dr[8] = { -1,  0,  0, +1, -1, -1, +1, +1 };
    static const int dc[8] = {  0, -1, +1,  0, -1, +1, -1, +1 };

    int r1, c1, r2, c2, d;

    for (r1 = 0; r1 < 7; ++r1)
    {
        for (c1 = 0; c1 < 7; ++c1)
        {
            sprintf(field_str[POS(r1,c1)], "%c%c", 'a' + c1, '1' + r1);
            adjacent[POS(r1,c1)] = a;
            adjacent_capture[POS(r1,c1)] = ac;
            for (d = 0; d < ((POS(r1,c1)&1) ? 4 : 8); ++d)
            {
                r2 = r1 + dr[d];
                c2 = c1 + dc[d];
                if (VALID(r2, c2))
                {
                    *a++ = POS(r2,c2);
                    if (VALID(r2 + dr[d], c2 + dc[d]))
                        *ac++ = POS(r2,c2);
                }
            }
            *a++  = -1;
            *ac++ = -1;
        }
    }
}
开发者ID:maksverver,项目名称:alquerque-player,代码行数:32,代码来源:main.c

示例2: StrMatchCase

/*************************************************************************
 * StrMatchCase
 */
int StrMatchCase(char *string, char *pattern)
{
  assert(VALID(string));
  assert(VALID(pattern));
  
  for (; ('*' != *pattern); ++pattern, ++string)
    {
      if (NIL == *string)
	{
	  return (NIL == *pattern);
	}
      if ((*string != *pattern)
	  && ('?' != *pattern))
	{
	  return FALSE;
	}
    }
  /* two-line patch to prevent *too* much recursiveness: */
  while ('*' == pattern[1])
    pattern++;

  do
    {
      if ( StrMatchCase(string, &pattern[1]) )
	{
	  return TRUE;
	}
    }
  while (*string++);
  
  return FALSE;
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:35,代码来源:strio.c

示例3: StrEqualMax

/*************************************************************************
 * StrEqualMax
 */
int StrEqualMax(const char *first, size_t max, const char *second)
{
  assert(VALID(first));
  assert(VALID(second));

  if (VALID(first) && VALID(second))
    {
#if defined(USE_STRNCASECMP)
      return (0 == strncasecmp(first, second, max));
#else
      /* Not adequately tested yet */
      size_t cnt = 0;
      while ((*first != NIL) && (*second != NIL) && (cnt <= max))
	{
	  if (toupper(*first) != toupper(*second))
	    {
	      break;
	    }
	  first++;
	  second++;
	  cnt++;
	}
      return ((cnt == max) || ((*first == NIL) && (*second == NIL)));
#endif
    }
  return FALSE;
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:30,代码来源:strio.c

示例4: main

int main()
{
	printf("%d, %d, %d\n",DAYS(2010,2),DAYS(2010,8),DAYS(2010,11));

	printf("%d,%d\n", VALID(2010,2,29),VALID(2020,2,29));
	return 0;

}
开发者ID:cbeigong,项目名称:c,代码行数:8,代码来源:leapdays.c

示例5: assert

/*************************************************************************
 * StrAppendMax
 */
char *StrAppendMax(char *target, size_t max, const char *source)
{
  assert(VALID(target));
  assert(VALID(source));
  assert(max > 0);

  max -= StrLength(target) + 1;
  return (max > 0) ? strncat(target, source, max) : target;
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:12,代码来源:strio.c

示例6: jx_pointer_clone

void jx_pointer_clone(const jx_pointer *self, jx_pointer *out_clone) {
  VALID(self);

  /* point to the same data */
  out_clone->data = self->data;
  /* increment the reference counter */
  out_clone->data->refs++;

  VALID(out_clone);
}
开发者ID:jw0,项目名称:jinks,代码行数:10,代码来源:jx_pointer.c

示例7: strings

int
strings(char *fn) {
	FILE *f; 
	int state=1; 
	int c; 
	char *seq = 0; 

	f = stdin; 
	if (fn && (f = fopen(fn, "r")) == NULL)
		return -1; 

	if (!fn)
		fn = "standard input"; 

	while ((c = getc(f)) != EOF) {
	redo:
		switch (state) {
		case 0: 	/* searching for ascii */
			if (VALID(c)) {
				state=1; 
				seq = seq_hold; 
				goto redo; 
			}
			break; 
		case 1: 	/* holding sequence */
			if (VALID(c)) {
				*seq++ = c; 

				if (seq-seq_hold >= opts.minlen) {
					*seq++ = 0; 
					if (opts.pr_fn)
						printf("%s: ", fn);
					printf("%s", seq_hold);
					state = 2; 
				}
			} else 
				state = 0; 
			break; 

		case 2: 	/* write sequences */
			if (VALID(c)) {
				putchar(c); 
			} else {
				putchar('\n'); 
				state = 0; 
			}
			break; 
		}
	}
	if (state == 2) 
		putchar('\n'); 
	if (f != stdin) 
		fclose(f); 
	return 0; 
}
开发者ID:cjgd,项目名称:cutils,代码行数:55,代码来源:strings.c

示例8: StrEqualLocale

/*************************************************************************
 * StrEqualLocale
 */
int StrEqualLocale(const char *first, const char *second)
{
  assert(VALID(first));
  assert(VALID(second));

#if defined(LC_COLLATE)
  return (strcoll(first, second) == 0);
#else
  return StrEqual(first, second);
#endif
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:14,代码来源:strio.c

示例9: StrEqualCaseMax

/*************************************************************************
 * StrEqualCaseMax
 */
int StrEqualCaseMax(const char *first, size_t max, const char *second)
{
  assert(VALID(first));
  assert(VALID(second));

  if (VALID(first) && VALID(second))
    {
      return (0 == strncmp(first, second, max));
    }
  return FALSE;
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:14,代码来源:strio.c

示例10: StrEqualCase

/*************************************************************************
 * StrEqualCase
 */
int StrEqualCase(const char *first, const char *second)
{
  assert(VALID(first));
  assert(VALID(second));

  if (VALID(first) && VALID(second))
    {
      return (0 == strcmp(first, second));
    }
  return FALSE;
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:14,代码来源:strio.c

示例11: StrFormatDateMax

/*************************************************************************
 * StrFormatDate
 */
size_t StrFormatDateMax(char *target,
			size_t max,
			const char *format,
			const struct tm *datetime)
{
  assert(VALID(target));
  assert(VALID(format));
  assert(VALID(datetime));
  assert(max > 0);
  
  return strftime(target, max, format, datetime);
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:15,代码来源:strio.c

示例12: channel_info

static void
channel_info (void *elem, void *data)
{
    CHANNEL *chan = (CHANNEL *) elem;

    ASSERT (VALID (elem));
    ASSERT (VALID (data));
    if ((chan->flags & ON_CHANNEL_PRIVATE) == 0)
	send_cmd ((CONNECTION *) data, MSG_SERVER_CHANNEL_LIST /* 618 */ ,
		  "%s %d %s", chan->name,
		  effective_channel_count (chan->users,
					   ((CONNECTION *) data)->user->
					   level >= LEVEL_MODERATOR),
		  chan->topic);
}
开发者ID:OS2World,项目名称:APP-SERVER-opennap,代码行数:15,代码来源:list_channels.c

示例13: skiplist_itor_valid

bool
skiplist_itor_valid(const skiplist_itor* itor)
{
    ASSERT(itor != NULL);

    return VALID(itor);
}
开发者ID:SavOK,项目名称:libdict,代码行数:7,代码来源:skiplist.c

示例14: VALID

bool DomainShader::Create(Blob & shaderbuffer)
{
	HRESULT hr = DX11API::D3D11Device()->CreateDomainShader(shaderbuffer.m_pBlob->GetBufferPointer(),
		shaderbuffer.m_pBlob->GetBufferSize(), nullptr, &m_pShader);

	VALID(hr);
}
开发者ID:Dgek,项目名称:RenderMaster,代码行数:7,代码来源:DomainShader.cpp

示例15: StrSpanFunction

/*************************************************************************
 * StrSpanFunction
 *
 * Untested
 */
size_t StrSpanFunction(char *source, int (*Function)(int))
{
  size_t count = 0;

  assert(VALID(source));
  assert(VALID(Function));
  
  while (*source != NIL)
    {
      if (Function(*source))
	break; /* while */
      source++;
      count++;
    }
  return count;
}
开发者ID:CESNET,项目名称:glite-lb,代码行数:21,代码来源:strio.c


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