Ejemplo n.º 1
0
	const VectorString& OgreDataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
	{
		static VectorString result;
		result.clear();

		Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, _pattern);

		result.reserve(pFileInfo->size());

		for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
		{
			if (fi->path.empty())
			{
				bool found = false;
				for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
				{
					if (*iter == fi->filename)
					{
						found = true;
						break;
					}
				}
				if (!found)
				{
					result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
				}

			}
		}

		pFileInfo.setNull();

		return result;
	}
Ejemplo n.º 2
0
CDB::stringSeq* DAOProxy::get_string_seq (const char * propertyName)
{
    //ACS_TRACE("cdb::DAOProxy::get_string_seq");

    // check remote mode
    if (m_dao.ptr() != CDB::DAO::_nil()) 
	return m_dao->get_string_seq(propertyName);

    string value;
    try{
    get_field(propertyName, value);
    }catch(cdbErrType::CDBFieldDoesNotExistExImpl ex){
	throw ex.getCDBFieldDoesNotExistEx();
    }

    VectorString array;
    split(value.c_str(), array);

    CDB::stringSeq_var seq = new CDB::stringSeq();
    seq->length(array.size());

    CORBA::ULong i = 0;
    for (VectorString::const_iterator iter = array.begin();
	 iter != array.end(); iter++)
	{
	seq[i++] = CORBA::string_dup(iter->c_str());
	}

    return seq._retn();
}
Ejemplo n.º 3
0
	const VectorString& Ogre2DataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
	{
		static VectorString result;
		result.clear();

		VectorString search;
		if (mAllGroups)
		{
			Ogre::StringVector sp = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
			search.reserve(sp.size());
			for (size_t i = 0; i < sp.size(); i++)
				search.push_back(sp[i]);
		}
		else
			search.push_back(mGroup);

		std::vector<Ogre::FileInfoListPtr> pFileInfos;

		int resultSize = 0;
		for (size_t i = 0; i < search.size(); i++)
		{
			Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(search[i], _pattern);
			resultSize += pFileInfo->size();
			if (!pFileInfo->empty())
				pFileInfos.push_back(pFileInfo);
			else
				pFileInfo.setNull();
		}

		result.reserve(resultSize);

		for (size_t i = 0; i < pFileInfos.size(); i++)
		{
			Ogre::FileInfoListPtr pFileInfo = pFileInfos[i];
			for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
			{
				if (fi->path.empty())
				{
					bool found = false;
					for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
					{
						if (*iter == fi->filename)
						{
							found = true;
							break;
						}
					}
					if (!found)
					{
						result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
					}
				}
			}

			pFileInfo.setNull();
		}

		return result;
	}
	void LanguageManager::loadLanguage(const VectorString & _list, const std::string & _group)
	{
		mMapLanguage.clear();

		for (VectorString::const_iterator iter=_list.begin(); iter!=_list.end(); ++iter) {
			loadLanguage(*iter, _group);
		}
	}
Ejemplo n.º 5
0
	void SettingsManager::setValueList(const std::string& _path, const VectorString& _values)
	{
		if (!MyGUI::utility::endWith(_path, ".List"))
			return;

		std::string itemName = "Value";

		pugi::xml_node targetNode;

		pugi::xpath_node node = mUserDocument->document_element().select_single_node(_path.c_str());
		if (!node.node().empty())
		{
			targetNode = node.node();
			while (!targetNode.first_child().empty())
				targetNode.remove_child(targetNode.first_child());
		}
		else
		{
			std::vector<std::string> names;
			std::string delims("/");
			names = MyGUI::utility::split(_path, delims);

			pugi::xml_node currentNode = mUserDocument->document_element();
			for (std::vector<std::string>::const_iterator name = names.begin(); name != names.end(); name ++)
			{
				pugi::xml_node childNode = currentNode.child((*name).c_str());
				if (childNode.empty())
					childNode = currentNode.append_child((*name).c_str());

				currentNode = childNode;
			}

			targetNode = currentNode;
		}

		for (VectorString::const_iterator value = _values.begin(); value != _values.end(); value ++)
			targetNode.append_child(itemName.c_str()).text().set((*value).c_str());

		eventSettingsChanged(_path);
	}
Ejemplo n.º 6
0
CDB::longSeq * DAOProxy::get_long_seq (const char * propertyName)
{
    //ACS_TRACE("cdb::DAOProxy::get_long_seq");

    // check remote mode
    if (m_dao.ptr() != CDB::DAO::_nil()) 
	return m_dao->get_long_seq(propertyName);

    string value;
    try{
    get_field(propertyName, value);
    }catch(cdbErrType::CDBFieldDoesNotExistExImpl ex){
	throw ex.getCDBFieldDoesNotExistEx();
    }

    VectorString array;
    split(value.c_str(), array);

    CDB::longSeq_var seq = new CDB::longSeq();
    seq->length(array.size());

    CORBA::ULong i = 0;
    for (VectorString::const_iterator iter = array.begin();
	 iter != array.end(); iter++)
	{
	std::istringstream is(iter->c_str());
	CORBA::Long val;
	(istream&) is >> val;
	if (!is)
		throw cdbErrType::WrongCDBDataTypeExImpl(
		__FILE__, __LINE__,
		"cdb::DAOProxy::get_long" ).getWrongCDBDataTypeEx();
	//    throw CDB::WrongDataType();
	seq[i++] = val;
	}

    return seq._retn();
}