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