• Welcome to Valhalla Legends Archive.
 

[C++] Configuration File Reader

Started by shadypalm88, January 02, 2005, 03:33 PM

Previous topic - Next topic

mynameistmp

Quote
Wow, are you sure?  That's not the case here (UK).

Yes.

Quote
  If you obtained it directly from the author without any kind of license or contract, I would say you are most likely bound by federal (or the appopriate jurisdiction's) copyright law.

You're running in a circle. Copyright law basically constitutes the right to apply licensing terms to the source. Without the licensing terms, there ARE no legal boundaries.

Quote
If you have it without a license, and it has a registered copyright (as you say, explicit copyright), your posession of it without a license or any other kind of grant-of-use from the author is most likely illegal.

That's an ironic post for this thread. I don't have much else to say on the topic.

"This idea is so odd, it is hard to know where to begin in challenging it." - Martin Barker, British scholar

MyndFyre

#16
Quote from: Arta[vL] on January 07, 2005, 01:43 AM
Quote from: mynameistmp on January 06, 2005, 03:09 PM
A copyright holder cannot change the terms on a copy you already have.

Wow, are you sure?  That's not the case here (UK).

It depends.  If the original license says "all rights reserved," "all rights not expressly granted herein are reserved," or "the right to modify this license at any time is reserved," then yes, the copyright owner can change the terms on the copy already owned.

Quote from: mynameistmp on January 07, 2005, 02:14 AM
You're running in a circle. Copyright law basically constitutes the right to apply licensing terms to the source. Without the licensing terms, there ARE no legal boundaries.
No, it depends on how you obtained the original copy of the source code.  If you stole it (for example, by brute-forcing your way into someone's server), then you are infringing on copyright; just because you obtained it without a license from the owner doesn't mean that it doesn't give rights to the owner.  If you obtained it from a place such as PSCode, there is a license that the author agreed to allow his work to be bound by.  If you obtained it just floating about the internet, it is on you to find out the licensing of it.  If Longhorn source code was leaked, any people having it would not have a license and would be in copyright violation, even if you didn't see a license agreement when you were downloading it from the internet.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

R.a.B.B.i.T

*bump*
Sorry for it, but ionws is down, and I can't get a copy of this.  I'm starting more active developement in C++ now, and my efforts at creating any form of config file is horrible (best I've gotten is program crashes on my readini() routine).  Any chance you could upload a copy somewhere else?

K

Quote from: rabbit on July 04, 2005, 11:26 PM
*bump*
Sorry for it, but ionws is down, and I can't get a copy of this. I'm starting more active developement in C++ now, and my efforts at creating any form of config file is horrible (best I've gotten is program crashes on my readini() routine). Any chance you could upload a copy somewhere else?

I was going to recommend boost::program_options, but I see I already did about 6 months ago ;)

R.a.B.B.i.T

Eh?  I don't remember any recommendations :X

From what I've read about boost it's for command lines, but that's not what I'm looking for :\

K

Quote from: rabbit on July 05, 2005, 06:32 PM
Eh? I don't remember any recommendations :X

From what I've read about boost it's for command lines, but that's not what I'm looking for :\

Actually, boost is for a ton of different things -- boost::program_options however supports several different methods of reading program options, one of which happens to be the command line.  However it also supports reading configuration files.

Here's a little snippet:

//
namespace po = boost::program_options;
std::string user_name;
std::string user_password;
std::string remote_host;
unsigned short remote_port;
// etc..


// ...

std::ifstream in_file(config_file.c_str());

po::options_description config("Configuration");
config.add_options()
("User-Name", po::value<std::string>(&user_name)->default_value("anonymous"), "Your battle.net user name.")
("User-Password", po::value<std::string>(&user_password)->default_value(""), "Your battle.net password.")
("Remote-Server", po::value<std::string>(&remote_server)->default_value("useast.battle.net"), "Server's hostname or IP address.")
("Remote-Port", po::value<unsigned short>(&remote_port)->default_value(6112), "Server's port.");


try
{
po::variables_map vm;
po::store(po::parse_config_file(in_file, config), vm);
po::notify(vm);
}
catch(std::exception& ex)
{
std::cerr << config << std::endl;
std::cerr << ex.what() << std::endl;
return false;
}

in_file.close();


R.a.B.B.i.T

Well I missed that...I'll look more closely.