Exemplo n.º 1
0
	void ReadWriteXMLList::WriteValue(XMLWritingMachine& writer, const TreeValue* value) const
	{ 
		const TreeList* listobject = static_cast<const TreeList*>( value );
		const std::vector<TreeValue*>& value_list = listobject->ElementArray();
		for (std::vector<TreeValue*>::const_iterator value_iter( value_list.begin() ); value_iter != value_list.end(); value_iter++)
		{
			writer.WriteValue(listobject->ElementName(), *value_iter);
		}
	}
static popup_t::menu_item_set_t array_to_menu_item_set(const array_t& value)
{
    popup_t::menu_item_set_t set;

    for (array_t::const_iterator iter(value.begin()), last(value.end());
         iter != last; ++iter)
    {
        if (iter->type_info() != typeid(dictionary_t))
            continue;

        const dictionary_t&          cur_new_item(iter->cast<dictionary_t>());
        dictionary_t::const_iterator name_iter(cur_new_item.find(key_name));
        dictionary_t::const_iterator value_iter(cur_new_item.find(key_value));

        if (name_iter == cur_new_item.end() ||
            name_iter->second.type_info() != typeid(std::string) ||
            value_iter == cur_new_item.end())
            continue;

        set.push_back(popup_t::menu_item_t(name_iter->second.cast<std::string>(), value_iter->second));
    }

    return set;
}