1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef __FRAMEWORK_JOBS_JOBURL_HXX_ 25*b1cdbd2cSJim Jagielski #define __FRAMEWORK_JOBS_JOBURL_HXX_ 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski //_______________________________________ 28*b1cdbd2cSJim Jagielski // my own includes 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski #include <threadhelp/threadhelpbase.hxx> 31*b1cdbd2cSJim Jagielski #include <macros/debug.hxx> 32*b1cdbd2cSJim Jagielski #include <stdtypes.h> 33*b1cdbd2cSJim Jagielski #include <general.h> 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski //_______________________________________ 36*b1cdbd2cSJim Jagielski // interface includes 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski //_______________________________________ 39*b1cdbd2cSJim Jagielski // other includes 40*b1cdbd2cSJim Jagielski #include <rtl/ustring.hxx> 41*b1cdbd2cSJim Jagielski 42*b1cdbd2cSJim Jagielski //_______________________________________ 43*b1cdbd2cSJim Jagielski // namespace 44*b1cdbd2cSJim Jagielski 45*b1cdbd2cSJim Jagielski namespace framework{ 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski //_______________________________________ 48*b1cdbd2cSJim Jagielski // const 49*b1cdbd2cSJim Jagielski 50*b1cdbd2cSJim Jagielski #define JOBURL_PROTOCOL_STR "vnd.sun.star.job:" 51*b1cdbd2cSJim Jagielski #define JOBURL_PROTOCOL_LEN 17 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski #define JOBURL_EVENT_STR "event=" 54*b1cdbd2cSJim Jagielski #define JOBURL_EVENT_LEN 6 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski #define JOBURL_ALIAS_STR "alias=" 57*b1cdbd2cSJim Jagielski #define JOBURL_ALIAS_LEN 6 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski #define JOBURL_SERVICE_STR "service=" 60*b1cdbd2cSJim Jagielski #define JOBURL_SERVICE_LEN 8 61*b1cdbd2cSJim Jagielski 62*b1cdbd2cSJim Jagielski #define JOBURL_PART_SEPERATOR ';' 63*b1cdbd2cSJim Jagielski #define JOBURL_PARTARGS_SEPERATOR ',' 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski //_______________________________________ 66*b1cdbd2cSJim Jagielski /** 67*b1cdbd2cSJim Jagielski @short can be used to parse, validate and work with job URL's 68*b1cdbd2cSJim Jagielski @descr Job URLs are specified by the following syntax: 69*b1cdbd2cSJim Jagielski vnd.sun.star.job:{[event=<name>]|[alias=<name>]|[service=<name>]} 70*b1cdbd2cSJim Jagielski This class can analyze this structure and seperate it into his different parts. 71*b1cdbd2cSJim Jagielski After doing that these parts are accessible by the methods of this class. 72*b1cdbd2cSJim Jagielski */ 73*b1cdbd2cSJim Jagielski class JobURL : private ThreadHelpBase 74*b1cdbd2cSJim Jagielski { 75*b1cdbd2cSJim Jagielski //___________________________________ 76*b1cdbd2cSJim Jagielski // types 77*b1cdbd2cSJim Jagielski 78*b1cdbd2cSJim Jagielski private: 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski /** 81*b1cdbd2cSJim Jagielski possible states of a job URL 82*b1cdbd2cSJim Jagielski Note: These values are used in combination. So they must be 83*b1cdbd2cSJim Jagielski values in form 2^n. 84*b1cdbd2cSJim Jagielski */ 85*b1cdbd2cSJim Jagielski enum ERequest 86*b1cdbd2cSJim Jagielski { 87*b1cdbd2cSJim Jagielski /// mark a job URL as not valid 88*b1cdbd2cSJim Jagielski E_UNKNOWN = 0, 89*b1cdbd2cSJim Jagielski /// it's an event 90*b1cdbd2cSJim Jagielski E_EVENT = 1, 91*b1cdbd2cSJim Jagielski /// it's an alias 92*b1cdbd2cSJim Jagielski E_ALIAS = 2, 93*b1cdbd2cSJim Jagielski /// it's a service 94*b1cdbd2cSJim Jagielski E_SERVICE = 4 95*b1cdbd2cSJim Jagielski }; 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski //___________________________________ 98*b1cdbd2cSJim Jagielski // types 99*b1cdbd2cSJim Jagielski 100*b1cdbd2cSJim Jagielski private: 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski /** knows the state of this URL instance */ 103*b1cdbd2cSJim Jagielski sal_uInt32 m_eRequest; 104*b1cdbd2cSJim Jagielski 105*b1cdbd2cSJim Jagielski /** holds the event part of a job URL */ 106*b1cdbd2cSJim Jagielski ::rtl::OUString m_sEvent; 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski /** holds the alias part of a job URL */ 109*b1cdbd2cSJim Jagielski ::rtl::OUString m_sAlias; 110*b1cdbd2cSJim Jagielski 111*b1cdbd2cSJim Jagielski /** holds the service part of a job URL */ 112*b1cdbd2cSJim Jagielski ::rtl::OUString m_sService; 113*b1cdbd2cSJim Jagielski 114*b1cdbd2cSJim Jagielski /** holds the event arguments */ 115*b1cdbd2cSJim Jagielski ::rtl::OUString m_sEventArgs; 116*b1cdbd2cSJim Jagielski 117*b1cdbd2cSJim Jagielski /** holds the alias arguments */ 118*b1cdbd2cSJim Jagielski ::rtl::OUString m_sAliasArgs; 119*b1cdbd2cSJim Jagielski 120*b1cdbd2cSJim Jagielski /** holds the service arguments */ 121*b1cdbd2cSJim Jagielski ::rtl::OUString m_sServiceArgs; 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski //___________________________________ 124*b1cdbd2cSJim Jagielski // native interface 125*b1cdbd2cSJim Jagielski 126*b1cdbd2cSJim Jagielski public: 127*b1cdbd2cSJim Jagielski 128*b1cdbd2cSJim Jagielski JobURL ( const ::rtl::OUString& sURL ); 129*b1cdbd2cSJim Jagielski sal_Bool isValid ( ) const; 130*b1cdbd2cSJim Jagielski sal_Bool getEvent ( ::rtl::OUString& sEvent ) const; 131*b1cdbd2cSJim Jagielski sal_Bool getAlias ( ::rtl::OUString& sAlias ) const; 132*b1cdbd2cSJim Jagielski sal_Bool getService ( ::rtl::OUString& sService ) const; 133*b1cdbd2cSJim Jagielski 134*b1cdbd2cSJim Jagielski //___________________________________ 135*b1cdbd2cSJim Jagielski // private helper 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski private: 138*b1cdbd2cSJim Jagielski 139*b1cdbd2cSJim Jagielski static sal_Bool implst_split( const ::rtl::OUString& sPart , 140*b1cdbd2cSJim Jagielski const sal_Char* pPartIdentifier , 141*b1cdbd2cSJim Jagielski sal_Int32 nPartLength , 142*b1cdbd2cSJim Jagielski ::rtl::OUString& rPartValue , 143*b1cdbd2cSJim Jagielski ::rtl::OUString& rPartArguments ); 144*b1cdbd2cSJim Jagielski 145*b1cdbd2cSJim Jagielski //___________________________________ 146*b1cdbd2cSJim Jagielski // debug methods! 147*b1cdbd2cSJim Jagielski 148*b1cdbd2cSJim Jagielski #ifdef ENABLE_COMPONENT_SELF_CHECK 149*b1cdbd2cSJim Jagielski 150*b1cdbd2cSJim Jagielski public: 151*b1cdbd2cSJim Jagielski static void impldbg_checkIt(); 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski private: 154*b1cdbd2cSJim Jagielski static void impldbg_checkURL( const sal_Char* pURL , 155*b1cdbd2cSJim Jagielski sal_uInt32 eExpectedPart , 156*b1cdbd2cSJim Jagielski const sal_Char* pExpectedEvent , 157*b1cdbd2cSJim Jagielski const sal_Char* pExpectedAlias , 158*b1cdbd2cSJim Jagielski const sal_Char* pExpectedService , 159*b1cdbd2cSJim Jagielski const sal_Char* pExpectedEventArgs , 160*b1cdbd2cSJim Jagielski const sal_Char* pExpectedAliasArgs , 161*b1cdbd2cSJim Jagielski const sal_Char* pExpectedServiceArgs ); 162*b1cdbd2cSJim Jagielski ::rtl::OUString impldbg_toString() const; 163*b1cdbd2cSJim Jagielski 164*b1cdbd2cSJim Jagielski sal_Bool getServiceArgs( ::rtl::OUString& sServiceArgs ) const; 165*b1cdbd2cSJim Jagielski sal_Bool getEventArgs ( ::rtl::OUString& sEventArgs ) const; 166*b1cdbd2cSJim Jagielski sal_Bool getAliasArgs ( ::rtl::OUString& sAliasArgs ) const; 167*b1cdbd2cSJim Jagielski 168*b1cdbd2cSJim Jagielski #endif // ENABLE_COMPONENT_SELF_CHECK 169*b1cdbd2cSJim Jagielski }; 170*b1cdbd2cSJim Jagielski 171*b1cdbd2cSJim Jagielski } // namespace framework 172*b1cdbd2cSJim Jagielski 173*b1cdbd2cSJim Jagielski #endif // __FRAMEWORK_JOBS_JOBURL_HXX_ 174