示例#1
0
bool GdaJson::hasName(const json_spirit::Object& obj, const wxString& name)
{
	std::string std_name(name.ToStdString());
	for (json_spirit::Object::const_iterator i=obj.begin(); i!=obj.end(); ++i)
	{
		if (i->name_ == std_name) return true;
	}
	return false;
}
示例#2
0
bool ExtractField(json_spirit::Object &obj, const std::string field, json_spirit::Value &v)
{
    for (std::vector<json_spirit::Pair>::iterator i = obj.begin(); i != obj.end(); ++i)
    {
        if (i->name_ == field)
        {
            v = i->value_;
            obj.erase(i);
            return true;
        }
    }
    return false;
}
示例#3
0
bool GdaJson::findValue(const json_spirit::Object& input,
						json_spirit::Value& output,
						const wxString& name)
{
	std::string std_name(name.ToStdString());
	const json_spirit::Object o=input;
	for (json_spirit::Object::const_iterator i=o.begin(); i!=o.end(); ++i)
	{
		if (i->name_ == std_name) {
			output = i->value_;
			return true;
		}
	}
	return false;
}
示例#4
0
wxString GdaJson::getStrValFromObj(const json_spirit::Object& obj,
								   const wxString& name)
{
	std::string std_name(name.ToStdString());
	for (json_spirit::Object::const_iterator i=obj.begin(); i!=obj.end(); ++i)
	{
		if (i->name_ == std_name) {
			if (i->value_.type() == json_spirit::str_type) {
				return wxString(i->value_.get_str());
			}
			return "";
		}
	}
	return "";
}
    void refreshTurboAddressTable()
    {
        cachedTurboAddressTable.clear();

        int rank = 0;
        for (json_spirit::Object::iterator it = allTurbos.begin(); it != allTurbos.end(); ++it)
        {
            ++rank;
            cachedTurboAddressTable.append(TurboAddressTableEntry(rank, QString::fromStdString(it->name_),
                                                                it->value_.get_int()));
        }

        // qLowerBound() and qUpperBound() require
        // our cachedTurboAddressTable list to be sorted in asc order
        qSort(cachedTurboAddressTable.begin(), cachedTurboAddressTable.end(),
                                              TurboAddressTableEntryLessThan());
    }