LCOV - code coverage report
Current view: top level - framework/inc/jobs - joburl.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.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             : #ifndef INCLUDED_FRAMEWORK_INC_JOBS_JOBURL_HXX
      21             : #define INCLUDED_FRAMEWORK_INC_JOBS_JOBURL_HXX
      22             : 
      23             : #include <stdtypes.h>
      24             : #include <general.h>
      25             : 
      26             : #include <rtl/ustring.hxx>
      27             : 
      28             : namespace framework{
      29             : 
      30             : #define JOBURL_PROTOCOL_STR        "vnd.sun.star.job:"
      31             : #define JOBURL_PROTOCOL_LEN        17
      32             : 
      33             : #define JOBURL_EVENT_STR           "event="
      34             : #define JOBURL_EVENT_LEN           6
      35             : 
      36             : #define JOBURL_ALIAS_STR           "alias="
      37             : #define JOBURL_ALIAS_LEN           6
      38             : 
      39             : #define JOBURL_SERVICE_STR         "service="
      40             : #define JOBURL_SERVICE_LEN         8
      41             : 
      42             : #define JOBURL_PART_SEPARATOR      ';'
      43             : #define JOBURL_PARTARGS_SEPARATOR  ','
      44             : 
      45             : /**
      46             :     @short  can be used to parse, validate and work with job URL's
      47             :     @descr  Job URLs are specified by the following syntax:
      48             :                 vnd.sun.star.job:{[event=<name>]|[alias=<name>]|[service=<name>]}
      49             :             This class can analyze this structure and separate it into his different parts.
      50             :             After doing that these parts are accessible by the methods of this class.
      51             :  */
      52           0 : class JobURL
      53             : {
      54             : 
      55             :     // types
      56             : 
      57             :     private:
      58             : 
      59             :         /**
      60             :             possible states of a job URL
      61             :             Note: These values are used in combination. So they must be
      62             :             values in form 2^n.
      63             :          */
      64             :         enum ERequest
      65             :         {
      66             :             /// mark a job URL as not valid
      67             :             E_UNKNOWN = 0,
      68             :             /// it's an event
      69             :             E_EVENT   = 1,
      70             :             /// it's an alias
      71             :             E_ALIAS   = 2,
      72             :             /// it's a service
      73             :             E_SERVICE = 4
      74             :         };
      75             : 
      76             :     // types
      77             : 
      78             :     private:
      79             : 
      80             :         /** knows the state of this URL instance */
      81             :         sal_uInt32 m_eRequest;
      82             : 
      83             :         /** holds the event part of a job URL */
      84             :         OUString m_sEvent;
      85             : 
      86             :         /** holds the alias part of a job URL */
      87             :         OUString m_sAlias;
      88             : 
      89             :         /** holds the service part of a job URL */
      90             :         OUString m_sService;
      91             : 
      92             :         /** holds the event arguments */
      93             :         OUString m_sEventArgs;
      94             : 
      95             :         /** holds the alias arguments */
      96             :         OUString m_sAliasArgs;
      97             : 
      98             :         /** holds the service arguments */
      99             :         OUString m_sServiceArgs;
     100             : 
     101             :     // native interface
     102             : 
     103             :     public:
     104             : 
     105             :                  JobURL        ( const OUString& sURL         );
     106             :         bool isValid       (                                     ) const;
     107             :         bool getEvent      (       OUString& sEvent       ) const;
     108             :         bool getAlias      (       OUString& sAlias       ) const;
     109             :         bool getService    (       OUString& sService     ) const;
     110             : 
     111             :     // private helper
     112             : 
     113             :     private:
     114             : 
     115             :         static bool implst_split( const OUString& sPart           ,
     116             :                                       const sal_Char*        pPartIdentifier ,
     117             :                                             sal_Int32        nPartLength     ,
     118             :                                             OUString& rPartValue      ,
     119             :                                             OUString& rPartArguments  );
     120             : 
     121             :     // debug methods!
     122             : 
     123             :     #ifdef ENABLE_COMPONENT_SELF_CHECK
     124             : 
     125             :     public:
     126             :         static void impldbg_checkIt();
     127             : 
     128             :     private:
     129             :         static void impldbg_checkURL( const sal_Char*  pURL                 ,
     130             :                                             sal_uInt32 eExpectedPart        ,
     131             :                                       const sal_Char*  pExpectedEvent       ,
     132             :                                       const sal_Char*  pExpectedAlias       ,
     133             :                                       const sal_Char*  pExpectedService     ,
     134             :                                       const sal_Char*  pExpectedEventArgs   ,
     135             :                                       const sal_Char*  pExpectedAliasArgs   ,
     136             :                                       const sal_Char*  pExpectedServiceArgs );
     137             :         OUString impldbg_toString() const;
     138             : 
     139             :         sal_Bool getServiceArgs(       OUString& sServiceArgs ) const;
     140             :         sal_Bool getEventArgs  (       OUString& sEventArgs   ) const;
     141             :         sal_Bool getAliasArgs  (       OUString& sAliasArgs   ) const;
     142             : 
     143             :     #endif // ENABLE_COMPONENT_SELF_CHECK
     144             : };
     145             : 
     146             : } // namespace framework
     147             : 
     148             : #endif // INCLUDED_FRAMEWORK_INC_JOBS_JOBURL_HXX
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10