Skip to content

Commit 13e34f3

Browse files
authored
Merge pull request #75 from end2endzone/feature-issue29
Feature issue29 Fixes #29
2 parents cbad6d2 + 2c4f032 commit 13e34f3

29 files changed

+2067
-52
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Changes for 3.1.0:
22

3+
* Fixed issue #29: Create arguments to filter files found with '--dir' argument.
34
* Fixed issue #63: Context class redesign. Move arguments handling into a Context class.
45
* Fixed issue #64: Remove build artifacts of samples from installation packages.
56
* Fixed issue #72: Move the code FileManager class generation code into its own IGenerator implementation.

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ SET(BIN2CPP_VERSION_PATCH 0)
102102
set(BIN2CPP_VERSION ${BIN2CPP_VERSION_MAJOR}.${BIN2CPP_VERSION_MINOR}.${BIN2CPP_VERSION_PATCH})
103103
FILE(WRITE ${CMAKE_BINARY_DIR}/version "${BIN2CPP_VERSION}")
104104

105+
# Force c++ 11
106+
# https://www.reddit.com/r/cpp_questions/comments/1d4tt8a/comment/l6gqea5/
107+
# My guess is that you are on mac and using g++ to compile. For godforsaken reasons, g++ by default is an alias to clang++ forced into some crazy C++98 mode.
108+
# https://stackoverflow.com/questions/10851247/how-do-i-activate-c-11-in-cmake
109+
set (CMAKE_CXX_STANDARD 11)
110+
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
111+
105112
# Create a c++ file header from the project LICENSE file.
106113
# The c++ header will be added to all generated files.
107114
include(MakeCplusplusHeader)
@@ -180,6 +187,9 @@ add_subdirectory(src/bin2cpp)
180187

181188
# unit tests
182189
if(BIN2CPP_BUILD_TEST)
190+
# Create a temp directory under the build directory to output temporary files.
191+
make_directory(${CMAKE_CURRENT_BINARY_DIR}/temp)
192+
183193
add_subdirectory(test/testfilegenerator)
184194
add_subdirectory(test/bin2cpp_unittest)
185195
endif()

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Build:
1818
| Service/Platform | Build | Tests |
1919
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2020
| AppVeyor | [![Build status](https://img.shields.io/appveyor/ci/end2endzone/bin2cpp/master.svg?logo=AppVeyor&logoColor=white)](https://ci.appveyor.com/project/end2endzone/bin2cpp) | [![Tests status](https://img.shields.io/appveyor/tests/end2endzone/bin2cpp/master.svg?logo=AppVeyor&logoColor=white)](https://ci.appveyor.com/project/end2endzone/bin2cpp/branch/master/tests) |
21-
| Travis CI | [![Build Status](https://img.shields.io/travis/end2endzone/bin2cpp/master.svg?logo=Travis-CI&style=flat&logoColor=white)](https://travis-ci.org/end2endzone/bin2cpp) | |
2221
| Windows Server 2019 | [![Build on Windows](https://github.com/end2endzone/bin2cpp/actions/workflows/build_windows.yml/badge.svg)](https://github.com/end2endzone/bin2cpp/actions/workflows/build_windows.yml) | [![Tests on Windows](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/end2endzone/58cf6c72c08e706335337d5ef9ca48e8/raw/bin2cpp.master.Windows.json)](https://github.com/end2endzone/bin2cpp/actions/workflows/build_windows.yml) |
2322
| Ubuntu 20.04 | [![Build on Linux](https://github.com/end2endzone/bin2cpp/actions/workflows/build_linux.yml/badge.svg)](https://github.com/end2endzone/bin2cpp/actions/workflows/build_linux.yml) | [![Tests on Linux](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/end2endzone/58cf6c72c08e706335337d5ef9ca48e8/raw/bin2cpp.master.Linux.json)](https://github.com/end2endzone/bin2cpp/actions/workflows/build_linux.yml) |
2423
| macOS 10.15 | [![Build on macOS](https://github.com/end2endzone/bin2cpp/actions/workflows/build_macos.yml/badge.svg)](https://github.com/end2endzone/bin2cpp/actions/workflows/build_macos.yml) | [![Tests on macOS](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/end2endzone/58cf6c72c08e706335337d5ef9ca48e8/raw/bin2cpp.master.macOS.json)](https://github.com/end2endzone/bin2cpp/actions/workflows/build_macos.yml) |
@@ -86,7 +85,6 @@ The following section shows how to use bin2cpp with code examples:
8685

8786

8887
## Command Line Usage
89-
9088
```
9189
bin2cpp --file=<path> --output=<path> [--headerfile=<name>] [--identifier=<name>]
9290
[--generator=<name>] [--encoding=<name>] [--chunksize=<value>] [--namespace=<value>]
@@ -95,6 +93,7 @@ bin2cpp --file=<path> --output=<path> [--headerfile=<name>] [--identifier=<name>
9593
bin2cpp --dir=<path> --output=<path> [--keepdirs]
9694
[--generator=<name>] [--encoding=<name>] [--chunksize=<value>] [--namespace=<value>]
9795
[--baseclass=<name>] [--managerfile=<name>] [--registerfile]
96+
[--dirincludefilter=<value>] [--direxcludefilter=<value>]
9897
[--override] [--noheader] [--quiet]
9998
bin2cpp --help
10099
bin2cpp --version
@@ -117,12 +116,33 @@ bin2cpp --version
117116
| --reportedfilepath=&lt;path&gt; | The relative reported path of the File. Path returned when calling method getFilePath() of the File class. Automatically calculated when --dir mode is used.<br>ie: images/DCIM/IMG_0001.jpg |
118117
| --managerfile=&lt;path&gt; | File name or relative path of the generated C++ header file for the FileManager class.<br>ie: FileManager.h. |
119118
| --registerfile | Register the generated file to the FileManager class. This flags is automatically set when parameter 'managerfile' is specified. |
119+
| --dirincludefilter=&lt;value&gt;| Set a positive filter on the input directory to only select files matching the filter. Wildcard characters are accepted. Separate each filter with the character ':'. Valid only when --dir is used. See wildcard characters definition below. |
120+
| --direxcludefilter=&lt;value&gt;| Set a negative filter on the input directory to skip files matching the filter. Wildcard characters are accepted. Separate each filter with the character ':'. Valid only when --dir is used. See wildcard characters definition below. The exclude filter has precedence over the include filter. |
120121
| --keepdirs | Keep the directory structure. Forces the output files to have the same directory structure as the input files. Valid only when --dir is used. |
121122
| --plainoutput | Print the encoded string in plain format to stdout. Useful for scripts and integration with third party application. |
122123
| --override | Tells bin2cpp to overwrite the destination files. |
123124
| --noheader | Do not print program header to standard output. |
124125
| --quiet | Do not log any message to standard output. |
125126

127+
&nbsp;
128+
129+
Wildcard characters:
130+
| Wildcard | Description |
131+
|:-----------:|--------------------------------------------------------------|
132+
| `?` | Matches any single character. |
133+
| `*` | Matches zero or more characters. |
134+
| `#` | Matches exactly one numeric digit (0-9). |
135+
| [charlist] | Matches any single character inside the brackets. |
136+
| [a-z] | Matches any single lowercase letter between 'a' and 'z'. |
137+
| [A-Z] | Matches any single uppercase letter between 'A' and 'A'. |
138+
| [0-9] | Matches any single digit between '0' and '9'. |
139+
| [a-zA-Z0-9] | Matches any single letter (uppercase or lowercase) or digit. |
140+
141+
For example:
142+
* `ker*##.???` matches files that starts with `ker`, and ends with 2 digits, a dot and then 3 characters.
143+
* `--dir-include-filter="*.jpg:*.png"` includes all files whose file extension is `jpg` or `png`.
144+
* `--dir-exclude-filter="*.bak"` excludes all backup files.
145+
* `--dir-include-filter="*.log" --dir-exclude-filter="debug.log"` includes all log files but not the one specificaly named `debug.log`.
126146

127147

128148
## Example 1 - single file
20.7 KB
Loading
Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
6-
<title>Contact</title>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Contact Us</title>
7+
<style>
8+
body { font-family: Arial, sans-serif; margin: 40px; }
9+
.container { max-width: 600px; margin: auto; }
10+
label { display: block; margin-top: 10px; }
11+
input, textarea { width: 100%; padding: 10px; margin-top: 5px; }
12+
button { margin-top: 15px; padding: 10px 20px; background-color: blue; color: white; border: none; cursor: pointer; }
13+
.profile-image-container {
14+
text-align: center; /* Centers the image horizontally */
15+
}
16+
.profile-image-container img {
17+
width: 300px;
18+
height: auto; /* Keeps aspect ratio */
19+
}
20+
</style>
721
</head>
822
<body>
9-
<article id="post-13" class="post-13 page type-page status-publish hentry wpautop">
10-
<header class="entry-header">
11-
<h1 class="entry-title">Contact</h1>
12-
</header>
13-
<div class="entry-content">
14-
<p>Feel free to contact me about your DIY projects!</p>
15-
<div role="form" class="wpcf7" id="wpcf7-f2524-p13-o1" lang="en-US" dir="ltr">
16-
<div class="screen-reader-response">
17-
<p role="status" aria-live="polite" aria-atomic="true"></p>
18-
<ul></ul>
23+
24+
<div class="container">
25+
<h2>Contact Me</h2>
26+
<div class="profile-image-container">
27+
<img class="foobar" src="../static/profile-picture.jpg">
1928
</div>
2029
<form action="/contact/#wpcf7-f2524-p13-o1" method="post" class="wpcf7-form init" novalidate="novalidate" data-status="init">
2130
<p>Your Name (required)<br>
@@ -37,7 +46,7 @@ <h1 class="entry-title">Contact</h1>
3746
<p><input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit" aria-invalid="false"><span class="ajax-loader"></span></p>
3847
<div class="wpcf7-response-output" aria-hidden="true"></div>
3948
</form>
40-
</div>
41-
</article>
49+
</div>
50+
4251
</body>
4352
</html>
3.19 KB
Binary file not shown.
Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,76 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
6-
<title>Website root</title>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Nature & Outdoors Blog</title>
7+
<link id="theme-style" rel="stylesheet" href="static/light-mode.css">
8+
<style>
9+
.navbar {
10+
display: flex;
11+
justify-content: space-between;
12+
align-items: center;
13+
background-color: #4CAF50;
14+
padding: 15px;
15+
}
16+
.navbar a {
17+
color: white;
18+
text-decoration: none;
19+
padding: 15px 20px;
20+
font-size: 18px;
21+
}
22+
.navbar a:hover {
23+
background-color: rgba(255, 255, 255, 0.2);
24+
border-radius: 5px;
25+
}
26+
.nav-right {
27+
margin-left: auto;
28+
}
29+
.switch-theme {
30+
background-color: #FFA726;
31+
padding: 10px;
32+
border: none;
33+
color: white;
34+
font-size: 16px;
35+
cursor: pointer;
36+
border-radius: 5px;
37+
transition: background 0.3s ease;
38+
}
39+
.switch-theme:hover {
40+
background-color: #FB8C00;
41+
}
42+
.content {
43+
max-width: 800px;
44+
margin: 50px auto;
45+
padding: 20px;
46+
text-align: center;
47+
}
48+
</style>
749
</head>
850
<body>
9-
Website root!
51+
52+
<nav class="navbar">
53+
<a href="index.html">Home</a>
54+
<a href="blog/index.html">Blog</a>
55+
<a href="contact/index.html">Contact</a>
56+
<button class="switch-theme nav-right" onclick="toggleTheme()">Switch Theme</button>
57+
</nav>
58+
59+
<div class="content">
60+
<h1>Welcome to the Nature & Outdoors Blog</h1>
61+
<p>Immerse yourself in the beauty of nature. Discover breathtaking landscapes, essential hiking tips, and the wonders of wildlife.</p>
62+
63+
<p>Our goal is to inspire adventure and share knowledge on preserving the great outdoors. From national parks to hidden gems, we've got it all.</p>
64+
65+
<p>Whether you're a seasoned explorer or a beginner, join us in appreciating the natural world like never before.</p>
66+
</div>
67+
68+
<script>
69+
function toggleTheme() {
70+
const themeStyle = document.getElementById("theme-style");
71+
themeStyle.href = themeStyle.href.includes("light-mode.css") ? "static/dark-mode.css" : "static/light-mode.css";
72+
}
73+
</script>
74+
1075
</body>
1176
</html>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Nature & Outdoors Blog</title>
7+
<link id="theme-style" rel="stylesheet" href="static/light-mode.css">
8+
<link id="theme-style" rel="stylesheet" href="static/dark-mode.css">
9+
<style>
10+
.navbar {
11+
display: flex;
12+
justify-content: center;
13+
background-color: #4CAF50;
14+
padding: 15px;
15+
}
16+
.navbar a {
17+
color: white;
18+
text-decoration: none;
19+
padding: 15px 20px;
20+
font-size: 18px;
21+
}
22+
.navbar a:hover {
23+
background-color: rgba(255, 255, 255, 0.2);
24+
border-radius: 5px;
25+
}
26+
.content {
27+
max-width: 800px;
28+
margin: 50px auto;
29+
padding: 20px;
30+
text-align: center;
31+
}
32+
.switch-theme {
33+
background-color: #FFA726;
34+
padding: 10px;
35+
border: none;
36+
color: white;
37+
font-size: 16px;
38+
cursor: pointer;
39+
border-radius: 5px;
40+
transition: background 0.3s ease;
41+
}
42+
.switch-theme:hover {
43+
background-color: #FB8C00;
44+
}
45+
</style>
46+
</head>
47+
<body>
48+
49+
<nav class="navbar">
50+
<a href="home/index.html">Home</a>
51+
<a href="blog/index.html">Blog</a>
52+
<a href="contact/index.html">Contact</a>
53+
</nav>
54+
55+
<div class="content">
56+
<h1>Welcome to the Nature & Outdoors Blog</h1>
57+
<p>Immerse yourself in the beauty of nature. Discover breathtaking landscapes, essential hiking tips, and the wonders of wildlife.</p>
58+
59+
<p>Our goal is to inspire adventure and share knowledge on preserving the great outdoors. From national parks to hidden gems, we've got it all.</p>
60+
61+
<p>Whether you're a seasoned explorer or a beginner, join us in appreciating the natural world like never before.</p>
62+
63+
<button class="switch-theme" onclick="toggleTheme()">Switch Theme</button>
64+
</div>
65+
66+
<script>
67+
function toggleTheme() {
68+
const themeStyle = document.getElementById("theme-style");
69+
themeStyle.href = themeStyle.href.includes("light-mode.css") ? "dark-mode.css" : "light-mode.css";
70+
}
71+
</script>
72+
73+
</body>
74+
</html>
42.3 KB
Loading
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
body {
2+
font-family: 'Arial', sans-serif;
3+
background-color: #1B1F22; /* Deep charcoal */
4+
color: #E3E6D5; /* Soft cream text */
5+
margin: 0;
6+
padding: 0;
7+
}
8+
9+
.container {
10+
max-width: 800px;
11+
margin: auto;
12+
padding: 20px;
13+
}
14+
15+
h1, h2, h3 {
16+
color: #A5C882; /* Muted pastel green */
17+
}
18+
19+
a {
20+
color: #CFAE6D; /* Warm golden brown for links */
21+
text-decoration: none;
22+
transition: color 0.3s ease;
23+
}
24+
25+
a:hover {
26+
color: #E0C085; /* Lightened golden shade */
27+
}
28+
29+
.button {
30+
background-color: #689F38; /* Earthy green */
31+
color: white;
32+
padding: 10px 15px;
33+
border: none;
34+
border-radius: 5px;
35+
cursor: pointer;
36+
transition: background 0.3s ease;
37+
}
38+
39+
.button:hover {
40+
background-color: #4E7931; /* Slightly darker green */
41+
}

0 commit comments

Comments
 (0)