コード例 #1
0
	void CompoundWriter::buildNamespace()
	{
		if (pCompound->name.find_first_of("<@") != String::npos)
			return;

		String filename;
		filename << Options::target << SEP << pCompound->htdocs;
		if (!IO::Directory::Create(filename))
			return;
		filename << SEP << "article.xml";

		IO::File::Stream file;
		if (file.openRW(filename))
		{
			// Getting the name
			const String& name = pCompound->name;

			file << "<title>";
			String::Size offset = name.find_last_of(":\\/");
			if (offset < name.size() && offset + 1 < name.size())
				file.write(name.c_str() + offset + 1, name.size() - (offset + 1));
			else
				file << name;
			file << "</title>\n";
			file << "<pragma:weight value=\"0.40\" />\n";
			file << "<tag name=\"doxygen\" />\n";
			file << "<tag name=\"dox:namespace\" />\n";
			file << "\n\n";
		}
	}
コード例 #2
0
ファイル: versions.cpp プロジェクト: MAPJe71/libyuni
	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;
	}
コード例 #3
0
ファイル: md5.cpp プロジェクト: libyuni/libyuni
	const String& MD5::fromFile(const String& filename)
	{
		pValue.clear();
		IO::File::Stream stream;
		if (stream.open(filename))
		{
			MD5TypeState state;
			MD5TypeByte digest[16];

			md5ImplInit(&state);

			char buffer[1024];
			uint64 len = 0u;

			while (0 != (len = stream.read((char*)buffer, 1024u)))
				md5ImplAppend(&state, reinterpret_cast<const MD5TypeByte*>(buffer), static_cast<uint>(len));

			md5ImplFinish(&state, digest);
			md5DigestToString(pValue, digest);
		}
		return pValue;
	}
コード例 #4
0
	void CompoundWriter::buildClass()
	{
		if (pCompound->name.find_first_of("<@") != String::npos)
			return;

		String filename;
		filename << Options::target << SEP << pCompound->htdocs;
		if (!IO::Directory::Create(filename))
			return;
		filename << SEP << "article.xml";


		IO::File::Stream file;
		if (file.openRW(filename))
		{
			// Getting the name
			const String& name = pCompound->name;

			fileOut.clear();

			String pageTitle;
			{
				String tmp;
				String::Size offset = name.find_last_of(":\\/");
				if (offset < name.size() && offset + 1 < name.size())
					pageTitle.append(name.c_str() + offset + 1, name.size() - (offset + 1));
				else
					pageTitle << name;
				PrepareTitle(tmp, pageTitle);
				fileOut << "<title>" << tmp << "</title>\n";
				fileOut << "<pragma:weight value=\"0.5\" />\n";
				fileOut << "<pragma:toc visible=\"false\" />\n";
				fileOut << "<tag name=\"doxygen\" />\n";
				fileOut << "<tag name=\"dox:class\" />\n";
				fileOut << "\n\n\n";

				fileOut << "<h2>";
				if (not pCompound->brief.empty())
					PrepareTitle(tmp, pCompound->brief);
				else
					PrepareTitle(tmp, pageTitle);
				// in some cases, a final point is in the string, and it is not especially beautiful
				fileOut << tmp;
				fileOut << "</h2>\n";
			}

			bool isAbstract = (pageTitle.first() == 'I');

			OrderedSection sectionmap;
			buildSectionMapping(sectionmap, isAbstract);

			if (!sectionmap.empty())
			{
				// resetting temporary stream outputs
				out.clear();
				for (uint i = 0; i != 2; ++i)
				{
					for (uint j = 0; j != (uint) kdMax; ++j)
						outC[i][j].clear();
				}

				// Starting the table
				out << "<table class=\"doxygen_table\">\n";

				// iterating through all sections found
				OrderedSection::const_iterator end = sectionmap.end();
				for (OrderedSection::const_iterator i = sectionmap.begin(); i != end; ++i)
				{
					// Append all sections found
					Section::Vector::const_iterator send = i->second.end();
					for (Section::Vector::const_iterator j = i->second.begin(); j != send; ++j)
						appendClassSection(/*section*/ *(*j), isAbstract);
				}

				// End of table
				out << "</table>\n\n\n";
			}

			// Writing the begining of the article (title...)
			file << fileOut;

			// Preparing indexes from temporary buffers
			fileOut.clear();
			for (uint i = 1; i < 2; --i)
			{
				for (uint j = 0; j != (uint) kdMax; ++j)
				{
					if (not outC[i][j].empty())
						appendClassIndex(fileOut, (i != 0) /*isPublic*/, (CompoundType) j, outC[i][j]);
				}
			}

			if (not fileOut.empty())
				fileOut << "<h2>Detailed Description</h2>";

			if (not pCompound->description.empty())
			{
				fileOut << "<div>" << pCompound->description
					<< "</div><div style=\"margin-top:3em;border:1px solid #aaa;border-bottom-style:none;border-left-style:none;border-right-style:none\"></div>\n";
			}

			// Writing indexes
			file << fileOut;
			// Writing detailed description
			file << out;
		}
	}
コード例 #5
0
ファイル: versions.cpp プロジェクト: MAPJe71/libyuni
	void List::loadFromPath(const String& folder)
	{
		String path;
		IO::Canonicalize(path, folder);
		if (pOptDebug)
			std::cout << "[yuni-config][debug] :: reading `" << path << "`" << std::endl;

		VersionInfo::Settings info;
		info.mapping = mappingStandard;

		String s;
		s << path << SEP << "yuni.version";
		if (not IO::File::Exists(s))
		{
			s.clear() << path << SEP << "include" << SEP << "yuni" << SEP << "yuni.version";
			if (not IO::File::Exists(s))
			{
				info.mapping = mappingSVNSources;
				s.clear() << path << SEP << "src" << SEP << "yuni" << SEP << "yuni.version";
				if (not IO::File::Exists(s))
                {
					if (pOptDebug)
						std::cout << "[yuni-config][debug] :: " << s << " not found" << std::endl;
					return;
                }
			}
		}

		IO::File::Stream file;
		if (file.open(s))
		{
			String key;
			String value;

			Version version;

			// A buffer. The given capacity will be the maximum length for a single line
			Clob buffer;
			buffer.reserve(8000);
			while (file.readline(buffer))
			{
				buffer.extractKeyValue(key, value);

				if (key.empty() || key == "[")
					continue;
				if (key == "version.hi")
					version.hi = value.to<unsigned int>();
				if (key == "version.lo")
					version.lo = value.to<unsigned int>();
				if (key == "version.rev")
					version.revision = value.to<unsigned int>();
				if (key == "version.target")
					info.compilationMode = value;
				if (key == "modules.available")
					value.split(info.modules, ";\"', \t", false);
				if (key == "support.opengl")
					info.supportOpenGL = value.to<bool>();
				if (key == "support.directx")
					info.supportDirectX = value.to<bool>();
				if (key == "redirect")
					loadFromPath(value);
				if (key == "path.include")
				{
					if (not value.empty())
						info.includePath.push_back(value);
				}
				if (key == "path.lib")
				{
					if (not value.empty())
						info.libPath.push_back(value);
				}
			}

			if (not version.null() and not info.modules.empty())
			{
				info.path = path;
				info.compiler = pCompiler;
				pList[version] = info;

				if (pOptDebug)
				{
					std::cout << "[yuni-config][debug]  - found installation `" << path
						<< "` (" << version << ")" << std::endl;
				}
			}
			else
			{
				std::cerr << "error: " << s << ": invalid file";
				if (version.null())
					std::cerr << " (invalid version)" << std::endl;
				else if (info.modules.empty())
					std::cerr << " (no module)" << std::endl;
			}
		}
	}