{"id":20371,"date":"2016-02-28T03:01:21","date_gmt":"2016-02-27T17:01:21","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=20371"},"modified":"2016-03-31T15:38:29","modified_gmt":"2016-03-31T05:38:29","slug":"xcode-c-web-applications-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/xcode-c-web-applications-primer-tutorial\/","title":{"rendered":"Xcode C++ Web Applications Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/CPlusPlus\/WebApplications\/cplusplus_webapps.jpg\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Xcode C++ Web Applications Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/CPlusPlus\/WebApplications\/cplusplus_webapps.jpg\" title=\"Xcode C++ Web Applications Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Xcode C++ Web Applications Primer Tutorial<\/p><\/div>\n<p>C++ is a very useful desktop programming language and we like the <a target=_blank title='Xcode IDE information from Apple' href='https:\/\/developer.apple.com\/technologies\/tools\/'>Xcode<\/a> <a target=_blank title='IDE information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a> on a MacBook Pro to look after C++ projects.<\/p>\n<p>These days a simple desktop C++ program project is found under &#8220;Command Line Tools&#8221;, and that sort of makes sense because you end up with something that can be run via the MacBook Pro&#8217;s Terminal application in Linux.<\/p>\n<p>Today we set up two classes &#8230;<\/p>\n<ol>\n<li>WebApplicationRecord class handling 3 char[201] data members &#8230;\n<ul>\n<li>webApplicationURL<\/li>\n<li>tutorialWebApplicationURL<\/li>\n<li>title<\/li>\n<\/ul>\n<\/li>\n<li>WebApplication class with 2 int and WebApplicationRecord (respectively) data members &#8230;\n<ul>\n<li>webappsSoFar<\/li>\n<li>**webapps<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p> &#8230; the latter of which am sure you&#8217;ve guessed supervises the former, and as you&#8217;ve probably guessed the number of WebApplicationRecord (class) objects gathered during an execution is stored in <i>webappsSoFar<\/i> and the contents of those WebApplicationRecord (class) objects is contained in that <i>**webapps<\/i> pointer to a pointer (to a WebApplicationRecord (class) object), and as a lot of the readers will know or guess, the use of <i>pointer to a pointer<\/i> is a &#8220;red rag to a bull&#8221; sign that the memory required to organize all this is dynamically allocated.  We actually ask the user how many WebApplicationRecord (class) objects the program can expect, and from that, use the WebApplication class method &#8230;<\/p>\n<p><code><br \/>\n    void setAside(int howMany) {<br \/>\n        if (howMany == 0) {<br \/>\n            webapps = new WebApplicationRecord*[100000];<br \/>\n        } else {<br \/>\n            webapps = new WebApplicationRecord*[howMany];<br \/>\n        }<br \/>\n    }<br \/>\n<\/code><\/p>\n<p> &#8230; to allocate the memory required.<\/p>\n<p>We ask the user interactively for the WebApplicationRecord class data member information and want to thank <a target=_blank title='Useful link' href='http:\/\/www.cplusplus.com\/forum\/beginner\/22868\/'>this useful link<\/a> for their <i>char* safe_gets( char* result, int maxchars )<\/i> alternative to the old C function <i>gets<\/i> which is an improvement on std::cin (or its variations) in catering for a carriage return delimited string be stored in a <i>char *<\/i> variable.<\/p>\n<p>And just so this &#8220;template&#8221; of an idea (hopefully for your expansion) has a little to &#8220;hang its hat on&#8221; we use some WebApplication &#8220;find&#8221; methods that return URL information, given a &#8220;title&#8221; input.<\/p>\n<p>And so if you are a regular it is a bit of &#8220;channelling&#8221; of ideas from the recent <a target=_blank title='PHP Themed Supervision Sixth Genericization Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-themed-supervision-sixth-genericization-tutorial\/'>PHP Themed Supervision Sixth Genericization Tutorial<\/a> series of blog postings.<\/p>\n<p>If you are into some C++ code you could try <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/CPlusPlus\/WebApplications\/main.cpp_GETME\">main.cpp<\/a> and  <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/CPlusPlus\/WebApplications\/WebApplication.h_GETME\">WebApplication.h<\/a> as starting points.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20371' onclick='var dv=document.getElementById(\"d20371\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/xcode\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20371' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>C++ is a very useful desktop programming language and we like the Xcode IDE on a MacBook Pro to look after C++ projects. These days a simple desktop C++ program project is found under &#8220;Command Line Tools&#8221;, and that sort &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/xcode-c-web-applications-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,28,29,37,40],"tags":[176,210,234,319,1839,585,725,767,849,875,885,997,999,1252,1319,1473],"class_list":["post-20371","post","type-post","status-publish","format-standard","hentry","category-elearning","category-oop","category-operating-system","category-tutorials","category-xcode","tag-c","tag-class","tag-command-line","tag-desktop","tag-genericization","tag-ide","tag-mac-os-x","tag-memory","tag-object","tag-oop","tag-operating-system-2","tag-programming","tag-project","tag-terminal","tag-tutorial","tag-xcode"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/20371"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=20371"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/20371\/revisions"}],"predecessor-version":[{"id":20399,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/20371\/revisions\/20399"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=20371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=20371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=20371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}