Soinou wrote:
The usage seems awfully hard for what it does, I mean instead of registering the parameters as params[whatever], then call the get method, why not just call the get methods with the parameters ?
I might not fully understood what you meant, but I did it this way to make the coding cleaner. If I did
Osu_Info::getInfo(Osu_Info::MODE::get_user_best, "param1", "param2", "param3", etc);
Then the order of the parameters would matter and in most cases not all paramaters will be used. Consider this code:
// load parameters
params[U32 Osu_Info::PARAM::user_ID] = "abraker";
params[U32 Osu_Info::PARAM::game_mode] = GAMEMODE::Mania;
params[U32 Osu_Info::PARAM::limit] = "50";
user_best = Osu_Info::getInfo(Osu_Info::MODE::get_user_best, params);
If I was to do what you propose it would look like this:
Osu_Info::getInfo(Osu_Info::MODE::get_user_best, "abraker", "", "50", "", "", "", GAMEMODE::Mania, "");
I suppose I can do this, but it looks ugly IMO.
Soinou wrote:
Your project file is called Project4, you should probably rename it (You can juste rename it then reopen it, everything will work. Maybe you'll have to delete and reimport the vcxproj file, but well ...)
I can't figure this out for the life of me! There doesn't seem an easy to do this within Visual Studio. I think I will have to create a new project and copy everything to the new folder. I'll do this in the next update.
Soinou wrote:
Oh, and you have something agains conventions it seems. You have JSON_Parser, OsuInfo, download as filenames. You can't have three name conventions for three files, that's just wrong.
XD well that slipped out of my coding standards some how. Nice Catch! Will fix in the next update, and yes it's just wrong.
Soinou wrote:
Instead of using static methods on a class, consider making this class a singleton.
Will do.
Soinou wrote:
If you want to use constants that are 0/1/2/3, instead of putting them in a namespace and making them strings, just use an enumeration, they will be considered as integers. Or just pass the game mode as a third arguments and use defines, it will be the same and probably faster since you will in the end pass numbers directly.
Do I? I am using it as a string.
if (_param[U32 PARAM::game_mode] != "")
url += ("m=" + _param[U32 PARAM::game_mode] + "&");
I could pass it as a 3rd parameter, but I want to keep consistency. All parameters will be passed through an array of 8 strings.
Soinou wrote:
You should use a JSON library instead of creating your own or copying it from somewhere else. Use something like JsonCpp or any other library of the kind. They're easy to use, have a lot of useful functionalities and make your code simpler. Libraries are made to be reused, you should use them. Don't recode something that is already coded.
I agree and was thinking of doing so. Perhaps it's my laziness of bothering of including other libraries that lead to this. I might consider doing this after the next update.
Soinou wrote:
You are returning weird arrays from your functions. Why not make a custom type, like an OsuUser or an OsuBeatmap and return it ? Seems a lot easier to code and use.
You mean typedef? If so, I did it for the previous design with tables, but didn't feel like vector<vector<string>> needed one. Though, I can make it so.
- *updated the git with todo's. Will start working on fixing/adding the features this weekend or next week.