{"id":16,"date":"2016-05-22T11:35:49","date_gmt":"2016-05-22T11:35:49","guid":{"rendered":"https:\/\/blogs.scummvm.org\/tkachov\/?p=16"},"modified":"2022-05-24T11:36:10","modified_gmt":"2022-05-24T11:36:10","slug":"gsoc-work-starts-tomorrow","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/tkachov\/2016\/05\/22\/gsoc-work-starts-tomorrow\/","title":{"rendered":"GSoC: Work starts tomorrow"},"content":{"rendered":"<div class=\"post\">\n<p>(At\u00a0least, that\u2019s \u00abtomorrow\u00bb in\u00a0my\u00a0timezone.)<\/p>\n<p>So, the last time\u00a0I wrote about doing some preparation work before GSoC starts and\u00a0I believe\u00a0I did quite good.<\/p>\n<p>JSON parser works fine, even though we\u00a0have to\u00a0replace all unicode characters into \u2019?\u2019 to\u00a0make it\u00a0work.<\/p>\n<p>Now I\u2019m checking that my\u00a0code compiles not only with MSVC, but also with gcc through MinGW shell. Thus, I\u00a0have tested the configure changes sev made, and libcurl detection and usage is\u00a0successful.<\/p>\n<p>There is\u00a0a\u00a0small \u00abframework\u00bb for libcurl already: I\u2019ve added\u00a0<span class=\"pre\">ConnMan<\/span>\u00a0(<span class=\"pre\">ConnectionManager<\/span>, similarly to\u00a0<span class=\"pre\">ConfMan<\/span>), which could be\u00a0used to\u00a0start curl requests. There is\u00a0a\u00a0special\u00a0<span class=\"pre\">CurlJsonRequest<\/span>, which reads the whole response, parses as\u00a0JSON and then passes the result to\u00a0its caller. Finally, I\u2019ve commited Callbacks yesterday. I\u00a0still keep those in\u00a0a\u00a0separate branch, because some edits might be\u00a0necessary, but\u00a0I believe it\u00a0to\u00a0be\u00a0a\u00a0very good thing to\u00a0have.<\/p>\n<p>These\u00a0<span class=\"pre\">Callback<\/span>\u00a0classes are not just plain pointer to\u00a0function stuff. It\u2019s \u00abobject-oriented callbacks\u00bb, meaning it\u2019s actually \u00abpointer to\u00a0an\u00a0object and its method\u00bb. Plus, I\u00a0also made it\u00a0so\u00a0one can specify an\u00a0argument type. Yes, those are templates. I\u00a0actually remembered, that\u00a0I already did\u00a0<a href=\"https:\/\/github.com\/Tkachov\/Square\/blob\/master\/00_engine\/00_template\/src\/Engine\/Functor.h\">such thing<\/a>\u00a0a\u00a0few years back while\u00a0I was at\u00a0school. \u00abFunctor\u00bb might be\u00a0a\u00a0wrong name to\u00a0call\u00a0it, but the idea is\u00a0still the same: there is\u00a0a\u00a0base class, which doesn\u2019t know anything about the class, whose method we\u2019re going to\u00a0point\u00a0to, and there is\u00a0a\u00a0derived class, which implements\u00a0it. We\u2019re using pointers to\u00a0the base class, so\u00a0we\u00a0don\u2019t care whether it\u2019s\u00a0<span class=\"pre\">Callback&lt;A&gt;<\/span>\u00a0or\u00a0<span class=\"pre\">Callback&lt;B&gt;<\/span>\u00a0or\u00a0<span class=\"pre\">SomeOtherCallbackImplementation<\/span>. Thus, we\u00a0don\u2019t have to\u00a0write all these ugly global function callbacks, cast the only\u00a0<span class=\"pre\">void *<\/span>\u00a0parameter to\u00a0some struct and use fields of\u00a0this struct to\u00a0do\u00a0the work. We\u00a0just write\u00a0<span class=\"pre\">Callback&lt;ClassName&gt;<\/span>\u00a0and pass\u00a0<span class=\"pre\">ClassName::method<\/span>, and so\u00a0this method would be\u00a0automatically called when this callback\u2019s\u00a0<span class=\"pre\">operator()<\/span>\u00a0is\u00a0called. If\u00a0we\u00a0want to\u00a0specify, that\u00a0<span class=\"pre\">ClassName::method<\/span>\u00a0accepts not\u00a0<span class=\"pre\">void *<\/span>, but, for example,\u00a0<span class=\"pre\">AnotherClass<\/span>, we\u00a0just write\u00a0<span class=\"pre\">Callback&lt;ClassName, AnotherClass&gt;<\/span>\u00a0(note that it\u00a0accepts not a\u00a0pointer, but an\u00a0object itself). It\u2019s as\u00a0simple as\u00a0that!<\/p>\n<p>I\u00a0also wanted to\u00a0do\u00a0something about Storages and save corresponding access tokens and such into configuration file. Well, right now it\u00a0remembers the access token of\u00a0the \u00abcurrent\u00bb storage, and thus I\u2019m not authenticating every time\u00a0I launch ScummVM. Yet, I\u2019d like to\u00a0remember tokens of\u00a0all connected storages, so\u00a0user can easily switch between those.<\/p>\n<p>Finally, there was a\u00a0\u00abwriting API skeleton\u00bb in\u00a0my\u00a0plan. Well, this whole cloud system works as\u00a0I thought it\u00a0would. There are no\u00a0real API method implementations, but apart from that it\u00a0looks fine.<\/p>\n<p>OK, so\u00a0I\u2019d have to\u00a0start working next week. The general plan is\u00a0to\u00a0design API and implement Dropbox and some other provider support. My\u00a0proposal schedule states the following:<\/p>\n<p><b>May 23\u00a0\u2014 May\u00a029<\/b><br \/>\nWrite Storage interface, implement tokens saving.<br \/>\nAdd Dropbox and OneDrive storages.<\/p>\n<p><b>May 30\u00a0\u2014 June\u00a05<\/b><br \/>\nImplement file downloading (Dropbox and OneDrive).<br \/>\nAdd auto detection procedure running after the download.<\/p>\n<p><span class=\"pre\">Storage<\/span>\u00a0interface is\u00a0more or\u00a0less there, token is\u00a0saved. \u00abAdd\u00bb there doesn\u2019t imply storage would be\u00a0completely functional, so\u00a0adding Dropbox storage is\u00a0also done.<\/p>\n<p>So, the actual plan is\u00a0to\u00a0upgrade\u00a0<span class=\"pre\">Storage<\/span>\u00a0to\u00a0have some config saving related methods and make tokens saving feature support multiple Storages. After that, I\u00a0guess I\u2019d add OneDrive stub and start implementing some API methods in\u00a0Dropbox and OneDrive backends.<\/p>\n<p>I\u2019m still having university studies here and exams are getting close. This means sometimes I\u2019d have to\u00a0study instead of\u00a0work, and\u00a0I might end up\u00a0behind the schedule, not ahead of\u00a0it. And that means I\u2019m going to\u00a0have no\u00a0weekends closer to\u00a0the midterm and after it =)<\/p>\n<\/div>\n<div class=\"post\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>(At\u00a0least, that\u2019s \u00abtomorrow\u00bb in\u00a0my\u00a0timezone.) So, the last time\u00a0I wrote about doing some preparation work before GSoC starts and\u00a0I believe\u00a0I did quite good. JSON parser works fine, even though we\u00a0have to\u00a0replace all unicode characters into \u2019?\u2019 to\u00a0make it\u00a0work. Now I\u2019m checking that my\u00a0code compiles not only with MSVC, but also with gcc through MinGW shell. Thus, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":17,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts\/16\/revisions\/17"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}