LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/exes/adc_uni - adc_cmd.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 15 60.0 %
Date: 2012-12-27 Functions: 8 13 61.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             : #ifndef ADC_ADC_CMD_HXX
      21             : #define ADC_ADC_CMD_HXX
      22             : 
      23             : 
      24             : 
      25             : // USED SERVICES
      26             :     // BASE CLASSES
      27             : #include <cosv/comdline.hxx>
      28             :     // COMPONENTS
      29             :     // PARAMETERS
      30             : 
      31             : 
      32             : namespace autodoc
      33             : {
      34             : namespace command
      35             : {
      36             : 
      37             : /** Context for a command, which can be read from the command line.
      38             : */
      39           8 : class Context
      40             : {
      41             :   public:
      42             :     typedef StringVector::const_iterator opt_iter;
      43             : 
      44           8 :     virtual             ~Context() {}
      45             : 
      46             :     void                Init(
      47             :                             opt_iter &          it,
      48             :                             opt_iter            itEnd );
      49             :   private:
      50             :     virtual void        do_Init(
      51             :                             opt_iter &          it,
      52             :                             opt_iter            itEnd ) = 0;
      53             : };
      54             : 
      55             : // IMPLEMENTATION
      56             : inline void
      57           5 : Context::Init( opt_iter &          i_nCurArgsBegin,
      58             :                opt_iter            i_nEndOfAllArgs )
      59             : 
      60           5 : { do_Init(i_nCurArgsBegin, i_nEndOfAllArgs); }
      61             : 
      62             : 
      63             : 
      64             : /** Interface for commands, autodoc is able to perform.
      65             : */
      66           4 : class Command : public Context
      67             : {
      68             :   public:
      69             :     /** Running ranks of the commands are to be maintained at one location:
      70             :         Here!
      71             :     */
      72             :     enum E_Ranks
      73             :     {
      74             :         rank_Load       = 10,
      75             :         rank_Parse      = 20,
      76             :         rank_Save       = 30,
      77             :         rank_CreateHtml = 40,
      78             :         rank_CreateXml  = 50
      79             :     };
      80             : 
      81             : 
      82             :     bool                Run() const;
      83             :     int                 RunningRank() const;
      84             : 
      85             :   private:
      86             :     virtual bool        do_Run() const = 0;
      87             :     virtual int         inq_RunningRank() const = 0;
      88             : };
      89             : 
      90             : // IMPLEMENTATION
      91             : inline bool
      92           2 : Command::Run() const
      93           2 : { return do_Run(); }
      94             : inline int
      95           2 : Command::RunningRank() const
      96           2 : { return inq_RunningRank(); }
      97             : 
      98             : 
      99             : 
     100             : 
     101             : /** The exception thrown, if the command line is invalid.
     102             : */
     103           0 : class X_CommandLine
     104             : {
     105             :   public:
     106           0 :                         X_CommandLine(
     107             :                             const char *        i_sExplanation )
     108           0 :                             :   sExplanation(i_sExplanation) {}
     109             : 
     110           0 :     void                Report(
     111             :                             std::ostream &      o_rOut )
     112           0 :                             { o_rOut << "Error in command line: "
     113           0 :                                      << sExplanation << Endl(); }
     114             :   private:
     115             :     String              sExplanation;
     116             : };
     117             : 
     118             : 
     119             : 
     120             : 
     121             : }   // namespace command
     122             : }   // namespace autodoc
     123             : #endif
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10