{"id":419,"date":"2024-07-27T02:38:22","date_gmt":"2024-07-27T02:38:22","guid":{"rendered":"https:\/\/www.jibsheet.net\/linux\/?p=419"},"modified":"2024-07-27T02:38:22","modified_gmt":"2024-07-27T02:38:22","slug":"using-copilot-to-create-toml-reader-class","status":"publish","type":"post","link":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/","title":{"rendered":"Using copilot to create toml reader class"},"content":{"rendered":"<p>Still learning about these generative AI tools. My assessment is that it is a Hugh leap in Natural Language Processing.\u00a0 And for programming, might enable us to weave generated pieces into a coherent product faster.\u00a0 It will also allow program creation that might not otherwise happen.<\/p>\n<p>Here is a prompt that I gave Bing copilot &#8211; no thrills<\/p>\n<p>With the copilot &#8211; it appears to grab stuff from github, but this is a popular library.\u00a0 A real test of that would be to use a obscure or a really fresh github library.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Generate a C++ class that will read the following toml file usinghttps:\/\/github.com\/ToruNiina\/toml11  and store this in a structure for the 2 parts program and script.   have method to retrieve the structures for use<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-420\" src=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png\" alt=\"\" width=\"300\" height=\"223\" srcset=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png 300w, https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-768x570.png 768w, https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot.png 933w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>So, I created a toml file and said create a class to read.\u00a0 and what you get is a easily to test proof of concept.\u00a0 And yes it works &#8211; with some easy mods &#8211; like real location of you file<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n#include &lt;toml.hpp&gt;\r\n\r\nstruct Program {\r\n    std::string pgm;\r\n    std::string parms;\r\n    std::string user;\r\n    int interval_seconds;\r\n    std::string status;\r\n};\r\n\r\nstruct Script {\r\n    std::string location;\r\n    std::string pgm;\r\n    std::string options;\r\n    int throttle_minutes;\r\n};\r\n\r\nclass TomlReader {\r\npublic:\r\n    TomlReader(const std::string&amp; filename) : filename_(filename) {}\r\n\r\n    bool read() {\r\n        try {\r\n            data_ = toml::parse_file(filename_);\r\n            program_ = toml::find&lt;Program&gt;(data_, \"program\");\r\n            script_ = toml::find&lt;Script&gt;(data_, \"script\");\r\n            return true;\r\n        } catch (const toml::parse_error&amp; e) {\r\n            std::cerr &lt;&lt; \"Error parsing TOML file: \" &lt;&lt; e.what() &lt;&lt; std::endl;\r\n            return false;\r\n        }\r\n    }\r\n\r\n    const Program&amp; getProgram() const {\r\n        return program_;\r\n    }\r\n\r\n    const Script&amp; getScript() const {\r\n        return script_;\r\n    }\r\n\r\nprivate:\r\n    std::string filename_;\r\n    toml::value data_;\r\n    Program program_;\r\n    Script script_;\r\n};\r\n\r\nint main() {\r\n    TomlReader reader(\"your_toml_file.toml\");\r\n    if (reader.read()) {\r\n        const Program&amp; program = reader.getProgram();\r\n        const Script&amp; script = reader.getScript();\r\n\r\n        std::cout &lt;&lt; \"Program:\" &lt;&lt; std::endl;\r\n        std::cout &lt;&lt; \"  pgm: \" &lt;&lt; program.pgm &lt;&lt; std::endl;\r\n        std::cout &lt;&lt; \"  parms: \" &lt;&lt; program.parms &lt;&lt; std::endl;\r\n        \/\/ Add other fields as needed\r\n\r\n        std::cout &lt;&lt; \"Script:\" &lt;&lt; std::endl;\r\n        std::cout &lt;&lt; \"  location: \" &lt;&lt; script.location &lt;&lt; std::endl;\r\n        std::cout &lt;&lt; \"  pgm: \" &lt;&lt; script.pgm &lt;&lt; std::endl;\r\n        \/\/ Add other fields as needed\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Still learning about these generative AI tools. My assessment is that it is a Hugh leap in Natural Language Processing.\u00a0 And for programming, might enable us to weave generated pieces into a coherent product faster.\u00a0 It will also allow program creation that might not otherwise happen. Here is a prompt that I gave Bing copilot &#8211; no thrills With the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[31,30],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using copilot to create toml reader class - Jon Allen&#039;s Linux Stuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using copilot to create toml reader class - Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"og:description\" content=\"Still learning about these generative AI tools. My assessment is that it is a Hugh leap in Natural Language Processing.\u00a0 And for programming, might enable us to weave generated pieces into a coherent product faster.\u00a0 It will also allow program creation that might not otherwise happen. Here is a prompt that I gave Bing copilot &#8211; no thrills With the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-27T02:38:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png\" \/>\n<meta name=\"author\" content=\"jonallen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jonallen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\"},\"author\":{\"name\":\"jonallen\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"headline\":\"Using copilot to create toml reader class\",\"datePublished\":\"2024-07-27T02:38:22+00:00\",\"dateModified\":\"2024-07-27T02:38:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\"},\"wordCount\":143,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"image\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png\",\"articleSection\":[\"c++\",\"ChatGPT\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\",\"name\":\"Using copilot to create toml reader class - Jon Allen&#039;s Linux Stuff\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png\",\"datePublished\":\"2024-07-27T02:38:22+00:00\",\"dateModified\":\"2024-07-27T02:38:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot.png\",\"contentUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot.png\",\"width\":933,\"height\":692},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.jibsheet.net\/linux\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using copilot to create toml reader class\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/\",\"name\":\"Jon Allen's Linux Stuff\",\"description\":\"Howto&#039;s, Observations, and stuff\",\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\",\"name\":\"jonallen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"caption\":\"jonallen\"},\"logo\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.jibsheet.net\/linux\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using copilot to create toml reader class - Jon Allen&#039;s Linux Stuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/","og_locale":"en_US","og_type":"article","og_title":"Using copilot to create toml reader class - Jon Allen&#039;s Linux Stuff","og_description":"Still learning about these generative AI tools. My assessment is that it is a Hugh leap in Natural Language Processing.\u00a0 And for programming, might enable us to weave generated pieces into a coherent product faster.\u00a0 It will also allow program creation that might not otherwise happen. Here is a prompt that I gave Bing copilot &#8211; no thrills With the [&hellip;]","og_url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/","og_site_name":"Jon Allen&#039;s Linux Stuff","article_published_time":"2024-07-27T02:38:22+00:00","og_image":[{"url":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png"}],"author":"jonallen","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jonallen","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#article","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/"},"author":{"name":"jonallen","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"headline":"Using copilot to create toml reader class","datePublished":"2024-07-27T02:38:22+00:00","dateModified":"2024-07-27T02:38:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/"},"wordCount":143,"commentCount":0,"publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"image":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage"},"thumbnailUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png","articleSection":["c++","ChatGPT"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/","url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/","name":"Using copilot to create toml reader class - Jon Allen&#039;s Linux Stuff","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage"},"image":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage"},"thumbnailUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot-300x223.png","datePublished":"2024-07-27T02:38:22+00:00","dateModified":"2024-07-27T02:38:22+00:00","breadcrumb":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#primaryimage","url":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot.png","contentUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2024\/07\/toml_copilot.png","width":933,"height":692},{"@type":"BreadcrumbList","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2024\/07\/27\/using-copilot-to-create-toml-reader-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.jibsheet.net\/linux\/"},{"@type":"ListItem","position":2,"name":"Using copilot to create toml reader class"}]},{"@type":"WebSite","@id":"https:\/\/www.jibsheet.net\/linux\/#website","url":"https:\/\/www.jibsheet.net\/linux\/","name":"Jon Allen's Linux Stuff","description":"Howto&#039;s, Observations, and stuff","publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993","name":"jonallen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","caption":"jonallen"},"logo":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.jibsheet.net\/linux"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/419"}],"collection":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/comments?post=419"}],"version-history":[{"count":1,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/419\/revisions"}],"predecessor-version":[{"id":421,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/419\/revisions\/421"}],"wp:attachment":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/media?parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/categories?post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/tags?post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}