update credits
[LibreOffice.git] / framework / inc / jobs / joburl.hxx
blobcfc91589c4dc35fe3d7a03e1ae76470454864070
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef __FRAMEWORK_JOBS_JOBURL_HXX_
21 #define __FRAMEWORK_JOBS_JOBURL_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/debug.hxx>
25 #include <stdtypes.h>
26 #include <general.h>
28 #include <rtl/ustring.hxx>
31 namespace framework{
34 #define JOBURL_PROTOCOL_STR "vnd.sun.star.job:"
35 #define JOBURL_PROTOCOL_LEN 17
37 #define JOBURL_EVENT_STR "event="
38 #define JOBURL_EVENT_LEN 6
40 #define JOBURL_ALIAS_STR "alias="
41 #define JOBURL_ALIAS_LEN 6
43 #define JOBURL_SERVICE_STR "service="
44 #define JOBURL_SERVICE_LEN 8
46 #define JOBURL_PART_SEPARATOR ';'
47 #define JOBURL_PARTARGS_SEPARATOR ','
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 separate it into his different parts.
55 After doing that these parts are accessible by the methods of this class.
57 class JobURL : private ThreadHelpBase
59 //___________________________________
60 // types
62 private:
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.
69 enum ERequest
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
81 //___________________________________
82 // types
84 private:
86 /** knows the state of this URL instance */
87 sal_uInt32 m_eRequest;
89 /** holds the event part of a job URL */
90 OUString m_sEvent;
92 /** holds the alias part of a job URL */
93 OUString m_sAlias;
95 /** holds the service part of a job URL */
96 OUString m_sService;
98 /** holds the event arguments */
99 OUString m_sEventArgs;
101 /** holds the alias arguments */
102 OUString m_sAliasArgs;
104 /** holds the service arguments */
105 OUString m_sServiceArgs;
107 //___________________________________
108 // native interface
110 public:
112 JobURL ( const OUString& sURL );
113 sal_Bool isValid ( ) const;
114 sal_Bool getEvent ( OUString& sEvent ) const;
115 sal_Bool getAlias ( OUString& sAlias ) const;
116 sal_Bool getService ( OUString& sService ) const;
118 //___________________________________
119 // private helper
121 private:
123 static sal_Bool implst_split( const OUString& sPart ,
124 const sal_Char* pPartIdentifier ,
125 sal_Int32 nPartLength ,
126 OUString& rPartValue ,
127 OUString& rPartArguments );
129 //___________________________________
130 // debug methods!
132 #ifdef ENABLE_COMPONENT_SELF_CHECK
134 public:
135 static void impldbg_checkIt();
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 OUString impldbg_toString() const;
148 sal_Bool getServiceArgs( OUString& sServiceArgs ) const;
149 sal_Bool getEventArgs ( OUString& sEventArgs ) const;
150 sal_Bool getAliasArgs ( OUString& sAliasArgs ) const;
152 #endif // ENABLE_COMPONENT_SELF_CHECK
155 } // namespace framework
157 #endif // __FRAMEWORK_JOBS_JOBURL_HXX_
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */