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