[Box Backup-commit] COMMIT r1684 - box/chris/general/lib/common
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sat May 26 16:26:35 BST 2007
Author: chris
Date: 2007-05-26 16:26:35 +0100 (Sat, 26 May 2007)
New Revision: 1684
Modified:
box/chris/general/lib/common/Configuration.cpp
box/chris/general/lib/common/Configuration.h
Log:
Make Configuration take a std::string filename instead of a char array,
in C++ style.
Modified: box/chris/general/lib/common/Configuration.cpp
===================================================================
--- box/chris/general/lib/common/Configuration.cpp 2007-05-26 15:25:47 UTC (rev 1683)
+++ box/chris/general/lib/common/Configuration.cpp 2007-05-26 15:26:35 UTC (rev 1684)
@@ -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/general/lib/common/Configuration.h
===================================================================
--- box/chris/general/lib/common/Configuration.h 2007-05-26 15:25:47 UTC (rev 1683)
+++ box/chris/general/lib/common/Configuration.h 2007-05-26 15:26:35 UTC (rev 1684)
@@ -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