Пример #1
0
string HtmlGenerator::getHeader()
{
  ostringstream os;
  os << getHeaderStart(docTitle);
  if (!useInlineCSS){
	if (includeStyleDef) {
	os << "<style type=\"text/css\">\n<!--\n";
	os << getStyleDefinition();
	os << CodeGenerator::readUserStyleDef();
	os << "//-->\n</style>\n";
	} else  {
	os << "<link rel=\"stylesheet\" type=\"text/css\" href=\""
		<< getStyleOutputPath()
		<< "\">\n";
	}
	os << "</head>\n<body class=\"" << cssClassName
           << "\">\n";
  } else {
	os << "</head>\n<body style=\""
	<< "background-color:#"
	<< (docStyle.getBgColour().getRed(HTML))
	<< (docStyle.getBgColour().getGreen(HTML))
	<< (docStyle.getBgColour().getBlue(HTML))
        << "\">\n";
  }

  return os.str();
}
Пример #2
0
size_type PEHeaderParser::retrieveFieldValue(OptionalHeaderField field)
{
	if (lfanewValue_ == 0)
	{
		throw std::ios_base::failure("Error : attempt to read a field without the header parser fully constructed");
	}
	HeaderField tmp = layout_->get(field);
	return reader_.retrieveValue(getHeaderStart() + tmp.offset, tmp.size);
}
Пример #3
0
bool HtmlGenerator::printIndexFile(const vector<string> &fileList,
                                   const string &outPath ){
  string suffix = fileSuffix;
  string outFilePath = outPath + "index" + suffix;
  ofstream indexfile(outFilePath.c_str());

  if (!indexfile.fail()){
     string inFileName;
     string inFilePath, newInFilePath;
     indexfile << getHeaderStart("Source Index" );
     indexfile << "</head>\n<body>\n<h1> Source Index</h1>\n"
               << hrTag
               <<  "\n<ul>\n";
     string::size_type pos;
     for (unsigned int i=0; i < fileList.size();  i++){
         pos=(fileList[i]).find_last_of(Platform::pathSeparator);
         if (pos!=string::npos){
             newInFilePath = (fileList[i]).substr(0, pos+1);
         } else {
            newInFilePath=Platform::pathSeparator;
         }
         if (newInFilePath!=inFilePath){
           indexfile << "</ul>\n<h2>";
           indexfile << newInFilePath;
           indexfile << "</h2>\n<ul>\n";
           inFilePath=newInFilePath;
         }
         inFileName = (fileList[i]).substr(pos+1);
         indexfile << "<li><a href=\"" << inFileName << suffix << "\">";
         indexfile << inFileName << suffix <<"</a></li>\n";
     }

     indexfile << "</ul>\n"
               << hrTag << brTag
               << "<small>Generated by highlight "
               << HIGHLIGHT_VERSION
               << ", <a href=\"" << HIGHLIGHT_URL << "\" target=\"new\">"
               << HIGHLIGHT_URL << "</a></small>";
     indexfile << getGeneratorComment();
  } else {
    return false;
  }
  return true;
}
Пример #4
0
size_type PEHeaderParser::getHeaderEnd() const noexcept
{
	// TODO : add checks to see if it's coherent (depending on the layout value etc etc)
	return getHeaderStart() + layout_->getHeaderSize();
}