Issue 336 2

These patches consolidate the parse of command line options to ConfigManager.
In addition, it also parses a configuration file.
> dbServer.c_str() + posColon + 1 will be more readable as getting
substring code.

I think readability is almost equivalent.


2014-08-12 11:34 GMT+09:00 Kouhei Sutou <notifications@github.com>:

> In server/src/ConfigManager.cc:
>
> > @@ -54,21 +148,153 @@ struct ConfigManager::Impl {
> >  	{
> >  		mutex.unlock();
> >  	}
> > +
> > +	void parseDBServer(const string &dbServer)
> > +	{
> > +		const size_t posColon = dbServer.find(":");
> > +		if (posColon == string::npos) {
> > +			dbServerAddress = dbServer;
> > +			return;
> > +		}
> > +		if (posColon == dbServer.size() - 1) {
> > +			MLPL_ERR("A column must not be the tail: %s\n",
> > +			         dbServer.c_str());
> > +			return;
> > +		}
> > +		dbServerAddress = string(dbServer, 0, posColon);
> > +		dbServerPort = atoi(&dbServer.c_str()[posColon+1]);
>
> dbServer.c_str() + posColon + 1 will be more readable as getting
> substring code.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/project-hatohol/hatohol/pull/365/files#r16093068>.
>