[Box Backup-commit] COMMIT r1776 - box/chris/merge/lib/common

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Jul 26 23:08:21 BST 2007


Author: chris
Date: 2007-07-26 23:08:21 +0100 (Thu, 26 Jul 2007)
New Revision: 1776

Modified:
   box/chris/merge/lib/common/Configuration.cpp
   box/chris/merge/lib/common/Configuration.h
Log:
Make Configuration take a std::string filename instead of a char array,
in C++ style. (refs #3, merges [1684])


Modified: box/chris/merge/lib/common/Configuration.cpp
===================================================================
--- box/chris/merge/lib/common/Configuration.cpp	2007-07-26 22:07:59 UTC (rev 1775)
+++ box/chris/merge/lib/common/Configuration.cpp	2007-07-26 22:08:21 UTC (rev 1776)
@@ -83,19 +83,16 @@
 //		Created: 2003/07/23
 //
 // --------------------------------------------------------------------------
-std::auto_ptr<Configuration> Configuration::LoadAndVerify(const char *Filename, const ConfigurationVerify *pVerify, std::string &rErrorMsg)
+std::auto_ptr<Configuration> Configuration::LoadAndVerify(
+	const std::string& rFilename,
+	const ConfigurationVerify *pVerify,
+	std::string &rErrorMsg)
 {
-	// Check arguments
-	if(Filename == 0)
-	{
-		THROW_EXCEPTION(CommonException, BadArguments)
-	}
-	
 	// Just to make sure
 	rErrorMsg.erase();
 	
 	// Open the file
-	FileHandleGuard<O_RDONLY> file(Filename);
+	FileHandleGuard<O_RDONLY> file(rFilename);
 	
 	// GetLine object
 	FdGetLine getline(file);

Modified: box/chris/merge/lib/common/Configuration.h
===================================================================
--- box/chris/merge/lib/common/Configuration.h	2007-07-26 22:07:59 UTC (rev 1775)
+++ box/chris/merge/lib/common/Configuration.h	2007-07-26 22:08:21 UTC (rev 1776)
@@ -69,8 +69,15 @@
 		MultiValueSeparator = '\x01'
 	};
 	
-	static std::auto_ptr<Configuration> LoadAndVerify(const char *Filename, const ConfigurationVerify *pVerify, std::string &rErrorMsg);
-	static std::auto_ptr<Configuration> Load(const char *Filename, std::string &rErrorMsg) { return LoadAndVerify(Filename, 0, rErrorMsg); }
+	static std::auto_ptr<Configuration> LoadAndVerify(
+		const std::string& rFilename,
+		const ConfigurationVerify *pVerify,
+		std::string &rErrorMsg);
+
+	static std::auto_ptr<Configuration> Load(
+		const std::string& rFilename,
+		std::string &rErrorMsg)
+	{ return LoadAndVerify(rFilename, 0, rErrorMsg); }
 	
 	bool KeyExists(const char *pKeyName) const;
 	const std::string &GetKeyValue(const char *pKeyName) const;




More information about the Boxbackup-commit mailing list