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


C++ JSONElement::getChildren方法代码示例

本文整理汇总了C++中JSONElement::getChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ JSONElement::getChildren方法的具体用法?C++ JSONElement::getChildren怎么用?C++ JSONElement::getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSONElement的用法示例。


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

示例1: isValidObjectProperty

bool JSONSerialize::isValidObjectProperty(void* _1, string propname, int counter)
{
	JSONElement* node = (JSONElement*)_1;
	if((int)node->getChildren().size()>counter && node->getChildren().at(counter)->getName()==propname)
		return true;
	return false;
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:7,代码来源:JSONSerialize.cpp

示例2: getContainerElement

void* JSONSerialize::getContainerElement(void* _1, int counter, int counter1)
{
	JSONElement* root = (JSONElement*)_1;
	if((int)root->getChildren().size()<counter)
		return NULL;
	JSONElement* ele = root->getChildren().at(counter);
	return ele;
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:8,代码来源:JSONSerialize.cpp

示例3: elementToSerializedString

string JSONSerialize::elementToSerializedString(void* _1, int counter)
{
	JSONElement* root = (JSONElement*)_1;
	if((int)root->getChildren().size()<counter)
		return NULL;
	JSONElement* ele = root->getChildren().at(counter);
	return ele->toString();
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:8,代码来源:JSONSerialize.cpp

示例4: isValidClassNamespace

bool JSONSerialize::isValidClassNamespace(void* _1, string classname, string namespc, bool iscontainer)
{
	JSONElement* node = (JSONElement*)_1;
	if(iscontainer && node->getChildren().size()==0)
		return false;
	return true;
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:7,代码来源:JSONSerialize.cpp

示例5: getDocumentStr

string JSONUtil::getDocumentStr(const JSONElement& doc)
{
	string jsonText;
	if(doc.getType()==JSONElement::JSON_OBJECT)
		jsonText += "{";
	else
		jsonText += "[";
	if(doc.hasChildren())
	{
		for (int var = 0; var < (int)doc.getChildren().size(); ++var) {
			JSONElement* child = doc.getChildren().at(var);
			if(doc.getType()==JSONElement::JSON_OBJECT)
				jsonText += "\"" + child->getName() + "\":";
			if(child->getType()==JSONElement::JSON_OBJECT || child->getType()==JSONElement::JSON_ARRAY)
			{
				jsonText += getDocumentStr(*child);
			}
			else
			{
				if(child->getType()==JSONElement::JSON_STRING)
					jsonText += "\"" + child->getValue() + "\"";
				else
					jsonText += child->getValue();
			}
			if(var!=(int)doc.getChildren().size()-1)
			{
				jsonText += ", ";
			}
		}
	}
	if(doc.getType()==JSONElement::JSON_OBJECT)
		jsonText += "}";
	else
		jsonText += "]";
	return jsonText;
}
开发者ID:GYGit,项目名称:ffead-cpp,代码行数:36,代码来源:JSONUtil.cpp

示例6: getObjectProperty

void* JSONSerialize::getObjectProperty(void* _1, int counter)
{
	JSONElement* elel = (JSONElement*)_1;
	return elel->getChildren().at(counter);
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:5,代码来源:JSONSerialize.cpp

示例7: getContainerSize

int JSONSerialize::getContainerSize(void* _1)
{
	JSONElement* root = (JSONElement*)_1;
	return root->getChildren().size();
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:5,代码来源:JSONSerialize.cpp

示例8: addPrimitiveElementToContainer

void JSONSerialize::addPrimitiveElementToContainer(void* _1, int counter, string className, void* cont, string container)
{
	JSONElement* root = (JSONElement*)_1;
	JSONElement ele = *(root->getChildren().at(counter));
	if(className=="std::string" || className=="string")
	{
		string retVal = ele.getValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="int")
	{
		int retVal = CastUtil::lexical_cast<int>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="short")
	{
		short retVal = CastUtil::lexical_cast<short>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="long")
	{
		long retVal = CastUtil::lexical_cast<long>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="long long")
	{
		long long retVal = CastUtil::lexical_cast<long long>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="long double")
	{
		long double retVal = CastUtil::lexical_cast<long double>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned int")
	{
		unsigned int retVal = CastUtil::lexical_cast<unsigned int>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned short")
	{
		unsigned short retVal = CastUtil::lexical_cast<unsigned short>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned long")
	{
		unsigned long retVal = CastUtil::lexical_cast<unsigned long>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned long long")
	{
		unsigned long long retVal = CastUtil::lexical_cast<unsigned long long>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="float")
	{
		float retVal = CastUtil::lexical_cast<float>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="double")
	{
		double retVal = CastUtil::lexical_cast<double>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="bool")
	{
		bool retVal = CastUtil::lexical_cast<bool>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="char")
	{
		char retVal = CastUtil::lexical_cast<char>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned char")
	{
		unsigned char retVal = CastUtil::lexical_cast<unsigned char>(ele.getValue());
		addValueToNestedContainer(container, retVal, cont);
	}
}
开发者ID:clawplach,项目名称:ffead-cpp,代码行数:80,代码来源:JSONSerialize.cpp


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