LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/exes/adc_uni - cmd_sincedata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 45 24.4 %
Date: 2012-12-27 Functions: 7 8 87.5 %
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 "cmd_sincedata.hxx"
      22             : 
      23             : 
      24             : // NOT FULLY DEFINED SERVICES
      25             : #include <cosv/file.hxx>
      26             : #include <cosv/tpl/tpltools.hxx>
      27             : #include "adc_cmds.hxx"
      28             : 
      29             : 
      30             : 
      31             : namespace autodoc
      32             : {
      33             : namespace command
      34             : {
      35             : 
      36           1 : SinceTagTransformationData::SinceTagTransformationData()
      37           1 :     :   aTransformationTable()
      38             : {
      39           1 : }
      40             : 
      41           2 : SinceTagTransformationData::~SinceTagTransformationData()
      42             : {
      43           2 : }
      44             : 
      45             : bool
      46        2997 : SinceTagTransformationData::DoesTransform() const
      47             : {
      48        2997 :     return NOT aTransformationTable.empty();
      49             : }
      50             : 
      51             : const String &
      52         413 : SinceTagTransformationData::DisplayOf( const String & i_versionNumber ) const
      53             : {
      54         413 :     if (DoesTransform())
      55             :     {
      56             :         StreamLock
      57           0 :             sl(200);
      58           0 :         sl() << i_versionNumber;
      59           0 :         sl().strip_frontback_whitespace();
      60             :         String
      61           0 :             sVersionNumber(sl().c_str());
      62             : 
      63             :         const String *
      64           0 :             ret = csv::find_in_map(aTransformationTable, sVersionNumber);
      65             :         return ret != 0
      66             :                 ?   *ret
      67           0 :                 :   String::Null_();
      68             :     }
      69             :     else
      70             :     {
      71         413 :         return i_versionNumber;
      72             :     }
      73             : }
      74             : 
      75             : void
      76           0 : SinceTagTransformationData::do_Init( opt_iter &  it,
      77             :                                      opt_iter    itEnd )
      78             : {
      79           0 :     ++it;   // Cur is since-file path.
      80             : 
      81           0 :     CHECKOPT(   it != itEnd ,
      82             :               "file path",
      83           0 :               C_opt_SinceFile );
      84             : 
      85           0 :     csv::File           aSinceFile(*it);
      86           0 :     csv::OpenCloseGuard aSinceFileGuard(aSinceFile);
      87           0 :     StreamStr           sLine(200);
      88             : 
      89           0 :     if (aSinceFileGuard)
      90             :     {
      91           0 :         for ( sLine.operator_read_line(aSinceFile);
      92           0 :               NOT sLine.empty();
      93             :               sLine.operator_read_line(aSinceFile) )
      94             :         {
      95             : 
      96           0 :             if (*sLine.begin() != '"')
      97           0 :                 continue;
      98             : 
      99           0 :             const char * pVersion = sLine.c_str() + 1;
     100           0 :             const char * pVersionEnd = strchr(pVersion, '"');
     101           0 :             if (pVersionEnd == 0)
     102           0 :                 continue;
     103           0 :             const char * pDisplay = strchr(pVersionEnd+1, '"');
     104           0 :             if (pDisplay == 0)
     105           0 :                 continue;
     106           0 :             ++pDisplay;
     107           0 :             const char * pDisplayEnd = strchr(pDisplay, '"');
     108           0 :             if (pDisplayEnd == 0)
     109           0 :                 continue;
     110             : 
     111           0 :             aTransformationTable[ String(pVersion,pVersionEnd) ]
     112           0 :                                         = String(pDisplay,pDisplayEnd);
     113           0 :             sLine.clear();
     114             :         }   // end for
     115             :     }   // end if
     116             : 
     117           0 :     ++it;   // Cur is next option.
     118           0 : }
     119             : 
     120             : }   // namespace command
     121           3 : }   // namespace autodoc
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10