示例#1
0
		void ExtractFileName(String::List& p, const bool systemDependant)
		{
			for(String::List::iterator i = p.begin() ; i != p.end() ; ++i)
			{
				String out;
				Yuni::Core::IO::ExtractFileName(out, *i, systemDependant);
				*i = out;
			}
		}
示例#2
0
	void List::findFromPrefixes(const String::List& prefix)
	{
		if (not prefix.empty())
		{
			const String::List::const_iterator end = prefix.end();
			for (String::List::const_iterator i = prefix.begin(); i != end; ++i)
				loadFromPath(*i);
		}
	}
示例#3
0
 bool GlobDirs(String::List& out, const String& pattern, const bool emptyListBefore)
 {
     if (emptyListBefore)
         out.clear();
     gResourcesMutex.lock();
     for (ResourcesFoldersList::const_iterator i = pResourcesFolders.begin(); i != pResourcesFolders.end(); ++i)
         Paths::GlobDirs(out, *i + pattern, false);
     gResourcesMutex.unlock();
     return !out.empty();
 }
示例#4
0
			BOOTIL_EXPORT bool Floats( const BString & str, float* f, int iCount )
			{
				String::List lst;
				String::Util::Split( str, " ", lst );

				if ( lst.size() != iCount ) { return false; }

				for ( int i = 0; i < iCount; i++ )
				{
					f[i] = String::To::Float( lst[i] );
				}

				return true;
			}
示例#5
0
	void LibConfigProgram::computeDependencies(LibConfig::VersionInfo::Settings& version)
	{
		String::List deps;
		do
		{
			deps.clear();
			{
				const String::List::const_iterator end = pOptModules.end();
				for (String::List::const_iterator i = pOptModules.begin(); i != end; ++i)
				{
					const String::List& modDeps = version.moduleSettings[*i].dependencies;
					const String::List::const_iterator endJ = modDeps.end();
					for (String::List::const_iterator j = modDeps.begin(); j != endJ; ++j)
					{
						if (pOptModules.end() == std::find(pOptModules.begin(), pOptModules.end(), *j))
							deps.push_back(*j);
					}
				}
			}
			if (not deps.empty())
			{
				// Merge results
				const String::List::const_iterator end = deps.end();
				for (String::List::const_iterator i = deps.begin(); i != end; ++i)
				{
					if (pOptModules.end() == std::find(pOptModules.begin(), pOptModules.end(), *i))
						pOptModules.push_back(*i);
				}
			}
		}
		while (not deps.empty());
	}
示例#6
0
文件: File.cpp 项目: AlVar009/bootil
		BOOTIL_EXPORT int GetFilesInFolder( const BString & strFolder, String::List & OutputFiles, bool Recursive )
		{
			String::List files;
			String::List folders;
			File::Find( &files, &folders, strFolder + "/*", false );
			BOOTIL_FOREACH_CONST( f, files, String::List )
			{
				OutputFiles.push_back( *f );
			}
示例#7
0
			BOOTIL_EXPORT void Split( const BString& str, const BString& seperator, String::List& outbits )
			{
				BString strBit;
				int iOffset = 0;
				int iLength = str.length();
				int iSepLen = seperator.length();

				int i = str.find( seperator, 0 );
				while ( i != std::string::npos )
				{
					outbits.push_back( str.substr( iOffset, i-iOffset ) );
					iOffset = i + iSepLen;

					i = str.find( seperator, iOffset );
				}

				outbits.push_back( str.substr( iOffset, iLength-iOffset ) );
			}
示例#8
0
	bool Settings::configFile(String::List& options, bool displayError) const
	{
		if (compiler.empty())
		{
			if (displayError)
				std::cout << "Error: unknown compiler\n";
			return false;
		}
		String out;
		out << this->path << SEP;
		switch (mapping)
		{
			case mappingSVNSources:
				out << "src" << SEP << "yuni" << SEP;
				break;
			case mappingStandard:
				// Nothing to do
				break;
		}
		out << "yuni.config." << this->compiler;

		if (not IO::File::Exists(out))
		{
			if (displayError)
				std::cout << "Error: impossible to open the config file '" << out << "'\n";
			return false;
		}

		options.clear();
		IO::File::Stream file;
		if (file.open(out))
		{
			CString<8192> buffer;
			while (file.readline(buffer))
				options.push_back(buffer);
		}
		else
		{
			if (displayError)
				std::cout << "Error: Impossible to read '" << out << "'\n";
			return false;
		}
		return true;
	}
示例#9
0
    void diagonal2(const String::List<Index> &alpha, const String &beta,
                   const mpqc::Matrix &V, mpqc::Vector &d) {
        //MPQC_PROFILE_LINE;
	const auto &b = beta.occ();
        BOOST_FOREACH (auto j, b) {
            size_t jj = index(j,j);
            auto const &Vj = V.col(jj);
            for (int k = 0; k < alpha.size(); ++k) {
                double q = 0;
                const auto &a = alpha[k].occ();
                BOOST_FOREACH (auto i, a) {
                    size_t ii = index(i,i);
                    q += Vj(i);
                }
                d(k) += q;
            }
示例#10
0
	bool Settings::parserModulesOptions(String::List& options, bool displayError)
	{
		// Cleanup if needed
		moduleSettings.clear();
		// End of the list
		const String::List::const_iterator end = options.end();
		// Key
		String key;
		// Value
		String value;
		// Module name
		String modName;
		// Group
		String group;
		// normalized path
		String norm;

		// The default compiler is gcc
		CompilerCompliant compliant = gcc;
		// Checking for Visual Studio
		if (not compiler.empty() && compiler.at(0) == 'v' && compiler.at(1) == 's')
			compliant = visualstudio;

		// For each entry in the ini file
		for (String::List::const_iterator i = options.begin(); i != end; ++i)
		{
			i->extractKeyValue(key, value);
			if (key.empty() || key.first() == '[')
				continue;
			value.trim();
			if (!value)
				continue;

			// Reset
			modName.clear();
			group.clear();

			// Splitting
			const String::Size p = key.find(':');
			if (p == String::npos)
				continue;
			group.assign(key, p);
			modName.assign(key, key.size() - p - 1, p + 1);
			if (not group or not modName)
				continue;

			SettingsPerModule& s = moduleSettings[modName];

			if (group == "path.include")
			{
				IO::Normalize(norm, value);
				switch (compliant)
				{
					case gcc          :
						s.includes[String() << "-I" << QuotePath(norm)] = true;
						break;

					case visualstudio :
						s.includes[String() << "/I" << QuotePath(norm)] = true;
						break;
				}
				continue;
			}

			if (group == "lib,rawcommand")
			{
				s.libs[value] = true;
				continue;
			}

			if (group == "path.lib")
			{
				IO::Normalize(norm, value);
				switch (compliant)
				{
					case gcc          :
						s.libIncludes[String() << "-L" << QuotePath(norm)] = true;
						break;
					case visualstudio :
						s.libIncludes[String() << "/LIBPATH:" << QuotePath(norm)] = true;
						break;
				}
				continue;
			}

			if (group == "lib")
			{
				IO::Normalize(norm, value);
				# ifdef YUNI_OS_MAC
				// it may happen that cmake provides a framework for linking, which is wrong obvioulsy
				CString<32,false> ext;
				IO::ExtractExtension(ext, norm);
				ext.toLower();
				if (ext != ".framework")
					s.libs[String() << "-l" << QuotePath(norm)] = true;
				else
				{
					// adding the parent directory
					String frameworkpath;
					norm += "/../";
					IO::Normalize(frameworkpath, norm);
					s.libIncludes[String() << "-F" << QuotePath(frameworkpath)] = true;
				}
				# else
				switch (compliant)
				{
					case gcc          : s.libs[String() << "-l" << QuotePath(norm)] = true; break;
					case visualstudio : s.libs[String() << QuotePath(norm)] = true; break;
				}
				# endif
				continue;
			}

			if (group == "cxxflag")
			{
				s.cxxFlags[value] = true;
				continue;
			}

			if (group == "define")
			{
				switch (compliant)
				{
					case gcc          : s.defines[String() << "-D" << value] = true; break;
					case visualstudio : s.defines[String() << "/D" << value] = true; break;
				}
				continue;
			}
			if (group == "dependency")
			{
				s.dependencies.push_back(value);
				continue;
			}

			if (group == "framework")
			{
				s.frameworks[String() << "-framework " << QuotePath(value)] = true;
				continue;
			}

			if (displayError)
				std::cout << "Error: unknown key in the config file: '" << key << "'\n";
			return false;
		}
		return true;
	}