00001 // ******************************************************************* 00002 // Document.h 00003 // ******************************************************************* 00004 // 00005 // DESCRIPTION: API for Document class. Used to manipulate a 00006 // given document. 00007 // NOTE: This program makes use of strings. 00008 // 00009 /*************************************************************************** 00010 * Copyright (C) 2003 by drs. Eric D. Schabell * 00011 * erics@cs.kun.nl * 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 ***************************************************************************/ 00018 00019 00020 //-------------------------------------------------------------------- 00021 //conditional compilation 00022 //-------------------------------------------------------------------- 00023 #ifndef _DOCUMENT_H_ 00024 #define _DOCUMENT_H_ 00025 00026 //-------------------------------------------------------------------- 00027 //#includes 00028 //-------------------------------------------------------------------- 00029 #include <string> 00030 00031 using namespace std; 00032 00033 class Document 00034 { 00035 public: 00036 00037 //-------------------------------------------------------------------- 00038 //Purpose: default constructor. 00039 //Preconditions: none. 00040 //Postconditions: a Document object is instantiated and all 00041 // attributes are zeroed. 00042 //Arguments: none. 00043 //Returns: Document. 00044 //Called Funcs: none. 00045 //-------------------------------------------------------------------- 00046 Document(); 00047 00048 //-------------------------------------------------------------------- 00049 //Purpose: constructor with url and conversion given.. 00050 //Preconditions: must supply a string document url and a 00051 // string conversion routine. 00052 //Postconditions: a Document object is instantiated with a 00053 // document url, file name and conversion 00054 // routine defined. File location and Conversion 00055 // location are zeroed. 00056 //Arguments: string doc_url, string routine. 00057 //Returns: Document. 00058 //Called Funcs: setDocumentFile(), setDocumentConversion(). 00059 //-------------------------------------------------------------------- 00060 Document( string doc_url, string routine ); 00061 00062 //-------------------------------------------------------------------- 00063 //Purpose: default destructor. 00064 //Preconditions: Document object. 00065 //Postconditions: Document object destroyed. 00066 //Arguments: none. 00067 //Returns: 0 00068 //Called Funcs: none. 00069 //-------------------------------------------------------------------- 00070 ~Document(); 00071 00072 //-------------------------------------------------------------------- 00073 //Purpose: obtain the documents complete url. 00074 //Preconditions: Docuemnt object exists. 00075 //Postconditions: returns url attribute. 00076 //Arguments: none. 00077 //Returns: string. 00078 //Called Funcs: none. 00079 //-------------------------------------------------------------------- 00080 string getDocumentUrl(); 00081 00082 //-------------------------------------------------------------------- 00083 //Purpose: Return the file name if instantiated, otherwise 00084 // returns the url attribute. 00085 //Preconditions: Docuemnt object created. 00086 //Postconditions: success = returns instantiated file attribute. 00087 // failure = returns url if file has not been instantiated, 00088 // which signals a problem with the 00089 // document construction. 00090 //Arguments: none. 00091 //Returns: string 00092 //Called Funcs: none. 00093 //-------------------------------------------------------------------- 00094 string getDocumentFile(); 00095 00096 //-------------------------------------------------------------------- 00097 //Purpose: Return the conversion routine attribute. 00098 //Preconditions: Docuemnt object created. 00099 //Postconditions: returns instantiated file attribute. 00100 //Arguments: none. 00101 //Returns: string 00102 //Called Funcs: none. 00103 //-------------------------------------------------------------------- 00104 string getDocumentConversion(); 00105 00106 //-------------------------------------------------------------------- 00107 //Purpose: Return the conLocation attribute. 00108 //Preconditions: Docuemnt object created. 00109 //Postconditions: returns conLocation attribute. 00110 //Arguments: none. 00111 //Returns: string 00112 //Called Funcs: none. 00113 //-------------------------------------------------------------------- 00114 string getConversionLocation(); 00115 00116 //-------------------------------------------------------------------- 00117 //Purpose: Return the docuemnt file location. 00118 //Preconditions: Docuemnt object created. 00119 //Postconditions: returns fileLocation attribute. 00120 //Arguments: none. 00121 //Returns: string 00122 //Called Funcs: none. 00123 //-------------------------------------------------------------------- 00124 string getFileLocation(); 00125 00126 //-------------------------------------------------------------------- 00127 //Purpose: Sets the file location to given location. 00128 //Preconditions: Docuemnt object created, location provided. 00129 //Postconditions: fileLocation attribute is set with given file 00130 // location. 00131 //Arguments: string file_location. 00132 //Returns: 0. 00133 //Called Funcs: none. 00134 //-------------------------------------------------------------------- 00135 void setFileLocation( string file_location ); 00136 00137 //-------------------------------------------------------------------- 00138 //Purpose: Sets the converted files location to given location. 00139 //Preconditions: Docuemnt object created, location provided. 00140 //Postconditions: conLocation attribute is set with given file 00141 // location. 00142 //Arguments: string conversion_location. 00143 //Returns: 0. 00144 //Called Funcs: none. 00145 //-------------------------------------------------------------------- 00146 void setConversionLocation( string conversion_location ); 00147 00148 private: 00149 string url; // url to location of document. 00150 string file; // document basename. 00151 string conversion; // conversion being requested on this docuement. 00152 string conLocation; // location of converted docuement (url or local file system) 00153 string fileLocation; // location of basename (local file system). 00154 00155 //-------------------------------------------------------------------- 00156 //Purpose: Determine and set the file name by basnaming 00157 // the url attribute. 00158 //Preconditions: Docuemnt object created. 00159 //Postconditions: success = a set file attribute. 00160 // failure = returns error 00161 //Arguments: none. 00162 //Returns: 0. 00163 //Called Funcs: basename(). 00164 //-------------------------------------------------------------------- 00165 void setDocumentFile(); 00166 00167 //-------------------------------------------------------------------- 00168 //Purpose: Instantiates the conversion attribute with the 00169 // given convertion routine. 00170 //Preconditions: Docuemnt object created, convertion routine 00171 // provided. . 00172 //Postconditions: instantiated conversion attribute. 00173 //Arguments: string convertion_request.. 00174 //Returns: 0. 00175 //Called Funcs: none. 00176 //-------------------------------------------------------------------- 00177 void setDocumentConversion( string conversion_request ); 00178 }; 00179 00180 #endif /* _DOCUMENT_H_ */