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

Generated by: LCOV version 1.10