LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/idl - hi_display.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 74 75 98.7 %
Date: 2012-12-27 Functions: 17 17 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <precomp.h>
      21             : #include <idl/hi_display.hxx>
      22             : 
      23             : 
      24             : // NOT FULLY DEFINED SERVICES
      25             : #include <cosv/file.hxx>
      26             : #include <ary/idl/i_ce.hxx>
      27             : #include <ary/idl/i_module.hxx>
      28             : #include <ary/getncast.hxx>
      29             : #include <toolkit/out_tree.hxx>
      30             : #include <cfrstd.hxx>
      31             : #include "hi_ary.hxx"
      32             : #include "hi_env.hxx"
      33             : #include "hi_main.hxx"
      34             : 
      35             : 
      36             : extern const String C_sCssFilename_Idl;
      37             : 
      38             : 
      39             : inline bool
      40        4252 : HtmlDisplay_Idl::IsModule( const ary::idl::CodeEntity & i_ce ) const
      41             : {
      42        4252 :      return ary::is_type<ary::idl::Module>(i_ce);
      43             : }
      44             : 
      45             : inline const ary::idl::Module &
      46         118 : HtmlDisplay_Idl::Module_Cast( const ary::idl::CodeEntity & i_ce ) const
      47             : {
      48         118 :      return ary::ary_cast<ary::idl::Module>(i_ce);
      49             : }
      50             : 
      51             : 
      52             : 
      53             : 
      54           1 : HtmlDisplay_Idl::HtmlDisplay_Idl()
      55             :     :   pCurPageEnv(),
      56           1 :         pMainDisplay()
      57             : {
      58           1 : }
      59             : 
      60           2 : HtmlDisplay_Idl::~HtmlDisplay_Idl()
      61             : {
      62           2 : }
      63             : 
      64             : void
      65           1 : HtmlDisplay_Idl::do_Run( const char *                       i_sOutputDirectory,
      66             :                          const ary::idl::Gate &             i_rAryGate,
      67             :                          const display::CorporateFrame &    i_rLayout )
      68             : {
      69           1 :     SetRunData( i_sOutputDirectory, i_rAryGate, i_rLayout );
      70             : 
      71           1 :     Create_StartFile();
      72           1 :     Create_CssFile();
      73           1 :     Create_FilesInNameTree();
      74           1 :     Create_IndexFiles();
      75           1 :     Create_FilesInProjectTree();
      76           1 :     Create_PackageList();
      77           1 :     Create_HelpFile();
      78           1 : }
      79             : 
      80             : void
      81           1 : HtmlDisplay_Idl::SetRunData( const char *                       i_sOutputDirectory,
      82             :                              const ary::idl::Gate &             i_rAryGate,
      83             :                              const display::CorporateFrame &    i_rLayout  )
      84             : {
      85           1 :     csv::ploc::Path aOutputDir( i_sOutputDirectory, true );
      86           1 :     pCurPageEnv = new HtmlEnvironment_Idl( aOutputDir, i_rAryGate, i_rLayout );
      87           1 :     pMainDisplay = new MainDisplay_Idl(*pCurPageEnv);
      88           1 : }
      89             : 
      90             : void
      91           1 : HtmlDisplay_Idl::Create_StartFile()
      92             : {
      93           1 : }
      94             : 
      95             : void
      96           1 : HtmlDisplay_Idl::Create_FilesInNameTree()
      97             : {
      98           1 :     Cout() << "\nCreate files in subtree namespaces ..." << Endl();
      99             : 
     100             :     const ary::idl::Module &
     101           1 :         rGlobalNamespace = pCurPageEnv->Data().GlobalNamespace();
     102           1 :     pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().NamesRoot(), true );
     103             : 
     104           1 :     RecursiveDisplay_Module(rGlobalNamespace);
     105             : 
     106           1 :     Cout() << "... done." << Endl();
     107           1 : }
     108             : 
     109             : void
     110           1 : HtmlDisplay_Idl::Create_IndexFiles()
     111             : {
     112           1 :     Cout() << "\nCreate files in subtree index ..." << Endl();
     113           1 :     pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().IndexRoot(), true );
     114           1 :     pMainDisplay->WriteGlobalIndices();
     115           1 :     Cout() << "... done.\n" << Endl();
     116           1 : }
     117             : 
     118             : typedef ary::Dyn_StdConstIterator<ary::idl::Ce_id>  Dyn_CeIterator;
     119             : typedef ary::StdConstIterator<ary::idl::Ce_id>      CeIterator;
     120             : 
     121             : void
     122         119 : HtmlDisplay_Idl::RecursiveDisplay_Module( const ary::idl::Module & i_module )
     123             : {
     124         119 :     i_module.Accept(*pMainDisplay);
     125             : 
     126             :     Dyn_CeIterator
     127         119 :         aMembers;
     128         119 :     i_module.Get_Names(aMembers);
     129             : 
     130        4490 :     for ( CeIterator & iter = *aMembers;
     131             :           iter;
     132        4252 :           ++iter )
     133             :     {
     134             :         const ary::idl::CodeEntity &
     135        4252 :             rCe = pCurPageEnv->Data().Find_Ce(*iter);
     136             : 
     137        4252 :         if ( NOT IsModule(rCe) )
     138        4134 :             rCe.Accept(*pMainDisplay);
     139             :         else
     140             :         {
     141         118 :             pCurPageEnv->Goto_DirectoryLevelDown( rCe.LocalName(), true );
     142         118 :             RecursiveDisplay_Module( Module_Cast(rCe) );
     143         118 :             pCurPageEnv->Goto_DirectoryLevelUp();
     144             :         }
     145         119 :     }   // end for
     146         119 : }
     147             : 
     148             : void
     149           1 : HtmlDisplay_Idl::Create_FilesInProjectTree()
     150             : {
     151           1 : }
     152             : 
     153             : void
     154           1 : HtmlDisplay_Idl::Create_PackageList()
     155             : {
     156           1 : }
     157             : 
     158             : void
     159           1 : HtmlDisplay_Idl::Create_HelpFile()
     160             : {
     161           1 : }
     162             : 
     163             : void
     164           1 : HtmlDisplay_Idl::Create_CssFile()
     165             : {
     166           1 :     Cout() << "\nCreate css file ..." << Endl();
     167             : 
     168           1 :     pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().Root(), true );
     169           1 :     pCurPageEnv->Set_CurFile( C_sCssFilename_Idl );
     170             : 
     171             :     StreamLock
     172           1 :         slCurFilePath(700);
     173           1 :     pCurPageEnv->Get_CurFilePath(slCurFilePath());
     174             : 
     175             :     csv::File
     176           1 :         aCssFile(slCurFilePath().c_str(), csv::CFM_CREATE);
     177             :     csv::OpenCloseGuard
     178           1 :         aOpenGuard(aCssFile);
     179           1 :     if (NOT aOpenGuard)
     180             :     {
     181           0 :         Cerr() << "Can't create file " << slCurFilePath().c_str() << "." << Endl();
     182           1 :         return;
     183             :     }
     184             : 
     185           1 :     aCssFile.write("/*      Autodoc css file for IDL documentation      */\n\n\n");
     186           1 :     aCssFile.write(pCurPageEnv->Layout().CssStyle());
     187           1 :     aCssFile.write("\n\n\n");
     188           1 :     aCssFile.write(pCurPageEnv->Layout().CssStylesExplanation());
     189           3 : }
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10