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

C++ ParseValue函数代码示例

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

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



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

示例1: ParseLogicalExpression

AST* ParseLogicalExpression(ParserState* parser) {
	AST* valueNode = ParseValue(parser);
	AST* lexpNode = NULL;

	switch(parser->currentToken.type) {
		case TOKEN_LT:
			lexpNode = CreateASTNode(SEM_LT, VALUE_EMPTY);
			break;
		case TOKEN_EQ:
			lexpNode = CreateASTNode(SEM_EQ, VALUE_EMPTY);
			break;
		case TOKEN_GT:
			lexpNode = CreateASTNode(SEM_GT, VALUE_EMPTY);
			break;
		case TOKEN_LTE:
			lexpNode = CreateASTNode(SEM_LTE, VALUE_EMPTY);
			break;
		case TOKEN_GTE:
			lexpNode = CreateASTNode(SEM_GTE, VALUE_EMPTY);
			break;
		default:
			return valueNode;
	}

	Advance(parser);

	AST* rhs = ParseValue(parser);

	AddASTChild(lexpNode, valueNode);
	AddASTChild(lexpNode, rhs);

	return lexpNode;
}
开发者ID:feelout,项目名称:toyint,代码行数:33,代码来源:parser.c


示例2: NS_ENSURE_TRUE

nsresult
nsSVGTransformSMILAttr::ValueFromString(const nsAString& aStr,
                                     const nsISMILAnimationElement* aSrcElement,
                                     nsSMILValue& aValue,
                                     PRBool& aPreventCachingOfSandwich) const
{
  NS_ENSURE_TRUE(aSrcElement, NS_ERROR_FAILURE);
  NS_ASSERTION(aValue.IsNull(),
    "aValue should have been cleared before calling ValueFromString");

  const nsAttrValue* typeAttr = aSrcElement->GetAnimAttr(nsGkAtoms::type);
  const nsIAtom* transformType = nsGkAtoms::translate;
  if (typeAttr) {
    if (typeAttr->Type() != nsAttrValue::eAtom) {
      // Recognized values of |type| are parsed as an atom -- so if we have
      // something other than an atom, then it means our |type| was invalid.
      return NS_ERROR_FAILURE;
    }
    transformType = typeAttr->GetAtomValue();
  }

  ParseValue(aStr, transformType, aValue);
  aPreventCachingOfSandwich = PR_FALSE;
  return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:25,代码来源:nsSVGTransformSMILAttr.cpp


示例3: NS_ENSURE_TRUE

nsresult
nsSVGAnimatedTransformList::SMILAnimatedTransformList::ValueFromString(
  const nsAString& aStr,
  const dom::SVGAnimationElement* aSrcElement,
  nsSMILValue& aValue,
  bool& aPreventCachingOfSandwich) const
{
  NS_ENSURE_TRUE(aSrcElement, NS_ERROR_FAILURE);
  MOZ_ASSERT(aValue.IsNull(),
             "aValue should have been cleared before calling ValueFromString");

  const nsAttrValue* typeAttr = aSrcElement->GetAnimAttr(nsGkAtoms::type);
  const nsIAtom* transformType = nsGkAtoms::translate; // default val
  if (typeAttr) {
    if (typeAttr->Type() != nsAttrValue::eAtom) {
      // Recognized values of |type| are parsed as an atom -- so if we have
      // something other than an atom, then we know already our |type| is
      // invalid.
      return NS_ERROR_FAILURE;
    }
    transformType = typeAttr->GetAtomValue();
  }

  ParseValue(aStr, transformType, aValue);
  aPreventCachingOfSandwich = false;
  return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:27,代码来源:nsSVGAnimatedTransformList.cpp


示例4: ParseSection

/* IScanner */
static inline int ParseSection(struct IParse *parse, struct ISettings *settings)
{
	ParseComment(parse);
	ParseSkip(parse);

	int code = ParsePeek(parse, 0);
	if (!(code == '[')) {
		return 0;
	}

	ParseRead(parse); /* [ */
	ParseSkip(parse);

	/* Section Name */
	char name[MAX_NAME];
	if (!ParseName(parse, name, MAX_NAME)) {
		return 0;
	}

	ParseSkip(parse);
	code = ParsePeek(parse, 0);
	if (!(code == ']')) {
		return 0;
	}

	ParseRead(parse); /* "]" */

	HSECTION section = NULL;
	if (!(section = CreateSection(settings, name))) {
		return 0;
	}

	while (ParseValue(parse, section));
	return 1;
}
开发者ID:CarbonOS,项目名称:libsystem,代码行数:36,代码来源:read.c


示例5: SetCustomAttributes

/* helper. sets custom user attributes for user */
static void SetCustomAttributes(struct SystemManifest *policy)
{
  int i;
  int count;
  char *environment;
  char *buf[BIG_ENOUGH_SPACE], **tokens = buf;

  assert(policy != NULL);
  assert(policy->envp == NULL);

  /* get environment */
  environment = GetValueByKey(MFT_ENVIRONMENT);
  if(environment == NULL) return;

  /* parse and check count of attributes */
  count = ParseValue(environment, ", \t", tokens, BIG_ENOUGH_SPACE);
  ZLOGFAIL(count % 2 != 0, EFAULT, "odd number of user environment variables");
  ZLOGFAIL(count == 0, EFAULT, "invalid user environment");
  ZLOGFAIL(count == BIG_ENOUGH_SPACE, EFAULT, "user environment exceeded the limit");

  /* allocate space to hold string pointers */
  count >>= 1;
  policy->envp = g_malloc0((count + 1) * sizeof(*policy->envp));

  /* construct array of environment variables */
  for(i = 0; i < count; ++i)
  {
    char *key = *tokens++;
    char *value = *tokens++;
    int length = strlen(key) + strlen(value) + 1 + 1; /* + '=' + '\0' */

    policy->envp[i] = g_malloc0((length + 1) * sizeof(*policy->envp[0]));
    sprintf(policy->envp[i], "%s=%s", key, value);
  }
}
开发者ID:clatour,项目名称:zerovm,代码行数:36,代码来源:manifest_setup.c


示例6: SetNodeName

/* sets node_id in nap object and user argv[0] */
static void SetNodeName(struct NaClApp *nap)
{
  int i;
  char *buf[BIG_ENOUGH_SPACE], **tokens = buf;
  char *pgm_name = GetValueByKey(MFT_NODE);

  assert(nap != NULL);
  assert(nap->system_manifest != NULL);
  assert(nap->system_manifest->cmd_line != NULL);
  assert(nap->system_manifest->cmd_line_size > 0);

  /* set the node name (0st parameter) and node id (n/a for the user) */
  if(pgm_name == NULL)
  {
    nap->system_manifest->cmd_line[0] = NEXE_PGM_NAME;
    nap->system_manifest->node_id = 0;
  }
  else
  {
    i = ParseValue(pgm_name, ",", tokens, BIG_ENOUGH_SPACE);
    ZLOGFAIL(i != 2, EFAULT, "invalid NodeName specified");
    ZLOGFAIL(tokens[0] == NULL, EFAULT, "invalid node name");
    ZLOGFAIL(tokens[1] == NULL, EFAULT, "invalid node id");
    nap->system_manifest->cmd_line[0] = tokens[0];
    nap->system_manifest->node_id = ATOI(tokens[1]);
    ZLOGFAIL(nap->system_manifest->node_id == 0, EFAULT, "node id must be > 0");
  }

  /* put node name and id to the log */
  ZLOGS(LOG_DEBUG, "node name = %s, node id = %d",
      nap->system_manifest->cmd_line[0], nap->system_manifest->node_id);
}
开发者ID:clatour,项目名称:zerovm,代码行数:33,代码来源:manifest_setup.c


示例7: SkipSpaces

bool json::Reader::ParseArray(ConfigValue& value)
{
	value.SetEmptyArray();
	
	_cur++; // Skip '['
	SkipSpaces();
	if(*_cur == ']')
	{
		_cur++;
		return true;
	}
	while(1)
	{
		ConfigValue& elem = value.Append();
		
		if(!ParseValue(elem))
			return false;
		
		SkipSpaces();

		char c = *_cur;
		if(c == ',') // Separator between elements (Optional)
		{
			_cur++;
			continue;
		}
		if(c == ']') // End of array
		{
			_cur++;
			break;
		}
	}
	return true;
}
开发者ID:simeks,项目名称:m7017e-lab,代码行数:34,代码来源:json.cpp


示例8: SetCommandLine

/* helper. sets command line parameters for the user */
static void SetCommandLine(struct SystemManifest *policy)
{
  int i;
  char *parameters;
  char *buf[BIG_ENOUGH_SPACE], **tokens = buf;

  assert(policy != NULL);
  assert(policy->cmd_line == NULL);
  assert(policy->cmd_line_size == 0);

  /* get parameters */
  parameters = GetValueByKey(MFT_COMMANDLINE);

  /* if there is command line parse and check count of parameters */
  if(parameters != NULL)
  {
    policy->cmd_line_size = ParseValue(parameters, " \t", tokens, BIG_ENOUGH_SPACE);
    ZLOGFAIL(policy->cmd_line_size == 0, EFAULT, "invalid user parameters");
    ZLOGFAIL(policy->cmd_line_size == BIG_ENOUGH_SPACE, EFAULT, "too long user command line");
  }

  /*
   * allocate space to hold string pointers. 0st element reserved for argv[0].
   * also, the last element should be NULL so 1 extra element must be reserved
   */
  ++policy->cmd_line_size;
  policy->cmd_line = g_malloc0((policy->cmd_line_size + 1) * sizeof *policy->cmd_line);

  /* populate command line arguments array with pointers */
  for(i = 0; i < policy->cmd_line_size - 1; ++i)
    policy->cmd_line[i + 1] = tokens[i];
}
开发者ID:clatour,项目名称:zerovm,代码行数:33,代码来源:manifest_setup.c


示例9: statement

// ["?"]Keyword [["^"]Option["/"Translation]] 
// [":" 
//   ["^"]Value ["/" Translation].
// ]
Statement* Parser::ParseStatement()
{
	AutoDelete<Statement> statement(new Statement());
	
	if (!ParseKeyword(statement.Get())) {
		return NULL;
	}
	SkipWhitespaceSeparator();
	
	if (!ParseOption(statement.Get())) {
		return NULL;
	}
	
	SkipWhitespaceSeparator();
	// [":" ... ]
	if (GetCurrentChar() == ':') {
		NextChar();
		SkipWhitespaceSeparator();
		if (!ParseValue(statement.Get())) {
			return NULL;
		}
	}
	SkipWhitespaceSeparator();
	if (GetCurrentChar() == kEof || GetCurrentChar() == kLf || GetCurrentChar() == kCr) {
		UpdateStatementType(statement.Get());
		Statement* result = statement.Release();	
		return result;
	} else {
		Error("Newline expected at end of statement");
		return NULL;
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:36,代码来源:Parser.cpp


示例10: SkipWS

static const char *ParseObject(ParseArgs& args, const char *data)
{
    data = SkipWS(data + 1);
    if ('}' == *data)
        return data + 1;

    size_t pathIdx = args.path.Size();
    for (;;) {
        data = SkipWS(data);
        if ('"' != *data)
            return NULL;
        args.path.Append('/');
        data = ExtractString(args.path, data);
        if (!data)
            return NULL;
        data = SkipWS(data);
        if (':' != *data)
            return NULL;

        data = ParseValue(args, data + 1);
        if (args.canceled || !data)
            return data;
        args.path.RemoveAt(pathIdx, args.path.Size() - pathIdx);

        data = SkipWS(data);
        if ('}' == *data)
            return data + 1;
        if (',' != *data)
            return NULL;
        data++;
    }
}
开发者ID:BianChengNan,项目名称:sumatrapdf,代码行数:32,代码来源:JsonParser.cpp


示例11: result

CJsonNode CNetScheduleStructuredOutputParser::ParseObject(char closing_char)
{
    CJsonNode result(CJsonNode::NewObjectNode());

    while (isspace((unsigned char) *m_Ch))
        ++m_Ch;

    if (*m_Ch == closing_char) {
        ++m_Ch;
        return result;
    }

    while (*m_Ch == '\'' || *m_Ch == '"') {
        // New attribute/value pair
        string attr_name(ParseString(GetRemainder()));

        while (isspace((unsigned char) *m_Ch))
            ++m_Ch;
        if (*m_Ch == ':' || *m_Ch == '=')
            while (isspace((unsigned char) *++m_Ch))
                ;

        result.SetByKey(attr_name, ParseValue());

        if (!MoreNodes()) {
            if (*m_Ch != closing_char)
                break;
            ++m_Ch;
            return result;
        }
    }

    INVALID_FORMAT_ERROR();
}
开发者ID:swuecho,项目名称:igblast,代码行数:34,代码来源:ns_output_parser.cpp


示例12: if

_JATTA_EXPORT Jatta::JSON::Value Jatta::JSON::Parse(Jatta::String str)
{
    //Remove the unnecessary whitespacing.
    String newStr;
    bool insideString = false;
    for (UInt32 i = 0; i < str.GetLength(); i++)
    {
        if (insideString)
        {
            if (str[i] == Grammar::Structural::STRING_DELIMITOR)
            {
                newStr += str[i];
                insideString = false;
            }
            else
            {
                newStr += str[i];
            }
        }
        else if (str[i] == Grammar::Structural::STRING_DELIMITOR)
        {
            newStr += str[i];
            insideString = true;
        }
        else if (str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && str[i] != '\r')
        {
            newStr += str[i];
        }
    }

    //Parse!
    return ParseValue(newStr);
}
开发者ID:JoshuaBrookover,项目名称:Jatta,代码行数:33,代码来源:JSON.cpp


示例13: ParseValue

	void SPropertyItemColor::SetStringOnly( const SStringT & strValue )
	{

		COLORREF crTmp;
		crTmp = CR_INVALID;
		ParseValue(strValue,crTmp);
		m_crValue = crTmp;
	}
开发者ID:ming-hai,项目名称:soui,代码行数:8,代码来源:SPropertyItem-Color.cpp


示例14: ParseArray

SEXP ParseArray(yajl_val node, int bigint){
  int len = YAJL_GET_ARRAY(node)->len;
  SEXP vec = PROTECT(allocVector(VECSXP, len));
  for (int i = 0; i < len; ++i) {
    SET_VECTOR_ELT(vec, i, ParseValue(YAJL_GET_ARRAY(node)->values[i], bigint));
  }
  UNPROTECT(1);
  return vec;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:9,代码来源:parse.c


示例15: while

bool LinkPartition::ParseAttributes( LinkTokenizer &spec)
{
    /* optional */
    if (spec.Matches(LinkTokenizer::eBracketOpen))
    {
        bool done = false;
        spec.NextToken();
        while (!done)
        {
            switch(spec.GetTokenType())
            {
                LinkExpression *value;
                case LinkTokenizer::eAddr:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetAddress(value);
                    break;
                case LinkTokenizer::eSize:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetSize(value);
                    break;
                case LinkTokenizer::eMaxSize:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetMaxSize(value);
                    break;
                case LinkTokenizer::eRoundSize:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetRoundSize(value);
                    break;
                case LinkTokenizer::eFill:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetFill(value);
                    break;
                case LinkTokenizer::eAlign:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetAlign(value);
                    break;
                case LinkTokenizer::eVirtual:
                    if (!ParseValue(spec, &value))
                        return false;
                    attribs.SetVirtualOffset(value);
                    break;
                default:
                    return false;
            }
            if (spec.GetTokenType() != LinkTokenizer::eComma)
                done = true;
            else
                spec.NextToken();
        }
        return spec.MustMatch(LinkTokenizer:: eBracketClose);
    }
    return true;
}
开发者ID:NoSuchProcess,项目名称:OrangeC,代码行数:59,代码来源:LinkPartition.cpp


示例16: log_trace

void JsonReader::ParseStream()
{
    log_trace();
    SkipWhiteSpace();

    if (!is_.Eof())
    {
        ParseValue();
    }
}
开发者ID:guija,项目名称:anyrpc,代码行数:10,代码来源:jsonreader.cpp


示例17: Parse

bool Parse(const char *data, ValueVisitor *visitor)
{
    ParseArgs args(visitor);
    if (str::StartsWith(data, UTF8_BOM))
        data += 3;
    const char *end = ParseValue(args, data);
    if (!end)
        return false;
    return args.canceled || !*SkipWS(end);
}
开发者ID:BianChengNan,项目名称:sumatrapdf,代码行数:10,代码来源:JsonParser.cpp


示例18: ParseObject

SEXP ParseObject(yajl_val node, int bigint){
  int len = YAJL_GET_OBJECT(node)->len;
  SEXP keys = PROTECT(allocVector(STRSXP, len));
  SEXP vec = PROTECT(allocVector(VECSXP, len));
  for (int i = 0; i < len; ++i) {
    SET_STRING_ELT(keys, i, mkCharCE(YAJL_GET_OBJECT(node)->keys[i], CE_UTF8));
    SET_VECTOR_ELT(vec, i, ParseValue(YAJL_GET_OBJECT(node)->values[i], bigint));
  }
  setAttrib(vec, R_NamesSymbol, keys);
  UNPROTECT(2);
  return vec;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:12,代码来源:parse.c


示例19:

DateTime::DateTime(const std::string& value, const std::string& pattern)	
	:
	m_year				(ParseValue(value, pattern, "%YYYY")),
	m_month				(ParseValue(value, pattern, "%MM")),
	m_day					(ParseValue(value, pattern, "%DD")),
	m_hour				(ParseValue(value, pattern, "%hh")),
	m_minute			(ParseValue(value, pattern, "%mm")),
	m_second			(ParseValue(value, pattern, "%ss")),
	m_millisecond	(ParseValue(value, pattern, "%ms"))
{
}
开发者ID:Alsan,项目名称:ONLYOFFICE-OnlineEditors,代码行数:11,代码来源:DateTime.cpp


示例20: ParseArgumentList

AST* ParseArgumentList(ParserState* parser) {
	AST* arglist = CreateASTNode(SEM_EMPTY, VALUE_EMPTY);	

	/* FIXME: At this time, ArgumentList is used both for calling
	 * and defining functions, which is wrong as it allows using
	 * constants as formal arguments of a function */
	while(parser->currentToken.type != TOKEN_RIGHTBRACKET) {
		AST* argument = ParseValue(parser);
		AddASTChild(arglist, argument);
		if(parser->currentToken.type != TOKEN_RIGHTBRACKET)
			Match(parser, TOKEN_COMMA);
	}

	return arglist;
}
开发者ID:feelout,项目名称:toyint,代码行数:15,代码来源:parser.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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