1*6998d047SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6998d047SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6998d047SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6998d047SAndrew Rist  * distributed with this work for additional information
6*6998d047SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6998d047SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6998d047SAndrew Rist  * "License"); you may not use this file except in compliance
9*6998d047SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6998d047SAndrew Rist  *
11*6998d047SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6998d047SAndrew Rist  *
13*6998d047SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6998d047SAndrew Rist  * software distributed under the License is distributed on an
15*6998d047SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6998d047SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6998d047SAndrew Rist  * specific language governing permissions and limitations
18*6998d047SAndrew Rist  * under the License.
19*6998d047SAndrew Rist  *
20*6998d047SAndrew Rist  *************************************************************/
21*6998d047SAndrew Rist 
22*6998d047SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <osl/mutex.hxx>
28cdf0e10cSrcweir #include <rtl/ustring>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace scripting_impl {
33cdf0e10cSrcweir // for simplification
34cdf0e10cSrcweir #define css ::com::sun::star
35cdf0e10cSrcweir #define dcsssf ::drafts::com::sun::star::script::framework
36cdf0e10cSrcweir 
37cdf0e10cSrcweir struct Uri {
38cdf0e10cSrcweir     bool valid;
39cdf0e10cSrcweir     ::rtl::OUString uri;
40cdf0e10cSrcweir     ::rtl::OUString location;
41cdf0e10cSrcweir     ::rtl::OUString language;
42cdf0e10cSrcweir     ::rtl::OUString functionName;
43cdf0e10cSrcweir     ::rtl::OUString logicalName;
44cdf0e10cSrcweir };
45cdf0e10cSrcweir /**
46cdf0e10cSrcweir  * Helper class for dealing with script URIs.
47cdf0e10cSrcweir  */
48cdf0e10cSrcweir class ScriptURI
49cdf0e10cSrcweir {
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir     ScriptURI( const ::rtl::OUString& scriptURI )
52cdf0e10cSrcweir         throw ( css::lang::IllegalArgumentException );
53cdf0e10cSrcweir     virtual ~ScriptURI()  SAL_THROW ( () );
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     /**
56cdf0e10cSrcweir      *  This function returns the location of the script
57cdf0e10cSrcweir      *
58cdf0e10cSrcweir      */
59cdf0e10cSrcweir     virtual ::rtl::OUString  getLocation();
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     /**
62cdf0e10cSrcweir      *  This function returns the language of the script, eg. java,
63cdf0e10cSrcweir      *  StarBasic,...
64cdf0e10cSrcweir      *
65cdf0e10cSrcweir      */
66cdf0e10cSrcweir     virtual ::rtl::OUString  getLanguage();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     /**
69cdf0e10cSrcweir      *  This function returns the language dependent function name of
70cdf0e10cSrcweir      *  the script
71cdf0e10cSrcweir      */
72cdf0e10cSrcweir     virtual ::rtl::OUString  getFunctionName();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     /**
75cdf0e10cSrcweir      *  This function returns the language independent logical name of
76cdf0e10cSrcweir      *  the script
77cdf0e10cSrcweir      */
78cdf0e10cSrcweir     virtual ::rtl::OUString  getLogicalName();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     /**
81cdf0e10cSrcweir      *  This function returns the full URI
82cdf0e10cSrcweir      *
83cdf0e10cSrcweir      */
84cdf0e10cSrcweir     virtual ::rtl::OUString  getURI();
85cdf0e10cSrcweir 
86cdf0e10cSrcweir private:
87cdf0e10cSrcweir     ::osl::Mutex m_mutex;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     /** @internal */
90cdf0e10cSrcweir     sal_Bool m_valid;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     //the private strings
93cdf0e10cSrcweir     /** the string representation of the this objects URI */
94cdf0e10cSrcweir     ::rtl::OUString m_uri;
95cdf0e10cSrcweir     /** the location of the script referred to by this URI */
96cdf0e10cSrcweir     ::rtl::OUString m_location;
97cdf0e10cSrcweir     /** the language of the script referred to by this URI */
98cdf0e10cSrcweir     ::rtl::OUString m_language;
99cdf0e10cSrcweir     /** the language dependent function name of the script referred to by this URI */
100cdf0e10cSrcweir     ::rtl::OUString m_functionName;
101cdf0e10cSrcweir     /** the language independent logical name of the script referred to by this URI */
102cdf0e10cSrcweir     ::rtl::OUString m_logicalName;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     //attempt to parse the URI provided
105cdf0e10cSrcweir     /** @internal */
106cdf0e10cSrcweir     Uri parseIt();
107cdf0e10cSrcweir     //set the members
108cdf0e10cSrcweir     /** @internal */
109cdf0e10cSrcweir     void set_values( Uri );
110cdf0e10cSrcweir     bool isValid();
111cdf0e10cSrcweir }
112cdf0e10cSrcweir ; // class ScriptURI
113cdf0e10cSrcweir 
114cdf0e10cSrcweir } //namespace script_uri
115cdf0e10cSrcweir 
116cdf0e10cSrcweir #endif // define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
117