Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Property.h

00001 #ifndef PROPERTY
00002 #define PROPERTY
00003 
00004 #include <iostream>
00005 #include <string>
00006 #include <vector>
00007 #include <fstream>      
00008 #include <ctype.h>
00009 
00010 using namespace std;
00011 
00015 #ifdef WIN32
00016 static const char* const PROPERTYFILENAME = "Property.txt";
00017 #endif
00018 #ifndef WIN32
00019 static const char* const PROPERTYFILENAME = CONFIGDIR"Property.txt";
00020 #endif
00021 
00024 /*
00025 *Property loads the above defined file and returns the required values
00026 *
00027 *@author Benjamin Schockert
00028 */
00029 class Property
00030 {
00031         public:
00032                 /*
00033                 *save the content of the property file
00034                 */
00035                 vector<char*> dataName;
00036                 vector<char*> list;
00037                 /*
00038                 *open and read the property file
00039                 */
00040                 ifstream ifile;
00041                 ~Property();
00042                 /*
00043                 *save the property file name
00044                 */
00045                 // const char* filename ;
00046                 std::string filename;
00047 
00048                 /*
00049                 *iterator to traverse the dataName vector
00050                 */
00051                 vector<char *>::iterator itFileName;
00052                 /*
00053                 *save, depending from the content of the property file, the corresponding
00054                 *value for, File not found=0, File=1, Database=2.
00055                 */
00056                 int select;
00057                 /*
00058                 * Constructor for the Property class. It assign the name of 
00059                 * the propertyfile to the corresponding variable.
00060                 */
00061                 Property():x(0),y(0),z(0),grouped(true),logging(false),select(0)                  ,groupingCriteria(NULL),filename(PROPERTYFILENAME){};
00065                 Property(const Property& prop){
00066                         x = prop.x;
00067                         y = prop.y;
00068                         z = prop.z;
00069                         grouped = prop.grouped;
00070                         logging = prop.logging;
00071                         select = prop.select;
00072                         dataName = prop.dataName;
00073                         list = prop.list;
00074                         filename = prop.filename;
00075                         // strcpy(const_cast<char*>(filename), prop.filename);
00076                         itFileName = prop.itFileName;
00077                         //ifile = prop.ifile;
00078                         strcpy(groupingCriteria, prop.groupingCriteria);
00079                 }
00080                 Property& operator=(const Property& prop){
00081 
00082                         if(this != &prop){
00083                                 x = prop.x;
00084                                 y = prop.y;
00085                                 z = prop.z;
00086                                 grouped = prop.grouped;
00087                                 logging = prop.logging;
00088                                 select = prop.select;
00089                                 dataName = prop.dataName;
00090                                 list = prop.list;
00091                                 filename = prop.filename;
00092                                 // strcpy(const_cast<char*>(filename), prop.filename);
00093                                 itFileName = prop.itFileName;
00094                                 //ifile = prop.ifile;
00095                                 strcpy(groupingCriteria, prop.groupingCriteria);
00096                         }
00097                         return *this;
00098                 }
00099                 /*
00100                 * The getDatafromFile function read the property file and checks
00101                 * where the reauired values are. If the keyword "File" was found
00102                 * the corresponding Files where loaded and the required names where 
00103                 * assigned to the Server/Service names. If the keyword is "Database"
00104                 * the database functions will called.
00105                 *
00106                 * @return value of selected method
00107                 */
00108                 int getDatafromFile(const std::string& confdir);
00113                 int cutString(char* row);
00117                 bool logging;
00121                 bool grouped;
00127                 int x;
00128                 int y;
00129                 int z;
00133                 char* groupingCriteria;
00134         
00135 };
00136 
00137 
00138 #endif

Generated on Fri Mar 30 02:54:34 2007 for InterComLayer by doxygen 1.3.5