Skip to content

Commit 9437bbe

Browse files
committed
Updated README.md with a simpler example
1 parent 8745be5 commit 9437bbe

File tree

1 file changed

+32
-166
lines changed

1 file changed

+32
-166
lines changed

README.md

Lines changed: 32 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -46,149 +46,35 @@ The generated functions that reads and extracts the embedded content does not
4646
# Example
4747

4848
### Input File:
49-
(index page of https://choosealicense.com/)
5049
```html
5150
<!DOCTYPE html>
5251
<html lang="en">
53-
<head itemscope itemtype="http://schema.org/WebSite">
54-
<meta charset="utf-8">
55-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
56-
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Chivo:900">
57-
<link rel="stylesheet" href="/assets/css/application.css?v=7213ccf8ac07263d66dd6aa8bf955d1bbec06117">
58-
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
59-
<!--[if lt IE 9]>
60-
<script src="/assets/vendor/html5shiv/dist/html5shiv.js"></script>
61-
<script src="/assets/vendor/selectivizr/selectivizr.js"></script>
62-
<![endif]-->
63-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
64-
<!-- Begin Jekyll SEO tag v2.3.0 -->
65-
<title>Choose an open source license | Choose a License</title>
66-
<meta property="og:title" content="Choose an open source license" />
67-
<meta property="og:locale" content="en_US" />
68-
<meta name="description" content="Non-judgmental guidance on choosing a license for your open source project" />
69-
<meta property="og:description" content="Non-judgmental guidance on choosing a license for your open source project" />
70-
<link rel="canonical" href="https://choosealicense.com/" />
71-
<meta property="og:url" content="https://choosealicense.com/" />
72-
<meta property="og:site_name" content="Choose a License" />
73-
<meta name="twitter:card" content="summary" />
74-
<meta name="twitter:site" content="@github" />
75-
<script type="application/ld+json">
76-
{"name":"Choose a License","description":"Non-judgmental guidance on choosing a license for your open source project","author":null,"@type":"WebSite","url":"https://choosealicense.com/","image":null,"publisher":null,"headline":"Choose an open source license","dateModified":null,"datePublished":null,"sameAs":null,"mainEntityOfPage":null,"@context":"http://schema.org"}</script>
77-
<!-- End Jekyll SEO tag -->
78-
</head>
79-
<body class="default home">
80-
<div class="container">
81-
<h1>Choose an open source license</h1>
82-
<h2>
83-
<span>{</span>
84-
Which of the following best describes your situation?
85-
<span>}</span>
86-
</h2>
87-
<ul class="triptych situations clearfix">
88-
<li class="whatever">
89-
<a href="licenses/mit">
90-
<span class="triptych-sprite three-arrows"></span>
91-
<h3>I want it simple and permissive.</h3>
92-
</a>
93-
<p>The <a href="licenses/mit">MIT License</a> is a permissive license that is short and to the point. It lets people do anything they want with your code as long as they provide attribution back to you and don’t hold you liable.</p>
94-
<p>
95-
<a href="https://github.com/babel/babel/blob/master/LICENSE">Babel</a>,
96-
<a href="https://github.com/dotnet/corefx/blob/master/LICENSE.TXT">.NET Core</a>, and
97-
<a href="https://github.com/rails/rails/blob/master/MIT-LICENSE">Rails</a>
98-
use the MIT License.
99-
</p>
100-
</li>
101-
<li class="patents">
102-
<a href="licenses/apache-2.0/">
103-
<span class="triptych-sprite lightbulb"></span>
104-
<h3>I’m concerned about patents.</h3>
105-
</a>
106-
<p>The <a href="licenses/apache-2.0/">Apache License 2.0</a> is a permissive license similar to the MIT License, but also provides an express grant of patent rights from contributors to users.</p>
107-
<p>
108-
<a href="https://github.com/elastic/elasticsearch/blob/master/LICENSE.txt">Elasticsearch</a>,
109-
<a href="https://github.com/kubernetes/kubernetes/blob/master/LICENSE">Kubernetes</a>, and
110-
<a href="https://github.com/apple/swift/blob/master/LICENSE.txt">Swift</a>
111-
use the Apache License 2.0.
112-
</p>
113-
</li>
114-
<li class="copyleft">
115-
<a href="licenses/gpl-3.0/">
116-
<span class="triptych-sprite circular"></span>
117-
<h3>I care about sharing improvements.</h3>
118-
</a>
119-
<p>The <a href="licenses/gpl-3.0/">GNU GPLv3</a> is a copyleft license that requires anyone who distributes your code or a derivative work to make the source available under the same terms, and also provides an express grant of patent rights from contributors to users.</p>
120-
<p>
121-
<a href="https://github.com/ansible/ansible/blob/devel/COPYING">Ansible</a>,
122-
<a href="https://git.savannah.gnu.org/cgit/bash.git/tree/COPYING">Bash</a>, and
123-
<a href="https://git.gnome.org/browse/gimp/tree/COPYING">GIMP</a>
124-
use the GNU GPLv3.
125-
</p>
126-
</li>
127-
</ul>
128-
<h2>
129-
<span>{</span>
130-
What if none of these work for me?
131-
<span>}</span>
132-
</h2>
133-
<ul class="triptych see-more clearfix">
134-
<li>
135-
<h3>My project isn’t software.</h3>
136-
<p>
137-
<a href="non-software">There are licenses for that</a>.
138-
</p>
139-
</li>
140-
<li>
141-
<h3>I want more choices.</h3>
142-
<p><a href="licenses">More licenses are available</a>.</p>
143-
</li>
144-
<li>
145-
<h3>I don’t want to choose a license.</h3>
146-
<p><a href="no-license">You don’t have to</a>.</p>
147-
</li>
148-
</ul>
149-
<footer class="site-footer clearfix">
150-
<nav>
151-
<a href="/about/">About</a>
152-
<a href="/terms-of-service/">Terms of Service</a>
153-
</nav>
154-
<p>
155-
The content of this site is licensed under the <a href="https://creativecommons.org/licenses/by/3.0/">
156-
Creative Commons Attribution 3.0 Unported License</a>.
157-
</p>
158-
<div class="with-love">
159-
Curated with &lt;3 by <a href="https://github.com">GitHub, Inc.</a> and <a href="https://github.com/github/choosealicense.com">You!</a>
160-
</div>
161-
</footer>
162-
</div> <!-- /container -->
163-
<script>
164-
!function(L,I,C,e,N,S,E){L.GoogleAnalyticsObject=N,L[N]=L[N]||function(){
165-
(L[N].q=L[N].q||[]).push(arguments)},L[N].l=+new Date,S=I.createElement(C),
166-
E=I.getElementsByTagName(C)[0],S.src=e,E.parentNode.insertBefore(S,E)
167-
}(window,document,"script","//www.google-analytics.com/analytics.js","ga");
168-
ga('create', 'UA-3769691-24', 'choosealicense.com');
169-
ga('send', 'pageview');
170-
</script>
171-
</body>
52+
<head>
53+
<meta charset="utf-8">
54+
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
55+
<title>Hello World!</title>
56+
</head>
57+
<body>
58+
Hello World!
59+
</body>
17260
</html>
17361
```
17462

17563
### Command:
17664
```batchfile
177-
bin2cpp.exe choosealicense.html .\outdir resourcechoosealicense.h ChooseALicence 250 -override
65+
bin2cpp.exe html5skeleton.html .\outdir resourcehtml5skeleton.h HtmlSample 250 -override
17866
```
17967

18068
### Console output
18169

18270
```batchfile
18371
bin2cpp v1.4
18472
Copyright (C) 2013-2017 end2endzone.com. All rights reserved.
185-
Embedding "choosealicense.html" into "resourcechoosealicense.h" using chunks of 250 bytes overriding existing files...
73+
Embedding "html5skeleton.html" into "resourcehtml5skeleton.h" using chunks of 250 bytes overriding existing files...
18674
Done.
18775
```
18876

189-
### Will produce:
190-
191-
resourcechoosealicense.h
77+
### File resourcehtml5skeleton.h
19278

19379
```cpp
19480
/**
@@ -215,32 +101,32 @@ namespace bin2cpp
215101
virtual bool save(const char * iFilename) const = 0;
216102
};
217103
#endif
218-
const File & getChooseALicenceFile();
104+
const File & getHtmlSampleFile();
219105
}; //bin2cpp
220106
```
221107

222-
resourcechoosealicense.cpp
108+
### File resourcehtml5skeleton.cpp
223109

224110
```cpp
225111
/**
226112
* This file was generated by bin2cpp v1.4.
227113
* Copyright (C) 2013-2017 end2endzone.com. All rights reserved.
228114
* Do not modify this file.
229115
*/
230-
#include "resourcechoosealicense.h"
116+
#include "resourcehtml5skeleton.h"
231117
#include <stdio.h> //for FILE
232118
#include <string> //for memcpy
233119
namespace bin2cpp
234120
{
235-
class ChooseALicenceFile : public virtual bin2cpp::File
121+
class HtmlSampleFile : public virtual bin2cpp::File
236122
{
237123
public:
238-
ChooseALicenceFile() {}
239-
~ChooseALicenceFile() {}
240-
virtual size_t getSize() const { return 6000; }
241-
virtual size_t getSegmentSize() const { return 250; }
242-
virtual size_t getNumSegments() const { return 24; }
243-
virtual const char * getFilename() const { return "choosealicense.html"; }
124+
HtmlSampleFile() {}
125+
~HtmlSampleFile() {}
126+
virtual size_t getSize() const { return 238; }
127+
virtual size_t getSegmentSize() const { return 50; }
128+
virtual size_t getNumSegments() const { return 5; }
129+
virtual const char * getFilename() const { return "html5skeleton.html"; }
244130
virtual const char * getSegment(size_t iIndex, size_t & oLength) const
245131
{
246132
oLength = 0;
@@ -249,35 +135,16 @@ namespace bin2cpp
249135
const char * buffer = NULL;
250136
size_t index = 0;
251137
oLength = getSegmentSize();
252-
buffer = "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n <head itemscope itemtype=\"http://schema.org/WebSite\">\r\n <meta charset=\"utf-8\">\r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n <link rel=\"stylesheet\" href=\"//fonts.googleapis.com/css\?family=Chiv"; if (iIndex == index) return buffer; index++;
253-
buffer = "o:900\">\r\n <link rel=\"stylesheet\" href=\"/assets/css/application.css\?v=7213ccf8ac07263d66dd6aa8bf955d1bbec06117\">\r\n <link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">\r\n <!--[if lt IE 9]>\r\n <script src=\"/assets/vendor/html5sh"; if (iIndex == index) return buffer; index++;
254-
buffer = "iv/dist/html5shiv.js\"></script>\r\n <script src=\"/assets/vendor/selectivizr/selectivizr.js\"></script>\r\n <![endif]-->\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\r\n <!-- Begin Jeky"; if (iIndex == index) return buffer; index++;
255-
buffer = "ll SEO tag v2.3.0 -->\r\n<title>Choose an open source license | Choose a License</title>\r\n<meta property=\"og:title\" content=\"Choose an open source license\" />\r\n<meta property=\"og:locale\" content=\"en_US\" />\r\n<meta name=\"description\" content=\"Non-judgmen"; if (iIndex == index) return buffer; index++;
256-
buffer = "tal guidance on choosing a license for your open source project\" />\r\n<meta property=\"og:description\" content=\"Non-judgmental guidance on choosing a license for your open source project\" />\r\n<link rel=\"canonical\" href=\"https://choosealicense.com/\" />\r"; if (iIndex == index) return buffer; index++;
257-
buffer = "\n<meta property=\"og:url\" content=\"https://choosealicense.com/\" />\r\n<meta property=\"og:site_name\" content=\"Choose a License\" />\r\n<meta name=\"twitter:card\" content=\"summary\" />\r\n<meta name=\"twitter:site\" content=\"@github\" />\r\n<script type=\"application/"; if (iIndex == index) return buffer; index++;
258-
buffer = "ld+json\">\r\n{\"name\":\"Choose a License\",\"description\":\"Non-judgmental guidance on choosing a license for your open source project\",\"author\":null,\"@type\":\"WebSite\",\"url\":\"https://choosealicense.com/\",\"image\":null,\"publisher\":null,\"headline\":\"Choose an o"; if (iIndex == index) return buffer; index++;
259-
buffer = "pen source license\",\"dateModified\":null,\"datePublished\":null,\"sameAs\":null,\"mainEntityOfPage\":null,\"@context\":\"http://schema.org\"}</script>\r\n<!-- End Jekyll SEO tag -->\r\n </head>\r\n <body class=\"default home\">\r\n <div class=\"container\">\r\n <"; if (iIndex == index) return buffer; index++;
260-
buffer = "h1>Choose an open source license</h1>\r\n<h2>\r\n <span>{</span>\r\n Which of the following best describes your situation\?\r\n <span>}</span>\r\n</h2>\r\n<ul class=\"triptych situations clearfix\">\r\n <li class=\"whatever\">\r\n <a href=\"licenses/mit\">\r\n <s"; if (iIndex == index) return buffer; index++;
261-
buffer = "pan class=\"triptych-sprite three-arrows\"></span>\r\n <h3>I want it simple and permissive.</h3>\r\n </a>\r\n <p>The <a href=\"licenses/mit\">MIT License</a> is a permissive license that is short and to the point. It lets people do anything they wan"; if (iIndex == index) return buffer; index++;
262-
buffer = "t with your code as long as they provide attribution back to you and don\222t hold you liable.</p>\r\n <p>\r\n <a href=\"https://github.com/babel/babel/blob/master/LICENSE\">Babel</a>,\r\n <a href=\"https://github.com/dotnet/corefx/blob/master/L"; if (iIndex == index) return buffer; index++;
263-
buffer = "ICENSE.TXT\">.NET Core</a>, and\r\n <a href=\"https://github.com/rails/rails/blob/master/MIT-LICENSE\">Rails</a>\r\n use the MIT License.\r\n </p>\r\n </li>\r\n <li class=\"patents\">\r\n <a href=\"licenses/apache-2.0/\">\r\n <span class=\"triptych-"; if (iIndex == index) return buffer; index++;
264-
buffer = "sprite lightbulb\"></span>\r\n <h3>I\222m concerned about patents.</h3>\r\n </a>\r\n <p>The <a href=\"licenses/apache-2.0/\">Apache License 2.0</a> is a permissive license similar to the MIT License, but also provides an express grant of patent rights"; if (iIndex == index) return buffer; index++;
265-
buffer = " from contributors to users.</p>\r\n <p>\r\n <a href=\"https://github.com/elastic/elasticsearch/blob/master/LICENSE.txt\">Elasticsearch</a>,\r\n <a href=\"https://github.com/kubernetes/kubernetes/blob/master/LICENSE\">Kubernetes</a>, and\r\n "; if (iIndex == index) return buffer; index++;
266-
buffer = " <a href=\"https://github.com/apple/swift/blob/master/LICENSE.txt\">Swift</a>\r\n use the Apache License 2.0.\r\n </p>\r\n </li>\r\n <li class=\"copyleft\">\r\n <a href=\"licenses/gpl-3.0/\">\r\n <span class=\"triptych-sprite circular\"></span>\r\n "; if (iIndex == index) return buffer; index++;
267-
buffer = " <h3>I care about sharing improvements.</h3>\r\n </a>\r\n <p>The <a href=\"licenses/gpl-3.0/\">GNU GPLv3</a> is a copyleft license that requires anyone who distributes your code or a derivative work to make the source available under the same terms, "; if (iIndex == index) return buffer; index++;
268-
buffer = "and also provides an express grant of patent rights from contributors to users.</p>\r\n <p>\r\n <a href=\"https://github.com/ansible/ansible/blob/devel/COPYING\">Ansible</a>,\r\n <a href=\"https://git.savannah.gnu.org/cgit/bash.git/tree/COPYI"; if (iIndex == index) return buffer; index++;
269-
buffer = "NG\">Bash</a>, and\r\n <a href=\"https://git.gnome.org/browse/gimp/tree/COPYING\">GIMP</a>\r\n use the GNU GPLv3.\r\n </p>\r\n </li>\r\n</ul>\r\n<h2>\r\n <span>{</span>\r\n What if none of these work for me\?\r\n <span>}</span>\r\n</h2>\r\n<ul class=\"triptych"; if (iIndex == index) return buffer; index++;
270-
buffer = " see-more clearfix\">\r\n <li>\r\n <h3>My project isn\222t software.</h3>\r\n <p>\r\n <a href=\"non-software\">There are licenses for that</a>.\r\n </p>\r\n </li>\r\n <li>\r\n <h3>I want more choices.</h3>\r\n <p><a href=\"licenses\">More licenses are a"; if (iIndex == index) return buffer; index++;
271-
buffer = "vailable</a>.</p>\r\n </li>\r\n <li>\r\n <h3>I don\222t want to choose a license.</h3>\r\n <p><a href=\"no-license\">You don\222t have to</a>.</p>\r\n </li>\r\n</ul>\r\n <footer class=\"site-footer clearfix\">\r\n <nav>\r\n <a href=\"/about/\">About<"; if (iIndex == index) return buffer; index++;
272-
buffer = "/a>\r\n <a href=\"/terms-of-service/\">Terms of Service</a>\r\n </nav>\r\n <p>\r\n The content of this site is licensed under the <a href=\"https://creativecommons.org/licenses/by/3.0/\">\r\n Creative Commons Attribution 3."; if (iIndex == index) return buffer; index++;
273-
buffer = "0 Unported License</a>.\r\n </p>\r\n <div class=\"with-love\">\r\n Curated with &lt;3 by <a href=\"https://github.com\">GitHub, Inc.</a> and <a href=\"https://github.com/github/choosealicense.com\">You!</a>\r\n </div>\r\n </footer>"; if (iIndex == index) return buffer; index++;
274-
buffer = "\r\n </div> <!-- /container -->\r\n <script>\r\n !function(L,I,C,e,N,S,E){L.GoogleAnalyticsObject=N,L[N]=L[N]||function(){\r\n (L[N].q=L[N].q||[]).push(arguments)},L[N].l=+new Date,S=I.createElement(C),\r\n E=I.getElementsByTagName(C)[0],S"; if (iIndex == index) return buffer; index++;
275-
buffer = ".src=e,E.parentNode.insertBefore(S,E)\r\n }(window,document,\"script\",\"//www.google-analytics.com/analytics.js\",\"ga\");\r\n ga(\'create\', \'UA-3769691-24\', \'choosealicense.com\');\r\n ga(\'send\', \'pageview\');\r\n </script>\r\n </body>\r\n</html>\r\n\r\n"; if (iIndex == index) return buffer; index++;
276-
oLength = 0;
138+
buffer = "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta"; if (iIndex == index) return buffer; index++;
139+
buffer = " charset=\"utf-8\">\r\n <meta name=\"viewport\" content"; if (iIndex == index) return buffer; index++;
140+
buffer = "=\"width=device-width, initial-scale=1, user-scalab"; if (iIndex == index) return buffer; index++;
141+
buffer = "le=yes\">\r\n <title>Hello World!</title>\r\n</head>\r\n"; if (iIndex == index) return buffer; index++;
142+
oLength = 38;
143+
buffer = "<body>\r\nHello World!\r\n</body>\r\n</html>"; if (iIndex == index) return buffer; index++;
277144
oLength = 0;
278145
return NULL;
279146
}
280-
virtual const char * getMd5() const { return "bd3a043766eabe41c3b69bcc3f8f24db"; }
147+
virtual const char * getMd5() const { return "85f80d7db80c1a4392dc32ecb429a8a9"; }
281148
virtual char * newBuffer() const
282149
{
283150
size_t size = getSize();
@@ -311,17 +178,16 @@ namespace bin2cpp
311178
return true;
312179
}
313180
};
314-
const File & getChooseALicenceFile() { static ChooseALicenceFile _instance; return _instance; }
181+
const File & getHtmlSampleFile() { static HtmlSampleFile _instance; return _instance; }
315182
}; //bin2cpp
316183
```
317184

318185
# Screenshots
319186

320-
[![bin2cpp v1.3 Sample](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-done.png)](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-done.png)
321-
322-
bin2cpp v1.3 Sample
187+
bin2cpp v1.3 Sample[![bin2cpp v1.3 Sample](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-done.png)](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-done.png)
323188

324-
[![bin2cpp v1.3 Usage](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-usage.png)](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-usage.png) bin2cpp v1.3 Usage
189+
bin2cpp v1.3 Usage
190+
[![bin2cpp v1.3 Usage](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-usage.png)](http://www.end2endzone.com/wp-content/uploads/2015/01/bin2cpp-v1.3-usage.png)
325191

326192
# Compatible with
327193

0 commit comments

Comments
 (0)