Hi, I'm working on a small libarary that will parse and modify a certain type of configuration file. As suggested by wise people (I think) I'd like to hide away the implementation and offer the user a set of functions to use the library. I have questions mainly philosophical or concerning style. I'll put here my idea and it'd be very nice to get your opinions on it.
#ifndef CONFIGFILEAPI_H_INCLUDED
#define CONFIGFILEAPI_H_INCLUDED
#include
#include
namespace cfgFileLib
{
//open and parse a file
// Returns:
// empty string "" if succesful
// error description if not
std::string openConfigFile (const std::string & fileName);
//check if a symbol is defined
bool isDefined (const std::string & symbol);
//how many values are assigned this symbol
int howMany (const std::string & symbol);
//get first (or only) value assigned to the given symbol
bool getBool (const std::string & symbol);
int getInt (const std::string & symbol);
double getDouble (const std::string & symbol);
std::string getString (const std::string & symbol);
//get all the values assgined to the given symbol
std::vector getAllBool (const std::string & symbol);
std::vector getAllInt (const std::string & symbol);
std::vector getAllDouble (const std::string & symbol);
std::vector getAllString (const std::string & symbol);
}
#endif
- Does this design make sense in general? - Do I put it all whithin a namespace?