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

C++ FullTextMatch函数代码示例

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

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



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

示例1: MatchInAlphaList

int MatchInAlphaList(AlphaList *al, char *string)
{
    Item *ip;
    int i = (int) *string;

    if (isalnum(i) || *string == '_')
    {
        for (ip = al->list[i]; ip != NULL; ip = ip->next)
        {
            if (FullTextMatch(string, ip->name))
            {
                return true;
            }
        }
    }
    else
    {
        // We don't know what the correct hash is because the pattern in vague

        for (i = 0; i < CF_ALPHABETSIZE; i++)
        {
            for (ip = al->list[i]; ip != NULL; ip = ip->next)
            {
                if (FullTextMatch(string, ip->name))
                {
                    return true;
                }
            }
        }
    }

    return false;
}
开发者ID:fbettag,项目名称:core,代码行数:33,代码来源:alphalist.c


示例2: DefaultVarPromise

void DefaultVarPromise(Promise *pp)

{
    char *regex = GetConstraintValue("if_match_regex", pp, CF_SCALAR);
    Rval rval;
    enum cfdatatype dt;
    Rlist *rp;
    bool okay = true;

    dt = GetVariable("this", pp->promiser, &rval);

    switch (dt)
    {
    case cf_str:
    case cf_int:
    case cf_real:

        if (regex && !FullTextMatch(regex,rval.item))
        {
            return;
        }

        if (regex == NULL)
        {
            return;
        }

        break;

    case cf_slist:
    case cf_ilist:
    case cf_rlist:

        if (regex)
        {
            for (rp = (Rlist *) rval.item; rp != NULL; rp = rp->next)
            {
                if (FullTextMatch(regex,rp->item))
                {
                    okay = false;
                    break;
                }
            }

            if (okay)
            {
                return;
            }
        }

        break;

    default:
        break;
    }

    DeleteScalar(pp->bundle, pp->promiser);
    ConvergeVarHashPromise(pp->bundle, pp, true);
}
开发者ID:xrg,项目名称:cfengine-core,代码行数:59,代码来源:vars.c


示例3: SelectOwnerMatch

static int SelectOwnerMatch(char *path, struct stat *lstatptr, Rlist *crit)
{
    AlphaList leafattrib;
    Rlist *rp;
    char ownerName[CF_BUFSIZE];
    int gotOwner;

    InitAlphaList(&leafattrib);

#ifndef MINGW                   // no uids on Windows
    char buffer[CF_SMALLBUF];
    sprintf(buffer, "%jd", (uintmax_t) lstatptr->st_uid);
    PrependAlphaList(&leafattrib, buffer);
#endif /* MINGW */

    gotOwner = GetOwnerName(path, lstatptr, ownerName, sizeof(ownerName));

    if (gotOwner)
    {
        PrependAlphaList(&leafattrib, ownerName);
    }
    else
    {
        PrependAlphaList(&leafattrib, "none");
    }

    for (rp = crit; rp != NULL; rp = rp->next)
    {
        if (EvalFileResult((char *) rp->item, &leafattrib))
        {
            CfDebug(" - ? Select owner match\n");
            DeleteAlphaList(&leafattrib);
            return true;
        }

        if (gotOwner && FullTextMatch((char *) rp->item, ownerName))
        {
            CfDebug(" - ? Select owner match\n");
            DeleteAlphaList(&leafattrib);
            return true;
        }

#ifndef MINGW
        if (FullTextMatch((char *) rp->item, buffer))
        {
            CfDebug(" - ? Select owner match\n");
            DeleteAlphaList(&leafattrib);
            return true;
        }
#endif /* NOT MINGW */
    }

    DeleteAlphaList(&leafattrib);
    return false;
}
开发者ID:xrg,项目名称:cfengine-core,代码行数:55,代码来源:files_select.c


示例4: SelectOwnerMatch

static int SelectOwnerMatch(EvalContext *ctx, char *path, struct stat *lstatptr, Rlist *crit)
{
    Rlist *rp;
    char ownerName[CF_BUFSIZE];
    int gotOwner;

    StringSet *leafattrib = StringSetNew();

#ifndef __MINGW32__                   // no uids on Windows
    char buffer[CF_SMALLBUF];
    snprintf(buffer, CF_SMALLBUF, "%jd", (uintmax_t) lstatptr->st_uid);
    StringSetAdd(leafattrib, xstrdup(buffer));
#endif /* __MINGW32__ */

    gotOwner = GetOwnerName(path, lstatptr, ownerName, sizeof(ownerName));

    if (gotOwner)
    {
        StringSetAdd(leafattrib, xstrdup(ownerName));
    }
    else
    {
        StringSetAdd(leafattrib, xstrdup("none"));
    }

    for (rp = crit; rp != NULL; rp = rp->next)
    {
        if (EvalFileResult((char *) rp->item, leafattrib))
        {
            Log(LOG_LEVEL_DEBUG, "Select owner match");
            StringSetDestroy(leafattrib);
            return true;
        }

        if (gotOwner && (FullTextMatch(ctx, RlistScalarValue(rp), ownerName)))
        {
            Log(LOG_LEVEL_DEBUG, "Select owner match");
            StringSetDestroy(leafattrib);
            return true;
        }

#ifndef __MINGW32__
        if (FullTextMatch(ctx, RlistScalarValue(rp), buffer))
        {
            Log(LOG_LEVEL_DEBUG, "Select owner match");
            StringSetDestroy(leafattrib);
            return true;
        }
#endif /* !__MINGW32__ */
    }

    StringSetDestroy(leafattrib);
    return false;
}
开发者ID:nperron,项目名称:core,代码行数:54,代码来源:files_select.c


示例5: SelectGroupMatch

static int SelectGroupMatch(struct stat *lstatptr, Rlist *crit)
{
    AlphaList leafattrib;
    char buffer[CF_SMALLBUF];
    struct group *gr;
    Rlist *rp;

    InitAlphaList(&leafattrib);

    sprintf(buffer, "%jd", (uintmax_t) lstatptr->st_gid);
    PrependAlphaList(&leafattrib, buffer);

    if ((gr = getgrgid(lstatptr->st_gid)) != NULL)
    {
        PrependAlphaList(&leafattrib, gr->gr_name);
    }
    else
    {
        PrependAlphaList(&leafattrib, "none");
    }

    for (rp = crit; rp != NULL; rp = rp->next)
    {
        if (EvalFileResult((char *) rp->item, &leafattrib))
        {
            CfDebug(" - ? Select group match\n");
            DeleteAlphaList(&leafattrib);
            return true;
        }

        if (gr && FullTextMatch((char *) rp->item, gr->gr_name))
        {
            CfDebug(" - ? Select owner match\n");
            DeleteAlphaList(&leafattrib);
            return true;
        }

        if (FullTextMatch((char *) rp->item, buffer))
        {
            CfDebug(" - ? Select owner match\n");
            DeleteAlphaList(&leafattrib);
            return true;
        }
    }

    DeleteAlphaList(&leafattrib);
    return false;
}
开发者ID:xrg,项目名称:cfengine-core,代码行数:48,代码来源:files_select.c


示例6: SelectIsSymLinkTo

static int SelectIsSymLinkTo(char *filename,struct Rlist *crit)

{
#ifndef MINGW
  char buffer[CF_BUFSIZE];
  struct Rlist *rp;

for (rp = crit; rp != NULL; rp = rp->next)
   {
   memset(buffer,0,CF_BUFSIZE);
   
   if (readlink(filename,buffer,CF_BUFSIZE-1) == -1)
      {
      CfOut(cf_error,"readlink","Unable to read link %s in filter",filename);
      return false;      
      }

   if (FullTextMatch(rp->item,buffer))
      {
      return true;
      }
   }
#endif  /* NOT MINGW */
return false;      
}
开发者ID:Kegeruneku,项目名称:Cfengine-debian,代码行数:25,代码来源:files_select.c


示例7: CheckParseClass

int CheckParseClass(char *lval, char *s, const char *range)
{
    char output[CF_BUFSIZE];

    if (s == NULL)
    {
        return false;
    }

    CfDebug("\nCheckParseClass(%s => %s/%s)\n", lval, s, range);

    if (strlen(range) == 0)
    {
        return true;
    }

    if (FullTextMatch(range, s))
    {
        return true;
    }

    snprintf(output, CF_BUFSIZE, "Class item on rhs of lval \'%s\' given as { %s } is out of bounds (should match %s)",
             lval, s, range);
    ReportError(output);
    return false;
}
开发者ID:dnaeon,项目名称:core,代码行数:26,代码来源:syntax.c


示例8: IsMatchItemIn

int IsMatchItemIn(EvalContext *ctx, Item *list, const char *item)
/* Solve for possible regex/fuzzy models unified */
{
    Item *ptr;

    if ((item == NULL) || (strlen(item) == 0))
    {
        return true;
    }

    for (ptr = list; ptr != NULL; ptr = ptr->next)
    {
        if (FuzzySetMatch(ptr->name, item) == 0)
        {
            return (true);
        }

        if (IsRegex(ptr->name))
        {
            if (FullTextMatch(ctx, ptr->name, item))
            {
                return (true);
            }
        }
    }

    return (false);
}
开发者ID:lpefferkorn,项目名称:core,代码行数:28,代码来源:item_lib.c


示例9: SelectLastItemMatching

int SelectLastItemMatching(EvalContext *ctx, const char *regexp, Item *begin, Item *end, Item **match, Item **prev)
{
    Item *ip, *ip_last = NULL, *ip_prev = CF_UNDEFINED_ITEM;

    *match = CF_UNDEFINED_ITEM;
    *prev = CF_UNDEFINED_ITEM;

    for (ip = begin; ip != end; ip = ip->next)
    {
        if (ip->name == NULL)
        {
            continue;
        }

        if (FullTextMatch(ctx, regexp, ip->name))
        {
            *prev = ip_prev;
            ip_last = ip;
        }

        ip_prev = ip;
    }

    if (ip_last)
    {
        *match = ip_last;
        return true;
    }

    return false;
}
开发者ID:lpefferkorn,项目名称:core,代码行数:31,代码来源:item_lib.c


示例10: SelectNextItemMatching

int SelectNextItemMatching(const char *regexp, Item *begin, Item *end, Item **match, Item **prev)
{
    Item *ip_prev = CF_UNDEFINED_ITEM;

    *match = CF_UNDEFINED_ITEM;
    *prev = CF_UNDEFINED_ITEM;

    for (Item *ip = begin; ip != end; ip = ip->next)
    {
        if (ip->name == NULL)
        {
            continue;
        }

        if (FullTextMatch(regexp, ip->name))
        {
            *match = ip;
            *prev = ip_prev;
            return true;
        }

        ip_prev = ip;
    }

    return false;
}
开发者ID:fkoner,项目名称:core,代码行数:26,代码来源:item_lib.c


示例11: SelectExecRegexMatch

static int SelectExecRegexMatch(char *filename, char *crit, char *prog)
{
    char line[CF_BUFSIZE];
    FILE *pp;
    char buf[CF_MAXVARSIZE];

// insert real value of $(this.promiser) in command

    ReplaceStr(prog, buf, sizeof(buf), "$(this.promiser)", filename);
    ReplaceStr(prog, buf, sizeof(buf), "${this.promiser}", filename);

    if ((pp = cf_popen(buf, "r")) == NULL)
    {
        CfOut(cf_error, "cf_popen", "Couldn't open pipe to command %s\n", buf);
        return false;
    }

    while (!feof(pp))
    {
        line[0] = '\0';
        CfReadLine(line, CF_BUFSIZE, pp);       /* One buffer only */

        if (FullTextMatch(crit, line))
        {
            cf_pclose(pp);
            return true;
        }
    }

    cf_pclose(pp);
    return false;
}
开发者ID:xrg,项目名称:cfengine-core,代码行数:32,代码来源:files_select.c


示例12: SelectGroupMatch

static int SelectGroupMatch(EvalContext *ctx, struct stat *lstatptr, Rlist *crit)
{
    char buffer[CF_SMALLBUF];
    struct group *gr;
    Rlist *rp;

    StringSet *leafattrib = StringSetNew();

    snprintf(buffer, CF_SMALLBUF, "%jd", (uintmax_t) lstatptr->st_gid);
    StringSetAdd(leafattrib, xstrdup(buffer));

    if ((gr = getgrgid(lstatptr->st_gid)) != NULL)
    {
        StringSetAdd(leafattrib, xstrdup(gr->gr_name));
    }
    else
    {
        StringSetAdd(leafattrib, xstrdup("none"));
    }

    for (rp = crit; rp != NULL; rp = rp->next)
    {
        if (EvalFileResult((char *) rp->item, leafattrib))
        {
            Log(LOG_LEVEL_DEBUG, "Select group match");
            StringSetDestroy(leafattrib);
            return true;
        }

        if (gr && (FullTextMatch(ctx, (char *) rp->item, gr->gr_name)))
        {
            Log(LOG_LEVEL_DEBUG, "Select group match");
            StringSetDestroy(leafattrib);
            return true;
        }

        if (FullTextMatch(ctx, (char *) rp->item, buffer))
        {
            Log(LOG_LEVEL_DEBUG, "Select group match");
            StringSetDestroy(leafattrib);
            return true;
        }
    }

    StringSetDestroy(leafattrib);
    return false;
}
开发者ID:nperron,项目名称:core,代码行数:47,代码来源:files_select.c


示例13: MatchRegion

int MatchRegion(EvalContext *ctx, const char *chunk, const Item *begin, const Item *end, bool regex)
/*
  Match a region in between the selection delimiters. It is
  called after SelectRegion. The end delimiter will be visible
  here so we have to check for it. Can handle multi-line chunks
*/
{
    const Item *ip = begin;
    char buf[CF_BUFSIZE];
    int lines = 0;

    for (const char *sp = chunk; sp <= chunk + strlen(chunk); sp++)
    {
        memset(buf, 0, CF_BUFSIZE);
        sscanf(sp, "%[^\n]", buf);
        sp += strlen(buf);

        if (ip == NULL)
        {
            return false;
        }

        if (!regex && strcmp(buf, ip->name) != 0)
        {
            return false;
        }
        if (regex && !FullTextMatch(ctx, buf, ip->name))
        {
            return false;
        }

        lines++;

        // We have to manually exclude the marked terminator

        if (ip == end)
        {
            return false;
        }

        // Now see if there is more

        if (ip->next)
        {
            ip = ip->next;
        }
        else                    // if the region runs out before the end
        {
            if (++sp <= chunk + strlen(chunk))
            {
                return false;
            }

            break;
        }
    }

    return lines;
}
开发者ID:lpefferkorn,项目名称:core,代码行数:59,代码来源:item_lib.c


示例14: sizeof

void CFulEditCtrl::Colorize(const tstring& aLine, int begin) {
	CHARFORMAT2 cf;
	cf.cbSize = sizeof(CHARFORMAT2);
	
	ColorList *cList = HighlightManager::getInstance()->getList();

	int end = GetTextLengthEx(GTL_NUMCHARS);
	
	SetSel(begin, end);
	//otroligt fulhack, måste lagas riktigt nån gång
	SetSelectionCharFormat(selFormat);

	logged = false;

	//compare the last line against all strings in the vector
	for(ColorIter i = cList->begin(); i != cList->end(); ++i) {
		ColorSettings* cs = &(*i);
		int pos;
		
		//set start position for find
		if( cs->getIncludeNick() ) {
			pos = 0;
		} else {
			pos = aLine.find(_T(">"));
			if(pos == tstring::npos)
				pos = aLine.find(_T("**")) + nick.length();
		}

		//prepare the charformat
		cf.dwMask = CFM_BOLD | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_ITALIC;
		cf.dwEffects = 0;
		if(cs->getBold())		cf.dwEffects |= CFE_BOLD;
		if(cs->getItalic())		cf.dwEffects |= CFE_ITALIC;
		if(cs->getUnderline())	cf.dwEffects |= CFE_UNDERLINE;
		if(cs->getStrikeout())	cf.dwEffects |= CFE_STRIKEOUT;
		
		if(cs->getHasBgColor()){
			cf.dwMask |= CFM_BACKCOLOR;
			cf.crBackColor = cs->getBgColor();
		}
		if(cs->getHasFgColor()){
			cf.dwMask |= CFM_COLOR;
			cf.crTextColor = cs->getFgColor();
		}
		
		while( pos != string::npos ){
			if(cs->usingRegexp()) 
				pos = RegExpMatch(cs, cf, aLine, begin);
			else 
				pos = FullTextMatch(cs, cf, aLine, pos, begin);
		}

		matchedPopup = false;
		matchedSound = false;
		
	}//end for

}//end Colorize
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:58,代码来源:FulEditCtrl.cpp


示例15: SelectPathRegexMatch

static int SelectPathRegexMatch(char *filename, char *crit)
{
    if (FullTextMatch(crit, filename))
    {
        return true;
    }

    return false;
}
开发者ID:xrg,项目名称:cfengine-core,代码行数:9,代码来源:files_select.c


示例16: SelectNameRegexMatch

static int SelectNameRegexMatch(const char *filename, char *crit)
{
    if (FullTextMatch(crit, ReadLastNode(filename)))
    {
        return true;
    }

    return false;
}
开发者ID:xrg,项目名称:cfengine-core,代码行数:9,代码来源:files_select.c


示例17: CheckParseString

static int CheckParseString(char *lval, char *s, const char *range)
{
    char output[CF_BUFSIZE];

    CfDebug("\nCheckParseString(%s => %s/%s)\n", lval, s, range);

    if (s == NULL)
    {
        return true;
    }

    if (strlen(range) == 0)
    {
        return true;
    }

    if (IsNakedVar(s, '@') || IsNakedVar(s, '$'))
    {
        CfDebug("Validation: Unable to verify variable expansion of %s at this stage\n", s);
        return false;
    }

/* Deal with complex strings as special cases */

    if (strcmp(lval, "mode") == 0 || strcmp(lval, "search_mode") == 0)
    {
        mode_t plus, minus;

        if (!ParseModeString(s, &plus, &minus))
        {
            snprintf(output, CF_BUFSIZE, "Error parsing Unix permission string %s)", s);
            ReportError(output);
            return false;
        }
    }

    if (FullTextMatch(range, s))
    {
        return true;
    }

    if (IsCf3VarString(s))
    {
        CfDebug("Validation: Unable to verify syntax of %s due to variable expansion at this stage\n", s);
    }
    else
    {
        snprintf(output, CF_BUFSIZE,
                 "Scalar item in %s => { %s } in rvalue is out of bounds (value should match pattern %s)", lval, s,
                 range);
        ReportError(output);
        return false;
    }

    return true;
}
开发者ID:dnaeon,项目名称:core,代码行数:56,代码来源:syntax.c


示例18: CheckParseContext

SyntaxTypeMatch CheckParseContext(const char *context, const char *range)
{
    if (strlen(range) == 0)
    {
        return SYNTAX_TYPE_MATCH_OK;
    }

    if (FullTextMatch(range, context))
    {
        return SYNTAX_TYPE_MATCH_OK;
    }

    return SYNTAX_TYPE_MATCH_ERROR_CONTEXT_OUT_OF_RANGE;
}
开发者ID:jooooooon,项目名称:core,代码行数:14,代码来源:syntax.c


示例19: IgnoreInterface

static bool IgnoreInterface(char *name)
{
    Rlist *rp;

    for (rp = IGNORE_INTERFACES; rp != NULL; rp=rp->next)
    {
        if (FullTextMatch(rp->item,name))
        {
            CfOut(OUTPUT_LEVEL_VERBOSE, "", " -> Ignoring interface \"%s\" because it matches %s",name,CF_IGNORE_INTERFACES);
            return true;
        }    
    }

    return false;
}
开发者ID:FancsalMelinda,项目名称:core,代码行数:15,代码来源:unix.c


示例20: StringSetMatchCount

static size_t StringSetMatchCount(StringSet *set, const char *regex)
{
    size_t count = 0;
    StringSetIterator it = StringSetIteratorInit(set);
    const char *context = NULL;
    while ((context = SetIteratorNext(&it)))
    {
        // TODO: used FullTextMatch to avoid regressions, investigate whether StringMatch can be used
        if (FullTextMatch(regex, context))
        {
            count++;
        }
    }
    return count;
}
开发者ID:shaunamarie,项目名称:core,代码行数:15,代码来源:env_context.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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