xref: /aosp_15_r20/external/jsilver/src/org/clearsilver/CS.java (revision 650b9f7487be23191c9a5c1efcd9aa92af8ddcb8)
1*650b9f74SAndroid Build Coastguard Worker /*
2*650b9f74SAndroid Build Coastguard Worker  * Copyright (C) 2010 Google Inc.
3*650b9f74SAndroid Build Coastguard Worker  *
4*650b9f74SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*650b9f74SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*650b9f74SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*650b9f74SAndroid Build Coastguard Worker  *
8*650b9f74SAndroid Build Coastguard Worker  * http://www.apache.org/licenses/LICENSE-2.0
9*650b9f74SAndroid Build Coastguard Worker  *
10*650b9f74SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*650b9f74SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*650b9f74SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*650b9f74SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*650b9f74SAndroid Build Coastguard Worker  * limitations under the License.
15*650b9f74SAndroid Build Coastguard Worker  */
16*650b9f74SAndroid Build Coastguard Worker 
17*650b9f74SAndroid Build Coastguard Worker package org.clearsilver;
18*650b9f74SAndroid Build Coastguard Worker 
19*650b9f74SAndroid Build Coastguard Worker import java.io.Closeable;
20*650b9f74SAndroid Build Coastguard Worker import java.io.IOException;
21*650b9f74SAndroid Build Coastguard Worker 
22*650b9f74SAndroid Build Coastguard Worker public interface CS extends Closeable {
23*650b9f74SAndroid Build Coastguard Worker 
24*650b9f74SAndroid Build Coastguard Worker   /**
25*650b9f74SAndroid Build Coastguard Worker    * Specify a new/different global HDF
26*650b9f74SAndroid Build Coastguard Worker    */
setGlobalHDF(HDF global)27*650b9f74SAndroid Build Coastguard Worker   void setGlobalHDF(HDF global);
28*650b9f74SAndroid Build Coastguard Worker 
29*650b9f74SAndroid Build Coastguard Worker   /**
30*650b9f74SAndroid Build Coastguard Worker    * Return global hdf in use
31*650b9f74SAndroid Build Coastguard Worker    */
getGlobalHDF()32*650b9f74SAndroid Build Coastguard Worker   HDF getGlobalHDF();
33*650b9f74SAndroid Build Coastguard Worker 
34*650b9f74SAndroid Build Coastguard Worker   /**
35*650b9f74SAndroid Build Coastguard Worker    * Clean up CS object state.
36*650b9f74SAndroid Build Coastguard Worker    */
close()37*650b9f74SAndroid Build Coastguard Worker   void close();
38*650b9f74SAndroid Build Coastguard Worker 
39*650b9f74SAndroid Build Coastguard Worker   /**
40*650b9f74SAndroid Build Coastguard Worker    * Parses the specified file as if it has template content. The file will
41*650b9f74SAndroid Build Coastguard Worker    * be located using the HDF's loadpaths.
42*650b9f74SAndroid Build Coastguard Worker    * @param filename the name of file to read in and parse.
43*650b9f74SAndroid Build Coastguard Worker    * @throws java.io.FileNotFoundException if the specified file does not
44*650b9f74SAndroid Build Coastguard Worker    * exist.
45*650b9f74SAndroid Build Coastguard Worker    * @throws IOException other problems reading the file.
46*650b9f74SAndroid Build Coastguard Worker    */
parseFile(String filename)47*650b9f74SAndroid Build Coastguard Worker   void parseFile(String filename) throws IOException;
48*650b9f74SAndroid Build Coastguard Worker 
49*650b9f74SAndroid Build Coastguard Worker   /**
50*650b9f74SAndroid Build Coastguard Worker    * Parse the given string as a CS template.
51*650b9f74SAndroid Build Coastguard Worker    * @param content string to parse.
52*650b9f74SAndroid Build Coastguard Worker    */
parseStr(String content)53*650b9f74SAndroid Build Coastguard Worker   void parseStr(String content);
54*650b9f74SAndroid Build Coastguard Worker 
55*650b9f74SAndroid Build Coastguard Worker   /**
56*650b9f74SAndroid Build Coastguard Worker    * Generate output from the CS templates and HDF objects that have been read
57*650b9f74SAndroid Build Coastguard Worker    * in.
58*650b9f74SAndroid Build Coastguard Worker    * @return the output of the template rendering.
59*650b9f74SAndroid Build Coastguard Worker    */
render()60*650b9f74SAndroid Build Coastguard Worker   String render();
61*650b9f74SAndroid Build Coastguard Worker 
62*650b9f74SAndroid Build Coastguard Worker   /**
63*650b9f74SAndroid Build Coastguard Worker    * Get the file loader in use, if any.
64*650b9f74SAndroid Build Coastguard Worker    * @return the file loader in use.
65*650b9f74SAndroid Build Coastguard Worker    */
getFileLoader()66*650b9f74SAndroid Build Coastguard Worker   CSFileLoader getFileLoader();
67*650b9f74SAndroid Build Coastguard Worker 
68*650b9f74SAndroid Build Coastguard Worker   /**
69*650b9f74SAndroid Build Coastguard Worker    * Set the CS file loader to use
70*650b9f74SAndroid Build Coastguard Worker    * @param fileLoader the file loader that should be used.
71*650b9f74SAndroid Build Coastguard Worker    */
setFileLoader(CSFileLoader fileLoader)72*650b9f74SAndroid Build Coastguard Worker   void setFileLoader(CSFileLoader fileLoader);
73*650b9f74SAndroid Build Coastguard Worker 
74*650b9f74SAndroid Build Coastguard Worker }
75