update dev300-m58
[ooovba.git] / framework / inc / jobs / joburl.hxx
blob4a34b6f49d7721d03c36fa4fb71de13d8b63afd2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: joburl.hxx,v $
10 * $Revision: 1.4.82.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_JOBS_JOBURL_HXX_
32 #define __FRAMEWORK_JOBS_JOBURL_HXX_
34 //_______________________________________
35 // my own includes
37 #include <threadhelp/threadhelpbase.hxx>
38 #include <macros/debug.hxx>
39 #include <stdtypes.h>
40 #include <general.h>
42 //_______________________________________
43 // interface includes
45 //_______________________________________
46 // other includes
47 #include <rtl/ustring.hxx>
49 //_______________________________________
50 // namespace
52 namespace framework{
54 //_______________________________________
55 // const
57 #define JOBURL_PROTOCOL_STR "vnd.sun.star.job:"
58 #define JOBURL_PROTOCOL_LEN 17
60 #define JOBURL_EVENT_STR "event="
61 #define JOBURL_EVENT_LEN 6
63 #define JOBURL_ALIAS_STR "alias="
64 #define JOBURL_ALIAS_LEN 6
66 #define JOBURL_SERVICE_STR "service="
67 #define JOBURL_SERVICE_LEN 8
69 #define JOBURL_PART_SEPERATOR ';'
70 #define JOBURL_PARTARGS_SEPERATOR ','
72 //_______________________________________
73 /**
74 @short can be used to parse, validate and work with job URL's
75 @descr Job URLs are specified by the following syntax:
76 vnd.sun.star.job:{[event=<name>]|[alias=<name>]|[service=<name>]}
77 This class can analyze this structure and seperate it into his different parts.
78 After doing that these parts are accessible by the methods of this class.
80 class JobURL : private ThreadHelpBase
82 //___________________________________
83 // types
85 private:
87 /**
88 possible states of a job URL
89 Note: These values are used in combination. So they must be
90 values in form 2^n.
92 enum ERequest
94 /// mark a job URL as not valid
95 E_UNKNOWN = 0,
96 /// it's an event
97 E_EVENT = 1,
98 /// it's an alias
99 E_ALIAS = 2,
100 /// it's a service
101 E_SERVICE = 4
104 //___________________________________
105 // types
107 private:
109 /** knows the state of this URL instance */
110 sal_uInt32 m_eRequest;
112 /** holds the event part of a job URL */
113 ::rtl::OUString m_sEvent;
115 /** holds the alias part of a job URL */
116 ::rtl::OUString m_sAlias;
118 /** holds the service part of a job URL */
119 ::rtl::OUString m_sService;
121 /** holds the event arguments */
122 ::rtl::OUString m_sEventArgs;
124 /** holds the alias arguments */
125 ::rtl::OUString m_sAliasArgs;
127 /** holds the service arguments */
128 ::rtl::OUString m_sServiceArgs;
130 //___________________________________
131 // native interface
133 public:
135 JobURL ( const ::rtl::OUString& sURL );
136 sal_Bool isValid ( ) const;
137 sal_Bool getEvent ( ::rtl::OUString& sEvent ) const;
138 sal_Bool getAlias ( ::rtl::OUString& sAlias ) const;
139 sal_Bool getService ( ::rtl::OUString& sService ) const;
141 //___________________________________
142 // private helper
144 private:
146 static sal_Bool implst_split( const ::rtl::OUString& sPart ,
147 const sal_Char* pPartIdentifier ,
148 sal_Int32 nPartLength ,
149 ::rtl::OUString& rPartValue ,
150 ::rtl::OUString& rPartArguments );
152 //___________________________________
153 // debug methods!
155 #ifdef ENABLE_COMPONENT_SELF_CHECK
157 public:
158 static void impldbg_checkIt();
160 private:
161 static void impldbg_checkURL( const sal_Char* pURL ,
162 sal_uInt32 eExpectedPart ,
163 const sal_Char* pExpectedEvent ,
164 const sal_Char* pExpectedAlias ,
165 const sal_Char* pExpectedService ,
166 const sal_Char* pExpectedEventArgs ,
167 const sal_Char* pExpectedAliasArgs ,
168 const sal_Char* pExpectedServiceArgs );
169 ::rtl::OUString impldbg_toString() const;
171 sal_Bool getServiceArgs( ::rtl::OUString& sServiceArgs ) const;
172 sal_Bool getEventArgs ( ::rtl::OUString& sEventArgs ) const;
173 sal_Bool getAliasArgs ( ::rtl::OUString& sAliasArgs ) const;
175 #endif // ENABLE_COMPONENT_SELF_CHECK
178 } // namespace framework
180 #endif // __FRAMEWORK_JOBS_JOBURL_HXX_