예제 #1
0
  void                  addEdge(ConstructPtr cp_from, ConstructLocation l_from,
                                ConstructPtr cp_to, ConstructLocation l_to) {
    assert(cp_from);
    assert(cp_to);
    assert(l_from < 2);

    ControlFlowInfo &from(cfi(cp_from));
    ControlFlowInfo &to(cfi(cp_to));

    from.m_targets[l_from][cp_to] = l_to;
    to.m_isTarget[l_to] = true;
  }
예제 #2
0
void LatexDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  switch(inc->type())
  {
    case DocInclude::IncWithLines:
      { 
         m_t << "\n\n\\footnotesize\\begin{verbatim}"; 
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath(), cfi.fileName() );
         parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
         m_t << "\\end{verbatim}\n\\normalsize" << endl; 
      }
      break;    
    case DocInclude::Include: 
      m_t << "\n\n\\footnotesize\\begin{verbatim}"; 
      parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile());
      m_t << "\\end{verbatim}\n\\normalsize" << endl; 
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      break;
    case DocInclude::VerbInclude: 
      m_t << "\n\n\\footnotesize\\begin{verbatim}"; 
      m_t << inc->text();
      m_t << "\\end{verbatim}\n\\normalsize" << endl; 
      break;
  }
}
예제 #3
0
void CaptureFile::captureFileEvent(int event, gpointer data)
{
    switch(event) {
    case(cf_cb_file_opened):
    {
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Opened");
        cap_file_ = (capture_file *) data;
        QFileInfo cfi(QString::fromUtf8(cap_file_->filename));
        file_title_ = cfi.baseName();
        emit captureFileOpened();
        break;
    }
    case(cf_cb_file_closing):
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closing");
        file_state_ = tr(" [closing]");
        emit captureFileClosing();
        break;
    case(cf_cb_file_closed):
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closed");
        file_state_ = tr(" [closed]");
        emit captureFileClosed();
        cap_file_ = NULL;
        file_title_ = no_capture_file_;
        file_state_ = QString();
        break;
    case(cf_cb_file_read_started):
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read started");
        emit captureFileReadStarted();
        break;
    case(cf_cb_file_read_finished):
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read finished");
        emit captureFileReadFinished();
        break;
    case(cf_cb_file_reload_started):
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Reload started");
        emit captureFileReadStarted();
        break;
    case(cf_cb_file_reload_finished):
        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Reload finished");
        emit captureFileReadFinished();
        break;

    case(cf_cb_packet_selected):
    case(cf_cb_packet_unselected):
    case(cf_cb_field_unselected):
        // Signals and slots handled elsewhere.
        break;

    case(cf_cb_file_save_started): // data = string
    case(cf_cb_file_save_finished):
    case(cf_cb_file_save_failed):
        // Ignored
        break;
    default:
        g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: main_cf_callback %d %p", event, data);
        g_warning("CaptureFile::captureFileCallback: event %u unknown", event);
        break;
    }
}
void LatexDocVisitor::visit(DocInclude *inc)
{
   if (m_hide) {
      return;
   }

   SrcLangExt langExt = getLanguageFromFileName(inc->extension());

   switch (inc->type()) {
      case DocInclude::IncWithLines: {
         m_t << "\n\\begin{DoxyCodeInclude}\n";

         QFileInfo cfi(inc->file());
         QSharedPointer<FileDef> fd = QMakeShared<FileDef>(cfi.path(), cfi.fileName());

         Doxy_Globals::parserManager->getParser(inc->extension())->parseCode(m_ci, inc->context(),
                     inc->text(), langExt, inc->isExample(), inc->exampleFile(), fd);

         m_t << "\\end{DoxyCodeInclude}" << endl;
      }
      break;

      case DocInclude::Include:
         m_t << "\n\\begin{DoxyCodeInclude}\n";
         Doxy_Globals::parserManager->getParser(inc->extension())->parseCode(m_ci, inc->context(), inc->text(), 
                     langExt, inc->isExample(),inc->exampleFile());

         m_t << "\\end{DoxyCodeInclude}\n";
         break;

      case DocInclude::DontInclude:
         break;
      case DocInclude::HtmlInclude:
         break;
      case DocInclude::LatexInclude:
         m_t << inc->text();
         break;
      case DocInclude::VerbInclude:
         m_t << "\n\\begin{DoxyVerbInclude}\n";
         m_t << inc->text();
         m_t << "\\end{DoxyVerbInclude}\n";
         break;
      case DocInclude::Snippet: {
         m_t << "\n\\begin{DoxyCodeInclude}\n";
         Doxy_Globals::parserManager->getParser(inc->extension())
         ->parseCode(m_ci,
                     inc->context(),
                     extractBlock(inc->text(), inc->blockId()),
                     langExt,
                     inc->isExample(),
                     inc->exampleFile()
                    );
         m_t << "\\end{DoxyCodeInclude}" << endl;
      }
      break;
   }
}
예제 #5
0
void XmlDocVisitor::visit(DocInclude *inc)
{
    if (m_hide) return;
    SrcLangExt langExt = getLanguageFromFileName(inc->extension());
    switch(inc->type())
    {
    case DocInclude::IncWithLines:
    {
        m_t << "<programlisting>";
        QFileInfo cfi( inc->file() );
        FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
        Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,inc->context(),
                    inc->text(),
                    langExt,
                    inc->isExample(),
                    inc->exampleFile(), &fd);
        m_t << "</programlisting>";
    }
    break;
    case DocInclude::Include:
        m_t << "<programlisting>";
        Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,inc->context(),
                    inc->text(),
                    langExt,
                    inc->isExample(),
                    inc->exampleFile());
        m_t << "</programlisting>";
        break;
    case DocInclude::DontInclude:
        break;
    case DocInclude::HtmlInclude:
        m_t << "<htmlonly>";
        filter(inc->text());
        m_t << "</htmlonly>";
        break;
    case DocInclude::VerbInclude:
        m_t << "<verbatim>";
        filter(inc->text());
        m_t << "</verbatim>";
        break;
    case DocInclude::Snippet:
        m_t << "<programlisting>";
        Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,
                    inc->context(),
                    extractBlock(inc->text(),inc->blockId()),
                    langExt,
                    inc->isExample(),
                    inc->exampleFile()
                   );
        m_t << "</programlisting>";
        break;
    }
}
예제 #6
0
  void setEdge(ConstructRawPtr cp_from, ConstructLocation l_from,
               ConstructRawPtr cp_to, ConstructLocation l_to) {
    always_assert(cp_from);
    always_assert(cp_to);
    always_assert(l_from < 2);

    ControlFlowInfo &from(cfi(cp_from));
    from.m_targets[l_from].clear();
    addEdge(cp_from, l_from, cp_to, l_to);
  }
예제 #7
0
QStringList GlobalConfig::fetch(const QString &baseURL)
{
    m_baseURL = baseURL;
    if(!m_baseURL.endsWith('/'))
      m_baseURL += '/';

    QStringList configFiles;
    QUrl url(m_baseURL + "config.txt");

    if (url.scheme() == "file")
    {
        QFileInfo cfr(url.toLocalFile());
        if (cfr.exists())
        {
            configFiles << cfr.absoluteFilePath();
        }
        else
        {
            qCritical() << "local config file does not exist" <<  cfr.absoluteFilePath();    
        }
        return configFiles;
    }
    // remote config file
    else if (url.scheme() == "http" || url.scheme() == "ftp")
    {
        QFileInfo cfr(Settings::instance().downloadDir()+"/config-remote.txt");
        qDebug() << "Check if a copy of the remote config file is available at" << cfr.absoluteFilePath() << (cfr.exists() ? "... found" : "... not found");
        if (cfr.exists())
        {
            configFiles << cfr.absoluteFilePath();
        }
        else
        {
            QFileInfo cfi(Settings::instance().downloadDir()+"/config.txt");
            bool ret = Downloader::instance()->fetch(url,cfi.absoluteFilePath());
            qDebug() << "download remote config file from" <<  url << "to" << cfi.absoluteFilePath() << "..." << (ret ? "okay" : "failure") ;
            if (ret)
                configFiles << cfi.absoluteFilePath();
            else 
                return configFiles;
        }

        QFileInfo fi(Settings::instance().downloadDir()+"/config-local.txt");
        qDebug() << "Check if a local config file is available at" << fi.absoluteFilePath() << (fi.exists() ? "... found" : "... not found");
        if (fi.exists())
            configFiles << fi.absoluteFilePath();

    }
    qDebug() << "using config file(s)" << configFiles;
    
    return configFiles;
}
예제 #8
0
void ManDocVisitor::visit(DocInclude *inc)
{
    if (m_hide) return;
    switch(inc->type())
    {
    case DocInclude::IncWithLines:
    {
        if (!m_firstCol) m_t << endl;
        m_t << ".PP" << endl;
        m_t << ".nf" << endl;
        QFileInfo cfi( inc->file() );
        FileDef fd( cfi.dirPath(), cfi.fileName() );
        Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,inc->context(),
                    inc->text(),
                    inc->isExample(),
                    inc->exampleFile(), &fd);
        if (!m_firstCol) m_t << endl;
        m_t << ".fi" << endl;
        m_t << ".PP" << endl;
        m_firstCol=TRUE;
    }
    break;
    case DocInclude::Include:
        if (!m_firstCol) m_t << endl;
        m_t << ".PP" << endl;
        m_t << ".nf" << endl;
        Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,inc->context(),
                    inc->text(),inc->isExample(),
                    inc->exampleFile());
        if (!m_firstCol) m_t << endl;
        m_t << ".fi" << endl;
        m_t << ".PP" << endl;
        m_firstCol=TRUE;
        break;
    case DocInclude::DontInclude:
        break;
    case DocInclude::HtmlInclude:
        break;
    case DocInclude::VerbInclude:
        if (!m_firstCol) m_t << endl;
        m_t << ".PP" << endl;
        m_t << ".nf" << endl;
        m_t << inc->text();
        if (!m_firstCol) m_t << endl;
        m_t << ".fi" << endl;
        m_t << ".PP" << endl;
        m_firstCol=TRUE;
        break;
    }
}
예제 #9
0
void LatexDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  switch(inc->type())
  {
    case DocInclude::IncWithLines:
      { 
         m_t << "\n\\begin{DoxyCodeInclude}\n";
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,inc->context(),
                                           inc->text(),
                                           inc->isExample(),
                                           inc->exampleFile(), &fd);
         m_t << "\\end{DoxyCodeInclude}" << endl;
      }
      break;    
    case DocInclude::Include: 
      m_t << "\n\\begin{DoxyCodeInclude}\n";
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,inc->context(),
                                        inc->text(),inc->isExample(),
                                        inc->exampleFile());
      m_t << "\\end{DoxyCodeInclude}\n";
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      break;
    case DocInclude::VerbInclude: 
      m_t << "\n\\begin{DoxyVerbInclude}\n";
      m_t << inc->text();
      m_t << "\\end{DoxyVerbInclude}\n";
      break;
    case DocInclude::Snippet:
      {
         m_t << "\n\\begin{DoxyCodeInclude}\n";
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,
                                           inc->context(),
                                           extractBlock(inc->text(),inc->blockId()),
                                           inc->isExample(),
                                           inc->exampleFile()
                                          );
         m_t << "\\end{DoxyCodeInclude}" << endl;
      }
      break;
  }
}
예제 #10
0
const QString CaptureFile::fileName()
{
    QString path, name;

    path = filePath();
    if (!path.isEmpty()) {
        QFileInfo cfi(path);
        name = cfi.fileName();
    } else {
        name = QString();
    }

    return name;
}
예제 #11
0
void RTFDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  DBG_RTF("{\\comment RTFDocVisitor::visit(DocInclude)}\n");
  switch(inc->type())
  {
   case DocInclude::IncWithLines:
      { 
         m_t << "{" << endl;
         m_t << "\\par" << endl;
         m_t << rtf_Style_Reset << getStyle("CodeExample");
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath(), cfi.fileName() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,inc->context(),
                                           inc->text(),
                                           inc->isExample(),
                                           inc->exampleFile(), &fd);
         m_t << "\\par";
         m_t << "}" << endl;
      }
      break;
   case DocInclude::Include: 
      m_t << "{" << endl;
      m_t << "\\par" << endl;
      m_t << rtf_Style_Reset << getStyle("CodeExample");
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,inc->context(),
                                        inc->text(),inc->isExample(),
                                        inc->exampleFile());
      m_t << "\\par";
      m_t << "}" << endl;
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      break;
    case DocInclude::VerbInclude: 
      m_t << "{" << endl;
      m_t << "\\par" << endl;
      m_t << rtf_Style_Reset << getStyle("CodeExample");
      filter(inc->text());
      m_t << "\\par";
      m_t << "}" << endl;
      break;
  }
  m_lastIsPara=TRUE;
}
예제 #12
0
bool CFI::CompileCFI(const string &str)
{
    // strip the 'epubcfi(...)' wrapping
    string cfi(str);
    if ( str.find("epubcfi(") == 0 )
    {
        cfi = cfi.substr(8, (str.size()-1)-8);
    }
    else if ( str.size() == 0 )
    {
        HandleError(EPUBError::CFIParseFailed, "Empty CFI string");
        return false;
    }
    else if ( str[0] != '/' )
    {
        HandleError(EPUBError::CFINonSlashStartCharacter);
    }
    
    StringList rangePieces = RangedCFIComponents(cfi);
    if ( rangePieces.size() != 1 && rangePieces.size() != 3 )
    {
        HandleError(EPUBError::CFIRangeComponentCountInvalid, _Str("Expected 1 or 3 range components, got ", rangePieces.size()));
        if ( rangePieces.size() == 0 )
            return false;
    }
    
    if ( CompileComponentsToList(CFIComponentStrings(rangePieces[0]), &_components) == false )
        return false;
    
    if ( rangePieces.size() >= 3 )
    {
        if ( CompileComponentsToList(CFIComponentStrings(rangePieces[1]), &_rangeStart) == false )
            return false;
        if ( CompileComponentsToList(CFIComponentStrings(rangePieces[2]), &_rangeEnd) == false )
            return false;
        
        // now sanity-check the range delimiters:
        
        // neither should be empty
        if ( _rangeStart.empty() || _rangeEnd.empty() )
        {
            HandleError(EPUBError::CFIRangeInvalid, "One of the supplied range components was empty.");
            return false;
        }
        
        // check the offsets at the end of each— they should be the same type
        if ( (_rangeStart.back().flags & Component::OffsetsMask) != (_rangeEnd.back().flags & Component::OffsetsMask) )
        {
            HandleError(EPUBError::CFIRangeInvalid, "Offsets at the end of range components are of different types.");
            return false;
        }
        
        // ensure that there are no side-bias values
        if ( (_rangeStart.back().sideBias != SideBias::Unspecified) ||
             (_rangeEnd.back().sideBias != SideBias::Unspecified) )
        {
            HandleError(EPUBError::CFIRangeContainsSideBias);
            // can safely ignore this one
        }
        
        // where the delimiters' component ranges overlap, start must be <= end
        auto maxsz = std::max(_rangeStart.size(), _rangeEnd.size());
        bool inequalNodeIndexFound = false;
        for ( decltype(maxsz) i = 0; i < maxsz; i++ )
        {
            if ( _rangeStart[i].nodeIndex > _rangeEnd[i].nodeIndex )
            {
                HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
            }
            else if ( !inequalNodeIndexFound && _rangeStart[i].nodeIndex < _rangeEnd[i].nodeIndex )
            {
                inequalNodeIndexFound = true;
            }
        }
        
        // if the two ranges are equal aside from their offsets, the end offset must be > the start offset
        if ( !inequalNodeIndexFound && _rangeStart.size() == _rangeEnd.size() )
        {
            Component &s = _rangeStart.back(), &e = _rangeEnd.back();
            if ( s.HasCharacterOffset() && s.characterOffset > e.characterOffset )
            {
                HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
            }
            else
            {
                if ( s.HasTemporalOffset() && s.temporalOffset > e.temporalOffset )
                    HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
                if ( s.HasSpatialOffset() && s.spatialOffset > e.spatialOffset )
                    HandleError(EPUBError::CFIRangeInvalid, "Range components appear to be out of order.");
            }
        }
        
        _options |= RangeTriplet;
    }
    
    return true;
}
예제 #13
0
파일: diary.cpp 프로젝트: mariosgn/nunc
bool Diary::open()
{
    QString diaryPath = ms_DiaryPath;

    QFileInfo p(diaryPath);
    QFile configuration;

    if ( p.isFile() )
    {
        configuration.setFileName(diaryPath);
    }
    else if ( p.isDir() )
    {
        QFileInfo pc( diaryPath + "/" + DEFAULT_CONF_FILE );
        if ( !pc.isFile() )
        {
            errorMsg(tr("Diary path not valid: configuration file missing"));
            return false;
        }
        configuration.setFileName( pc.absoluteFilePath() );
    }
    else
    {
        errorMsg(tr("Diary path not valid"));
        return false;
    }

    if ( !configuration.open(QIODevice::ReadOnly | QIODevice::Text) )
    {
        errorMsg(QString( tr("Diary path not valid: cannot read configuration file [%1]").arg(configuration.fileName() ) ));
        return false;
    }

    QString conf = configuration.readAll();
    configuration.close();

    QJsonParseError e;
    QJsonDocument d = QJsonDocument::fromJson(conf.toUtf8(), &e);
    if (e.error != QJsonParseError::NoError	)
    {
        errorMsg(tr("Diary conf json not valid: ")+ e.errorString() );
        return false;
    }

    ms_ConfObject = d.object();
    bool errorConf = true;
    QString confNotFound;

    do
    {
        if ( !ms_ConfObject.value(QString(CONF_NUNC)).toBool() )
        {
            confNotFound = CONF_NUNC;
            break;
        }

        if ( ms_ConfObject.value( CONF_CHECK_ENCRYPTED ).toString().size()<=0 )
        {
            errorMsg( tr("Missing diary key password") );
            return false;
        }

        errorConf = false;
    } while(0);


    if ( errorConf )
    {
        errorMsg( tr("Diary conf not valid. Value missing or wrong: ")+confNotFound );
        return false;
    }

    QFileInfo cfi( configuration.fileName() );
    ms_DiaryPath = cfi.absoluteDir().absolutePath();
    return true;
}
예제 #14
0
void ManDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  SrcLangExt langExt = getLanguageFromFileName(inc->extension());
  switch(inc->type())
  {
    case DocInclude::IncWithLines:
      { 
         if (!m_firstCol) m_t << endl;
         m_t << ".PP" << endl;
         m_t << ".nf" << endl;
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,inc->context(),
                                           inc->text(),
                                           langExt,
                                           inc->isExample(),
                                           inc->exampleFile(),
                                           &fd,   // fileDef,
                                           -1,    // start line
                                           -1,    // end line
                                           FALSE, // inline fragment
                                           0,     // memberDef
                                           TRUE
					   );
         if (!m_firstCol) m_t << endl;
         m_t << ".fi" << endl;
         m_t << ".PP" << endl;
         m_firstCol=TRUE;
      }
      break;
    case DocInclude::Include: 
      if (!m_firstCol) m_t << endl;
      m_t << ".PP" << endl;
      m_t << ".nf" << endl;
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,inc->context(),
                                        inc->text(),
                                        langExt,
                                        inc->isExample(),
                                        inc->exampleFile(),
                                        0,     // fileDef
                                        -1,    // startLine
                                        -1,    // endLine
                                        TRUE,  // inlineFragment
                                        0,     // memberDef
                                        FALSE
				       );
      if (!m_firstCol) m_t << endl;
      m_t << ".fi" << endl;
      m_t << ".PP" << endl;
      m_firstCol=TRUE;
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      break;
    case DocInclude::LatexInclude:
      break;
    case DocInclude::VerbInclude: 
      if (!m_firstCol) m_t << endl;
      m_t << ".PP" << endl;
      m_t << ".nf" << endl;
      m_t << inc->text();
      if (!m_firstCol) m_t << endl;
      m_t << ".fi" << endl;
      m_t << ".PP" << endl;
      m_firstCol=TRUE;
      break;
    case DocInclude::Snippet:
      if (!m_firstCol) m_t << endl;
      m_t << ".PP" << endl;
      m_t << ".nf" << endl;
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,
                                        inc->context(),
                                        extractBlock(inc->text(),inc->blockId()),
                                        langExt,
                                        inc->isExample(),
                                        inc->exampleFile()
                                       );
      if (!m_firstCol) m_t << endl;
      m_t << ".fi" << endl;
      m_t << ".PP" << endl;
      m_firstCol=TRUE;
      break;
    case DocInclude::SnipWithLines:
      {
         if (!m_firstCol) m_t << endl;
         m_t << ".PP" << endl;
         m_t << ".nf" << endl;
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,
                                           inc->context(),
                                           extractBlock(inc->text(),inc->blockId()),
                                           langExt,
                                           inc->isExample(),
                                           inc->exampleFile(), 
                                           &fd,
                                           lineBlock(inc->text(),inc->blockId()),
                                           -1,    // endLine
                                           FALSE, // inlineFragment
                                           0,     // memberDef
                                           TRUE   // show line number
                                          );
         if (!m_firstCol) m_t << endl;
         m_t << ".fi" << endl;
         m_t << ".PP" << endl;
         m_firstCol=TRUE;
      }
      break;
    case DocInclude::SnippetDoc: 
    case DocInclude::IncludeDoc: 
      err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
          "Please create a bug report\n",__FILE__);
      break;
  }
}
예제 #15
0
    void                    load( cstring file_name, Modifier const& m )
    {
        config_file_iterator cfi( file_name, m );

        load( cfi, m );
    }
void ManDocVisitor::visit(DocInclude *inc)
{
   if (m_hide) {
      return;
   }
   SrcLangExt langExt = getLanguageFromFileName(inc->extension());

   switch (inc->type()) {
      case DocInclude::IncWithLines: {
         if (! m_firstCol) {
            m_t << endl;
         }
         m_t << ".PP" << endl;
         m_t << ".nf" << endl;

         QFileInfo cfi( inc->file() );
         QSharedPointer<FileDef> fd = QMakeShared<FileDef>( cfi.path(), cfi.fileName() );

         Doxy_Globals::parserManager->getParser(inc->extension())->parseCode(m_ci, inc->context(), inc->text(), 
                                           langExt, inc->isExample(), inc->exampleFile(), fd);

         if (! m_firstCol) {
            m_t << endl;
         }

         m_t << ".fi" << endl;
         m_t << ".PP" << endl;
         m_firstCol = true;
      }

      break;
      case DocInclude::Include:
         if (!m_firstCol) {
            m_t << endl;
         }
         m_t << ".PP" << endl;
         m_t << ".nf" << endl;
         Doxy_Globals::parserManager->getParser(inc->extension())->parseCode(m_ci, inc->context(),inc->text(),langExt,
                     inc->isExample(), inc->exampleFile());

         if (!m_firstCol) {
            m_t << endl;
         }
         m_t << ".fi" << endl;
         m_t << ".PP" << endl;
         m_firstCol = true;
         break;

      case DocInclude::DontInclude:
         break;

      case DocInclude::HtmlInclude:
         break;

      case DocInclude::LatexInclude:
         break;

      case DocInclude::VerbInclude:
         if (! m_firstCol) {
            m_t << endl;
         }
         m_t << ".PP" << endl;
         m_t << ".nf" << endl;
         m_t << inc->text();

         if (!m_firstCol) {
            m_t << endl;
         }

         m_t << ".fi" << endl;
         m_t << ".PP" << endl;
         m_firstCol = true;
         break;

      case DocInclude::Snippet:
         if (!m_firstCol) {
            m_t << endl;
         }
         m_t << ".PP" << endl;
         m_t << ".nf" << endl;
         Doxy_Globals::parserManager->getParser(inc->extension())->parseCode(m_ci, inc->context(), extractBlock(inc->text(), inc->blockId()),
                     langExt, inc->isExample(), inc->exampleFile() );

         if (!m_firstCol) {
            m_t << endl;
         }

         m_t << ".fi" << endl;
         m_t << ".PP" << endl;
         m_firstCol = true;
         break;
   }
}
예제 #17
0
 void                  noFallThrough(ConstructPtr cp) {
   cfi(cp).m_noFallThrough = true;
 }
예제 #18
0
void XmlDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  SrcLangExt langExt = getLanguageFromFileName(inc->extension());
  switch(inc->type())
  {
    case DocInclude::IncWithLines:
      { 
         m_t << "<programlisting filename=\"" << inc->file() << "\">";
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,inc->context(),
                                           inc->text(),
                                           langExt,
                                           inc->isExample(),
                                           inc->exampleFile(),
                                           &fd,   // fileDef,
                                           -1,    // start line
                                           -1,    // end line
                                           FALSE, // inline fragment
                                           0,     // memberDef
                                           TRUE   // show line numbers
					   );
         m_t << "</programlisting>"; 
      }
      break;    
    case DocInclude::Include: 
      m_t << "<programlisting filename=\"" << inc->file() << "\">";
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,inc->context(),
                                        inc->text(),
                                        langExt,
                                        inc->isExample(),
                                        inc->exampleFile(),
                                        0,     // fileDef
                                        -1,    // startLine
                                        -1,    // endLine
                                        TRUE,  // inlineFragment
                                        0,     // memberDef
                                        FALSE  // show line numbers
				       );
      m_t << "</programlisting>"; 
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      m_t << "<htmlonly>";
      filter(inc->text());
      m_t << "</htmlonly>";
      break;
    case DocInclude::LatexInclude:
      m_t << "<latexonly>";
      filter(inc->text());
      m_t << "</latexonly>";
      break;
    case DocInclude::VerbInclude: 
      m_t << "<verbatim>";
      filter(inc->text());
      m_t << "</verbatim>"; 
      break;
    case DocInclude::Snippet:
      m_t << "<programlisting filename=\"" << inc->file() << "\">";
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,
                                        inc->context(),
                                        extractBlock(inc->text(),inc->blockId()),
                                        langExt,
                                        inc->isExample(),
                                        inc->exampleFile()
                                       );
      m_t << "</programlisting>"; 
      break;
    case DocInclude::SnipWithLines:
      {
         m_t << "<programlisting filename=\"" << inc->file() << "\">";
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,
                                           inc->context(),
                                           extractBlock(inc->text(),inc->blockId()),
                                           langExt,
                                           inc->isExample(),
                                           inc->exampleFile(), 
                                           &fd,
                                           lineBlock(inc->text(),inc->blockId()),
                                           -1,    // endLine
                                           FALSE, // inlineFragment
                                           0,     // memberDef
                                           TRUE   // show line number
                                          );
         m_t << "</programlisting>"; 
      }
      break;
    case DocInclude::SnippetDoc: 
    case DocInclude::IncludeDoc: 
      err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
          "Please create a bug report\n",__FILE__);
      break;
  }
}
예제 #19
0
파일: cfi.cpp 프로젝트: aironik/readium-sdk
bool CFI::CompileCFI(const string &str)
{
    // strip the 'epubcfi(...)' wrapping
    string cfi(str);
    if ( str.find("epubcfi(") == 0 )
    {
        cfi = cfi.substr(8, (str.size()-1)-8);
    }
    else if ( str.size() == 0 || str[0] != '/' )
    {
        // invalid CFI
        return false;
    }
    
    StringList rangePieces = RangedCFIComponents(cfi);
    if ( rangePieces.size() != 1 && rangePieces.size() != 3 )
        return false;
    
    if ( CompileComponentsToList(CFIComponentStrings(rangePieces[0]), &_components) == false )
        return false;
    
    if ( rangePieces.size() == 3 )
    {
        if ( CompileComponentsToList(CFIComponentStrings(rangePieces[1]), &_rangeStart) == false )
            return false;
        if ( CompileComponentsToList(CFIComponentStrings(rangePieces[2]), &_rangeEnd) == false )
            return false;
        
        // now sanity-check the range delimiters:
        
        // neither should be empty
        if ( _rangeStart.empty() || _rangeEnd.empty() )
            return false;
        
        // check the offsets at the end of each— they should be the same type
        if ( (_rangeStart.back().flags & Component::OffsetsMask) != (_rangeEnd.back().flags & Component::OffsetsMask) )
            return false;
        
        // where the delimiters' component ranges overlap, start must be <= end
        auto maxsz = std::max(_rangeStart.size(), _rangeEnd.size());
        bool inequalNodeIndexFound = false;
        for ( decltype(maxsz) i = 0; i < maxsz; i++ )
        {
            if ( _rangeStart[i].nodeIndex > _rangeEnd[i].nodeIndex )
                return false;
            else if ( !inequalNodeIndexFound && _rangeStart[i].nodeIndex < _rangeEnd[i].nodeIndex )
                inequalNodeIndexFound = true;
        }
        
        // if the two ranges are equal aside from their offsets, the end offset must be > the start offset
        if ( !inequalNodeIndexFound && _rangeStart.size() == _rangeEnd.size() )
        {
            Component &s = _rangeStart.back(), &e = _rangeEnd.back();
            if ( s.HasCharacterOffset() && s.characterOffset > e.characterOffset )
            {
                return false;
            }
            else
            {
                if ( s.HasTemporalOffset() && s.temporalOffset > e.temporalOffset )
                    return false;
                if ( s.HasSpatialOffset() && s.spatialOffset > e.spatialOffset )
                    return false;
            }
        }
        
        _options |= RangeTriplet;
    }
    
    return true;
}
예제 #20
0
void HtmlDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  switch(inc->type())
  {
    case DocInclude::Include: 
      forceEndParagraph(inc);
      m_t << PREFRAG_START;
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,                 
                                        inc->context(),
                                        inc->text(),
                                        inc->isExample(),
                                        inc->exampleFile(),
                                        0,   // fd
                                        -1,  // startLine
                                        -1,  // endLine
                                        TRUE // inlineFragment
                                       );
      m_t << PREFRAG_END;
      forceStartParagraph(inc);
      break;
    case DocInclude::IncWithLines:
      { 
         forceEndParagraph(inc);
         m_t << PREFRAG_START;
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath(), cfi.fileName() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,
                                           inc->context(),
                                           inc->text(),
                                           inc->isExample(),
                                           inc->exampleFile(), &fd);
         m_t << PREFRAG_END;
         forceStartParagraph(inc);
      }
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      m_t << inc->text(); 
      break;
    case DocInclude::VerbInclude: 
      forceEndParagraph(inc);
      m_t << PREFRAG_START;
      filter(inc->text());
      m_t << PREFRAG_END;
      forceStartParagraph(inc);
      break;
    case DocInclude::Snippet:
      {
         forceEndParagraph(inc);
         m_t << PREFRAG_START;
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,
                                           inc->context(),
                                           extractBlock(inc->text(),inc->blockId()),
                                           inc->isExample(),
                                           inc->exampleFile(), 
                                           0,
                                           -1,  // startLine
                                           -1,  // endLine
                                           TRUE // inlineFragment
                                          );
         m_t << PREFRAG_END;
         forceStartParagraph(inc);
      }
      break;
  }
}
예제 #21
0
void DocbookDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  SrcLangExt langExt = getLanguageFromFileName(inc->extension());
  switch(inc->type())
  {
    case DocInclude::IncWithLines:
      {
        m_t << "<literallayout><computeroutput>";
        QFileInfo cfi( inc->file() );
        FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
        Doxygen::parserManager->getParser(inc->extension())
          ->parseCode(m_ci,inc->context(),
              inc->text(),
              langExt,
              inc->isExample(),
              inc->exampleFile(), &fd);
        m_t << "</computeroutput></literallayout>";
      }
      break;
    case DocInclude::Include:
      m_t << "<literallayout><computeroutput>";
      Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,inc->context(),
            inc->text(),
            langExt,
            inc->isExample(),
            inc->exampleFile());
      m_t << "</computeroutput></literallayout>";
      break;
    case DocInclude::DontInclude:
      break;
    case DocInclude::HtmlInclude:
      break;
    case DocInclude::LatexInclude:
      break;
    case DocInclude::VerbInclude:
      m_t << "<verbatim>";
      filter(inc->text());
      m_t << "</verbatim>";
      break;
    case DocInclude::Snippet:
      m_t << "<literallayout><computeroutput>";
      Doxygen::parserManager->getParser(inc->extension())
        ->parseCode(m_ci,
            inc->context(),
            extractBlock(inc->text(),inc->blockId()),
            langExt,
            inc->isExample(),
            inc->exampleFile()
            );
      m_t << "</computeroutput></literallayout>";
      break;
    case DocInclude::SnipWithLines:
      {
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
         m_t << "<literallayout><computeroutput>";
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,
                                           inc->context(),
                                           extractBlock(inc->text(),inc->blockId()),
                                           langExt,
                                           inc->isExample(),
                                           inc->exampleFile(), 
                                           &fd,
                                           lineBlock(inc->text(),inc->blockId()),
                                           -1,    // endLine
                                           FALSE, // inlineFragment
                                           0,     // memberDef
                                           TRUE   // show line number
                                          );
         m_t << "</computeroutput></literallayout>";
      }
      break;
    case DocInclude::SnippetDoc: 
    case DocInclude::IncludeDoc: 
      err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
          "Please create a bug report\n",__FILE__);
      break;
  }
}