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


C++ ParseValue函数代码示例

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


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


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