Add title in index pages, add reference in story
[gofetch.git] / src / be / nikiroo / gofetch / output / Output.java
1 package be.nikiroo.gofetch.output;
2
3 import be.nikiroo.gofetch.data.Story;
4 import be.nikiroo.gofetch.support.BasicSupport;
5 import be.nikiroo.gofetch.support.Type;
6
7 /**
8 * Base class for output operations.
9 *
10 * @author niki
11 */
12 public abstract class Output {
13 /**
14 * The type of source, can be NULL for no-type.
15 */
16 protected Type type;
17
18 /**
19 * The gopher hostname to use.
20 */
21 protected String hostname;
22
23 /**
24 * The sub directory and (pre-)selector to use for the resources.
25 */
26 protected String preselector;
27
28 /**
29 * The Gopher port to use.
30 */
31 protected int port;
32
33 /**
34 * Create a new {@link Output} class for the given type (which can be NULL).
35 *
36 * @param type
37 * the type or NULL for no type
38 * @param hostname
39 * the gopher hostname to use
40 * @param preselector
41 * the sub directory and (pre-)selector to use for the resources
42 * @param port
43 * the Gopher port to use
44 */
45 public Output(Type type, String hostname, String preselector, int port) {
46 this.type = type;
47 this.hostname = hostname;
48 this.preselector = preselector;
49 this.port = port;
50 }
51
52 /**
53 * Get the header to use in the main index file (the one which will
54 * reference all the supported web sites <tt>index</tt> files).
55 *
56 * @return the header
57 */
58 abstract public String getMainIndexHeader();
59
60 /**
61 * Get the footer to use in the index file (the one which will reference all
62 * the supported web sites <tt>index</tt> files).
63 *
64 * @return the footer
65 */
66 abstract public String getMainIndexFooter();
67
68 /**
69 * Get the header to use in the index file (the supported web site
70 * <tt>index</tt> file this output is for).
71 *
72 * @param support
73 * the supported web site
74 *
75 * @return the header
76 */
77 abstract public String getIndexHeader(BasicSupport support);
78
79 /**
80 * Get the footer to use in the index file (the supported web site
81 * <tt>index</tt> file this output is for).
82 *
83 * @param support
84 * the supported web site
85 *
86 * @return the footer
87 */
88 abstract public String getIndexFooter(BasicSupport support);
89
90 /**
91 * Export the header of a story (a <i>resume</i> mode).
92 *
93 * @param story
94 * the story
95 *
96 * @return the resume
97 */
98 abstract public String exportHeader(Story story);
99
100 /**
101 * Export a full story with comments.
102 *
103 * @param story
104 * the story
105 *
106 * @return the story
107 */
108 abstract public String export(Story story);
109 }