LCOV - code coverage report
Current view: top level - desktop/source/app - cmdlineargs.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 27 43 62.8 %
Date: 2015-06-13 12:38:46 Functions: 27 43 62.8 %
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 INCLUDED_DESKTOP_SOURCE_APP_CMDLINEARGS_HXX
      21             : #define INCLUDED_DESKTOP_SOURCE_APP_CMDLINEARGS_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <vector>
      26             : 
      27             : #include <rtl/ustring.hxx>
      28             : #include <boost/noncopyable.hpp>
      29             : #include <boost/optional.hpp>
      30             : 
      31             : namespace desktop
      32             : {
      33             : 
      34         116 : class CommandLineArgs: private boost::noncopyable
      35             : {
      36             :     public:
      37         116 :         struct Supplier
      38             :         {
      39             :             // Thrown from constructors and next:
      40             :             class Exception {
      41             :             public:
      42             :                 Exception();
      43             :                 Exception(Exception const &);
      44             :                 virtual ~Exception();
      45             :                 Exception & operator =(Exception const &);
      46             :             };
      47             : 
      48             :             virtual ~Supplier();
      49             :             virtual boost::optional< OUString > getCwdUrl() = 0;
      50             :             virtual bool next(OUString * argument) = 0;
      51             :         };
      52             : 
      53             :         CommandLineArgs();
      54             :         CommandLineArgs( Supplier& supplier );
      55             : 
      56          64 :         boost::optional< OUString > getCwdUrl() const { return m_cwdUrl; }
      57             : 
      58             :         // Access to bool parameters
      59           0 :         bool                IsMinimized() const { return m_minimized;}
      60         486 :         bool                IsInvisible() const { return m_invisible;}
      61          64 :         bool                IsNoRestore() const { return m_norestore;}
      62           0 :         bool                IsNoDefault() const { return m_nodefault;}
      63         465 :         bool                IsHeadless() const { return m_headless;}
      64         127 :         bool                IsQuickstart() const { return m_quickstart;}
      65           0 :         bool                IsNoQuickstart() const { return m_noquickstart;}
      66         116 :         bool                IsTerminateAfterInit() const { return m_terminateafterinit;}
      67           0 :         bool                IsNoLogo() const { return m_nologo;}
      68           0 :         bool                IsNoLockcheck() const { return m_nolockcheck;}
      69         348 :         bool                IsHelp() const { return m_help;}
      70          64 :         bool                IsHelpWriter() const { return m_helpwriter;}
      71          64 :         bool                IsHelpCalc() const { return m_helpcalc;}
      72          64 :         bool                IsHelpDraw() const { return m_helpdraw;}
      73          64 :         bool                IsHelpImpress() const { return m_helpimpress;}
      74          64 :         bool                IsHelpBase() const { return m_helpbase;}
      75          64 :         bool                IsHelpMath() const { return m_helpmath;}
      76          64 :         bool                IsHelpBasic() const { return m_helpbasic;}
      77           0 :         bool                IsWriter() const { return m_writer;}
      78           0 :         bool                IsCalc() const { return m_calc;}
      79           0 :         bool                IsDraw() const { return m_draw;}
      80           0 :         bool                IsImpress() const { return m_impress;}
      81           0 :         bool                IsBase() const { return m_base;}
      82           0 :         bool                IsGlobal() const { return m_global;}
      83           0 :         bool                IsMath() const { return m_math;}
      84           0 :         bool                IsWeb() const { return m_web;}
      85         348 :         bool                IsVersion() const { return m_version;}
      86             :         bool                HasModuleParam() const;
      87          64 :         bool                WantsToLoadDocument() const { return m_bDocumentArgs;}
      88          64 :         bool                IsTextCat() const { return m_textcat;}
      89             : 
      90         348 :         OUString            GetUnknown() const { return m_unknown;}
      91             : 
      92             :         // Access to string parameters
      93           0 :         bool                    HasSplashPipe() const { return m_splashpipe;}
      94         116 :         std::vector< OUString > const & GetAccept() const { return m_accept;}
      95           0 :         std::vector< OUString > const & GetUnaccept() const { return m_unaccept;}
      96             :         std::vector< OUString > GetOpenList() const;
      97             :         std::vector< OUString > GetViewList() const;
      98             :         std::vector< OUString > GetStartList() const;
      99             :         std::vector< OUString > GetForceOpenList() const;
     100             :         std::vector< OUString > GetForceNewList() const;
     101             :         std::vector< OUString > GetPrintList() const;
     102             :         std::vector< OUString > GetPrintToList() const;
     103          64 :         OUString       GetPrinterName() const { return m_printername;}
     104         116 :         OUString       GetLanguage() const { return m_language;}
     105          64 :         std::vector< OUString > const & GetInFilter() const { return m_infilter;}
     106             :         std::vector< OUString > GetConversionList() const;
     107          64 :         OUString       GetConversionParams() const { return m_conversionparams;}
     108             :         OUString       GetConversionOut() const;
     109         232 :         OUString       GetPidfileName() const { return m_pidfile;}
     110             : 
     111             :         // Special analyzed states (does not match directly to a command line parameter!)
     112           0 :         bool IsEmpty() const { return m_bEmpty;}
     113             : 
     114         117 :         void setHeadless() { m_headless = true; m_invisible = true; }
     115             : 
     116             :     private:
     117             :         void                    ParseCommandLine_Impl( Supplier& supplier );
     118             :         void                    InitParamValues();
     119             : 
     120             :         boost::optional< OUString > m_cwdUrl;
     121             : 
     122             :         bool m_minimized;
     123             :         bool m_invisible;
     124             :         bool m_norestore;
     125             :         bool m_headless;
     126             :         bool m_quickstart;
     127             :         bool m_noquickstart;
     128             :         bool m_terminateafterinit;
     129             :         bool m_nologo;
     130             :         bool m_nolockcheck;
     131             :         bool m_nodefault;
     132             :         bool m_help;
     133             :         bool m_writer;
     134             :         bool m_calc;
     135             :         bool m_draw;
     136             :         bool m_impress;
     137             :         bool m_global;
     138             :         bool m_math;
     139             :         bool m_web;
     140             :         bool m_base;
     141             :         bool m_helpwriter;
     142             :         bool m_helpcalc;
     143             :         bool m_helpdraw;
     144             :         bool m_helpbasic;
     145             :         bool m_helpmath;
     146             :         bool m_helpimpress;
     147             :         bool m_helpbase;
     148             :         bool m_version;
     149             :         bool m_splashpipe;
     150             :         bool m_textcat;
     151             : 
     152             :         OUString m_unknown;
     153             : 
     154             :         bool m_bEmpty; // No Args at all
     155             :         bool m_bDocumentArgs; // A document creation/open/load arg is used
     156             :         std::vector< OUString > m_accept;
     157             :         std::vector< OUString > m_unaccept;
     158             :         std::vector< OUString > m_openlist; // contains external URIs
     159             :         std::vector< OUString > m_viewlist; // contains external URIs
     160             :         std::vector< OUString > m_startlist; // contains external URIs
     161             :         std::vector< OUString > m_forceopenlist; // contains external URIs
     162             :         std::vector< OUString > m_forcenewlist; // contains external URIs
     163             :         std::vector< OUString > m_printlist; // contains external URIs
     164             :         std::vector< OUString > m_printtolist; // contains external URIs
     165             :         OUString m_printername;
     166             :         std::vector< OUString > m_conversionlist; // contains external URIs
     167             :         OUString m_conversionparams;
     168             :         OUString m_conversionout; // contains external URIs
     169             :         std::vector< OUString > m_infilter;
     170             :         OUString m_language;
     171             :         OUString m_pidfile;
     172             : };
     173             : 
     174             : }
     175             : 
     176             : #endif
     177             : 
     178             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11