Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
camelCase: Converted code in tests directory
[xestiacalendar/.git] / source / tests / xestiacalendar_testcommon.cpp
index e36378a..af2a7ca 100644 (file)
 ProcessConnectionDataFileResult ProcessConnectionDataFile(string DataFilename, 
        CalDAVConnectionData *ConnData){
                
-       ProcessConnectionDataFileResult ProcessResult = PROCESSCONNECTIONDATAFILE_UNITTESTFAIL;
+       ProcessConnectionDataFileResult processResult = PROCESSCONNECTIONDATAFILE_UNITTESTFAIL;
                
        // Check if the file exists and return 
        // PROCESSCONNECTIONDATAFILE_MISSING if not.
        
-       if (!FileExists(DataFilename)){
+       if (!FileExists(dataFilename)){
                return PROCESSCONNECTIONDATAFILE_MISSING;
        }
        
-       ifstream FileStream;
-       string ReceivedStringData = "";
+       ifstream fileStream;
+       string receivedStringData = "";
        
-       FileStream.open(DataFilename, ifstream::in);
+       fileStream.open(dataFilename, ifstream::in);
        
-       if (FileStream.rdstate() & ifstream::failbit){
+       if (fileStream.rdstate() & ifstream::failbit){
                return PROCESSCONNECTIONDATAFILE_CANNOTOPEN;
        }
 
-       if (FileStream.rdstate() & ifstream::badbit){
+       if (fileStream.rdstate() & ifstream::badbit){
                return PROCESSCONNECTIONDATAFILE_CANNOTOPEN;
        }
        
        // Process the file.
        
-       char *BufferRead = new char[256];
+       char *bufferRead = new char[256];
        
        while (!FileStream.eof()){
                
-               FileStream.getline(BufferRead, 256);
-               ReceivedStringData.append(BufferRead);
-               ReceivedStringData.append("\n");
+               fileStream.getline(bufferRead, 256);
+               receivedStringData.append(bufferRead);
+               receivedStringData.append("\n");
                
        }
        
-       delete[] BufferRead;
+       delete[] bufferRead;
        
-       bool NewLine = false;
-       bool SkipMode = false;
-       bool EqualFound = false;
-       bool QuoteMode = false;
-       bool ServerNameFound = false;
-       bool ServerUserFound = false;
-       bool ServerPassFound = false;
-       bool ServerSSLFound = false;
-       bool ServerPortFound = false;
-       bool ServerPrefixFound = false;
-       char BufferChar = 0;
-       int StringDataSize = ReceivedStringData.size();
-       int SeekCount = 0;
-       string PropertyName;
-       string PropertyValue;
+       bool newLine = false;
+       bool skipMode = false;
+       bool equalFound = false;
+       bool quoteMode = false;
+       bool serverNameFound = false;
+       bool serverUserFound = false;
+       bool serverPassFound = false;
+       bool serverSSLFound = false;
+       bool serverPortFound = false;
+       bool serverPrefixFound = false;
+       char bufferChar = 0;
+       int stringDataSize = receivedStringData.size();
+       int seekCount = 0;
+       string propertyName;
+       string propertyValue;
 
-       while (SeekCount < StringDataSize){
+       while (seekCount < stringDataSize){
 
-               if (ReceivedStringData[SeekCount] == '='){
+               if (receivedStringData[seekCount] == '='){
                
-                       EqualFound = true;              
+                       equalFound = true;              
                
-               } else if (ReceivedStringData[SeekCount] == '\n'){
+               } else if (receivedStringData[seekCount] == '\n'){
                
                        // Newline reached. Check for what type of
                        // data it is.
@@ -91,72 +91,72 @@ ProcessConnectionDataFileResult ProcessConnectionDataFile(string DataFilename,
                        // there is a values in the property name
                        // and property value before doing anything.
                                                
-                       if (EqualFound == true &&
-                               PropertyName.size() > 0 &&
-                               PropertyValue.size() > 0){
+                       if (equalFound == true &&
+                               propertyName.size() > 0 &&
+                               propertyValue.size() > 0){
                        
-                               if (PropertyName == "server" && ServerNameFound == false){
+                               if (propertyName == "server" && serverNameFound == false){
                                
                                        // Setup the server hostname.
                                
-                                       ConnData->Hostname = PropertyValue;
-                                       ServerNameFound = true;
+                                       connData->hostname = propertyValue;
+                                       serverNameFound = true;
                                
-                               } else if (PropertyName == "port" && ServerPortFound == false){
+                               } else if (propertyName == "port" && serverPortFound == false){
                                
                                        // Setup the server port.
                                
-                                       int PortNum;
-                                       bool PortNumValid = true;
+                                       int portNum;
+                                       bool portNumValid = true;
                                
                                        try{
-                                               PortNum = stoi(PropertyValue);
+                                               portNum = stoi(propertyValue);
                                        }
                                        
                                        catch(const invalid_argument &oor){
-                                               PortNumValid = false;
+                                               portNumValid = false;
                                        }
                                        
                                        // Port Number is valid so add to the
                                        // CalDAVConnectionData handle.
                                        
-                                       if (PortNumValid == true){
-                                               ConnData->Port = PortNum;
-                                               ServerPortFound = true;
+                                       if (portNumValid == true){
+                                               connData->Port = portNum;
+                                               serverPortFound = true;
                                        }
                                
-                               } else if (PropertyName == "user" && ServerUserFound == false){
+                               } else if (propertyName == "user" && serverUserFound == false){
                                
                                        // Setup the server user.
                                        
-                                       ConnData->Username = PropertyValue;
-                                       ServerUserFound = true;
+                                       connData->username = propertyValue;
+                                       serverUserFound = true;
                                
-                               } else if (PropertyName == "pass" && ServerPassFound == false){
+                               } else if (propertyName == "pass" && serverPassFound == false){
                                
                                        // Setup the server pass.
                                        
-                                       ConnData->Password = PropertyValue;
-                                       ServerPassFound = true;                         
+                                       connData->Password = propertyValue;
+                                       serverPassFound = true;                         
                                
-                               } else if (PropertyName == "ssl" && ServerSSLFound == false){
+                               } else if (propertyName == "ssl" && serverSSLFound == false){
                                
                                        // Setup the server SSL status.
                                        
-                                       if (PropertyValue == "true"){
-                                               ConnData->UseSSL = true;
+                                       if (propertyValue == "true"){
+                                               connData->useSSL = true;
                                        } else {
-                                               ConnData->UseSSL = false;                                       
+                                               connData->useSSL = false;                                       
                                        }
                                        
-                                       ServerSSLFound = true;
+                                       serverSSLFound = true;
                                
-                               } else if (PropertyName == "prefix" && ServerPrefixFound == false){
+                               } else if (propertyName == "prefix" && serverPrefixFound == false){
                                
                                        // Setup the server prefix.
                                
-                                       ConnData->Prefix = PropertyValue;
-                                       ServerPrefixFound = true;
+                                       connData->prefix = propertyValue;
+                                       serverPrefixFound = true;
                                
                                }
                                
@@ -164,9 +164,9 @@ ProcessConnectionDataFileResult ProcessConnectionDataFile(string DataFilename,
                        
                        // Reset the variables.
                
-                       EqualFound = false;
-                       PropertyName.clear();
-                       PropertyValue.clear();
+                       equalFound = false;
+                       propertyName.clear();
+                       propertyValue.clear();
                
                } else {
                
@@ -174,33 +174,33 @@ ProcessConnectionDataFileResult ProcessConnectionDataFile(string DataFilename,
                        // Property name or value depending on 
                        // if the equal sign has been found.
                
-                       BufferChar = ReceivedStringData[SeekCount];
+                       bufferChar = receivedStringData[seekCount];
                
-                       if (EqualFound == true){
-                               PropertyValue += BufferChar;
+                       if (equalFound == true){
+                               propertyValue += bufferChar;
                        } else {
-                               PropertyName += BufferChar;                     
+                               propertyName += bufferChar;
                        }
                        
-                       BufferChar = 0;
+                       bufferChar = 0;
                
                }
 
-               SeekCount++;
+               seekCount++;
 
        }
        
        // Check that the CalDAV connection data object 
        // contains valid data.
        
-       bool CalDAVConnDataResult = CalDAVObjectValidSettings(ConnData);
+       bool calDAVConnDataResult = CalDAVObjectValidSettings(connData);
        
-       if (CalDAVConnDataResult == false){
-               ProcessResult = PROCESSCONNECTIONDATAFILE_INVALID;
+       if (calDAVConnDataResult == false){
+               processResult = PROCESSCONNECTIONDATAFILE_INVALID;
        } else {
-               ProcessResult = PROCESSCONNECTIONDATAFILE_OK;
+               processResult = PROCESSCONNECTIONDATAFILE_OK;
        }
        
-       return ProcessResult;
+       return processResult;
                
 }
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy