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         throw ( css::lang::IllegalArgumentException );
53     virtual ~ScriptURI()  SAL_THROW ( () );
54 
55     /**
56      *  This function returns the location of the script
57      *
58      */
59     virtual ::rtl::OUString  getLocation();
60 
61     /**
62      *  This function returns the language of the script, eg. java,
63      *  StarBasic,...
64      *
65      */
66     virtual ::rtl::OUString  getLanguage();
67 
68     /**
69      *  This function returns the language dependent function name of
70      *  the script
71      */
72     virtual ::rtl::OUString  getFunctionName();
73 
74     /**
75      *  This function returns the language independent logical name of
76      *  the script
77      */
78     virtual ::rtl::OUString  getLogicalName();
79 
80     /**
81      *  This function returns the full URI
82      *
83      */
84     virtual ::rtl::OUString  getURI();
85 
86 private:
87     ::osl::Mutex m_mutex;
88 
89     /** @internal */
90     sal_Bool m_valid;
91 
92     //the private strings
93     /** the string representation of the this objects URI */
94     ::rtl::OUString m_uri;
95     /** the location of the script referred to by this URI */
96     ::rtl::OUString m_location;
97     /** the language of the script referred to by this URI */
98     ::rtl::OUString m_language;
99     /** the language dependent function name of the script referred to by this URI */
100     ::rtl::OUString m_functionName;
101     /** the language independent logical name of the script referred to by this URI */
102     ::rtl::OUString m_logicalName;
103 
104     //attempt to parse the URI provided
105     /** @internal */
106     Uri parseIt();
107     //set the members
108     /** @internal */
109     void set_values( Uri );
110     bool isValid();
111 }
112 ; // class ScriptURI
113 
114 } //namespace script_uri
115 
116 #endif // define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
117