diff --git a/include/indicators/block_progress_bar.hpp b/include/indicators/block_progress_bar.hpp index 6913c98..d5c87cd 100644 --- a/include/indicators/block_progress_bar.hpp +++ b/include/indicators/block_progress_bar.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_BLOCK_PROGRESS_BAR +#define INDICATORS_BLOCK_PROGRESS_BAR #include #include @@ -285,3 +286,5 @@ public: }; } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/color.hpp b/include/indicators/color.hpp index 7fdf352..19dc0e5 100644 --- a/include/indicators/color.hpp +++ b/include/indicators/color.hpp @@ -1,6 +1,9 @@ -#pragma once +#ifndef INDICATORS_COLOR +#define INDICATORS_COLOR namespace indicators { enum class Color { grey, red, green, yellow, blue, magenta, cyan, white, unspecified }; } + +#endif diff --git a/include/indicators/cursor_control.hpp b/include/indicators/cursor_control.hpp index 2bfcb06..6669cd7 100644 --- a/include/indicators/cursor_control.hpp +++ b/include/indicators/cursor_control.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_CURSOR_CONTROL +#define INDICATORS_CURSOR_CONTROL #if defined(_MSC_VER) #if !defined(NOMINMAX) @@ -33,4 +34,6 @@ static inline void show_console_cursor(bool const show) { #endif -} // namespace indicators \ No newline at end of file +} // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/cursor_movement.hpp b/include/indicators/cursor_movement.hpp index 2ae09f0..1081b7f 100644 --- a/include/indicators/cursor_movement.hpp +++ b/include/indicators/cursor_movement.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_CURSOR_MOVEMENT +#define INDICATORS_CURSOR_MOVEMENT #if defined(_MSC_VER) #if !defined(NOMINMAX) @@ -44,4 +45,6 @@ static inline void move_left(int cols) { std::cout << "\033[" << cols << "D"; } #endif -} // namespace indicators \ No newline at end of file +} // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/details/stream_helper.hpp b/include/indicators/details/stream_helper.hpp index baad820..c7b4977 100644 --- a/include/indicators/details/stream_helper.hpp +++ b/include/indicators/details/stream_helper.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_STREAM_HELPER +#define INDICATORS_STREAM_HELPER #include #include @@ -217,4 +218,6 @@ private: }; } // namespace details -} // namespace indicators \ No newline at end of file +} // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/display_width.hpp b/include/indicators/display_width.hpp index 31b3e54..85057f4 100644 --- a/include/indicators/display_width.hpp +++ b/include/indicators/display_width.hpp @@ -1,5 +1,7 @@ -#pragma once +#ifndef INDICATORS_DISPLAY_WIDTH +#define INDICATORS_DISPLAY_WIDTH + #include #if __has_include() #include @@ -312,3 +314,5 @@ static inline int display_width(const std::wstring &input) { #endif } // namespace unicode + +#endif \ No newline at end of file diff --git a/include/indicators/dynamic_progress.hpp b/include/indicators/dynamic_progress.hpp index 64d9d5d..44c31a0 100644 --- a/include/indicators/dynamic_progress.hpp +++ b/include/indicators/dynamic_progress.hpp @@ -1,5 +1,7 @@ -#pragma once +#ifndef INDICATORS_DYNAMIC_PROGRESS +#define INDICATORS_DYNAMIC_PROGRESS + #include #include #include @@ -113,3 +115,5 @@ public: }; } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/font_style.hpp b/include/indicators/font_style.hpp index 4937470..cb0b480 100644 --- a/include/indicators/font_style.hpp +++ b/include/indicators/font_style.hpp @@ -1,5 +1,9 @@ -#pragma once +#ifndef INDICATORS_FONT_STYLE +#define INDICATORS_FONT_STYLE + namespace indicators { enum class FontStyle { bold, dark, italic, underline, blink, reverse, concealed, crossed }; } + +#endif diff --git a/include/indicators/indeterminate_progress_bar.hpp b/include/indicators/indeterminate_progress_bar.hpp index 37964c7..08d6ae4 100644 --- a/include/indicators/indeterminate_progress_bar.hpp +++ b/include/indicators/indeterminate_progress_bar.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_INDETERMINATE_PROGRESS_BAR +#define INDICATORS_INDETERMINATE_PROGRESS_BAR #include @@ -232,3 +233,5 @@ public: }; } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/multi_progress.hpp b/include/indicators/multi_progress.hpp index 9ab60dd..16a9dc4 100644 --- a/include/indicators/multi_progress.hpp +++ b/include/indicators/multi_progress.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_MULTI_PROGRESS +#define INDICATORS_MULTI_PROGRESS #include #include #include @@ -77,3 +78,5 @@ public: }; } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/progress_bar.hpp b/include/indicators/progress_bar.hpp index 61fba74..63e6e15 100644 --- a/include/indicators/progress_bar.hpp +++ b/include/indicators/progress_bar.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_PROGRESS_BAR +#define INDICATORS_PROGRESS_BAR #include @@ -355,3 +356,5 @@ public: }; } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/progress_spinner.hpp b/include/indicators/progress_spinner.hpp index 09e0b13..51e92b2 100644 --- a/include/indicators/progress_spinner.hpp +++ b/include/indicators/progress_spinner.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_PROGRESS_SPINNER +#define INDICATORS_PROGRESS_SPINNER #include @@ -222,3 +223,5 @@ public: }; } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/progress_type.hpp b/include/indicators/progress_type.hpp index 2ea1347..54da1e8 100644 --- a/include/indicators/progress_type.hpp +++ b/include/indicators/progress_type.hpp @@ -1,6 +1,9 @@ -#pragma once +#ifndef INDICATORS_PROGRESS_TYPE +#define INDICATORS_PROGRESS_TYPE namespace indicators { enum class ProgressType { incremental, decremental }; } + +#endif \ No newline at end of file diff --git a/include/indicators/setting.hpp b/include/indicators/setting.hpp index 9bd569c..7298258 100644 --- a/include/indicators/setting.hpp +++ b/include/indicators/setting.hpp @@ -25,7 +25,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#pragma once +#ifndef INDICATORS_SETTING +#define INDICATORS_SETTING #include #include @@ -217,3 +218,5 @@ using ProgressType = details::Setting; } // namespace option } // namespace indicators + +#endif \ No newline at end of file diff --git a/include/indicators/termcolor.hpp b/include/indicators/termcolor.hpp index ca684ef..3e82bdc 100644 --- a/include/indicators/termcolor.hpp +++ b/include/indicators/termcolor.hpp @@ -40,6 +40,11 @@ #if defined(TERMCOLOR_TARGET_POSIX) # include #elif defined(TERMCOLOR_TARGET_WINDOWS) +#if defined(_MSC_VER) +#if !defined(NOMINMAX) +#define NOMINMAX +#endif +#endif # include # include #endif diff --git a/include/indicators/terminal_size.hpp b/include/indicators/terminal_size.hpp index 169dd5b..0d03077 100644 --- a/include/indicators/terminal_size.hpp +++ b/include/indicators/terminal_size.hpp @@ -1,5 +1,6 @@ -#pragma once +#ifndef INDICATORS_TERMINAL_SIZE +#define INDICATORS_TERMINAL_SIZE #include @@ -40,3 +41,4 @@ static inline size_t terminal_width() { return terminal_size().second; } #endif +#endif \ No newline at end of file diff --git a/single_include/indicators/indicators.hpp b/single_include/indicators/indicators.hpp index 71f0411..57b6c15 100644 --- a/single_include/indicators/indicators.hpp +++ b/single_include/indicators/indicators.hpp @@ -1,20 +1,35 @@ -#pragma once +#ifndef INDICATORS_COLOR +#define INDICATORS_COLOR namespace indicators { enum class Color { grey, red, green, yellow, blue, magenta, cyan, white, unspecified }; } -#pragma once +#endif + + + +#ifndef INDICATORS_FONT_STYLE +#define INDICATORS_FONT_STYLE + namespace indicators { enum class FontStyle { bold, dark, italic, underline, blink, reverse, concealed, crossed }; } -#pragma once +#endif + + + +#ifndef INDICATORS_PROGRESS_TYPE +#define INDICATORS_PROGRESS_TYPE namespace indicators { enum class ProgressType { incremental, decremental }; } + +#endif + //! //! termcolor //! ~~~~~~~~~ @@ -57,6 +72,11 @@ enum class ProgressType { incremental, decremental }; #if defined(TERMCOLOR_TARGET_POSIX) # include #elif defined(TERMCOLOR_TARGET_WINDOWS) +#if defined(_MSC_VER) +#if !defined(NOMINMAX) +#define NOMINMAX +#endif +#endif # include # include #endif @@ -927,7 +947,10 @@ namespace termcolor #endif // TERMCOLOR_HPP_ -#pragma once + + +#ifndef INDICATORS_TERMINAL_SIZE +#define INDICATORS_TERMINAL_SIZE #include @@ -968,6 +991,8 @@ static inline size_t terminal_width() { return terminal_size().second; } #endif +#endif + /* Activity Indicators for Modern C++ @@ -995,29 +1020,39 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#pragma once +#ifndef INDICATORS_SETTING +#define INDICATORS_SETTING #include // #include - +#ifndef INDICATORS_COLOR +#define INDICATORS_COLOR namespace indicators { enum class Color { grey, red, green, yellow, blue, magenta, cyan, white, unspecified }; } +#endif + // #include +#ifndef INDICATORS_FONT_STYLE +#define INDICATORS_FONT_STYLE namespace indicators { enum class FontStyle { bold, dark, italic, underline, blink, reverse, concealed, crossed }; } -// #include +#endif +// #include +#ifndef INDICATORS_PROGRESS_TYPE +#define INDICATORS_PROGRESS_TYPE namespace indicators { enum class ProgressType { incremental, decremental }; } +#endif #include #include #include @@ -1205,7 +1240,11 @@ using Stream = details::Setting +#ifndef INDICATORS_DISPLAY_WIDTH +#define INDICATORS_DISPLAY_WIDTH #include #if __has_include() @@ -1603,6 +1654,7 @@ static inline int display_width(const std::wstring &input) { } // namespace unicode +#endif // #include /* Activity Indicators for Modern C++ @@ -1630,7 +1682,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +#ifndef INDICATORS_SETTING +#define INDICATORS_SETTING #include // #include @@ -1823,6 +1876,7 @@ using Stream = details::Setting//! //! termcolor //! ~~~~~~~~~ @@ -1865,6 +1919,11 @@ using Stream = details::Setting #elif defined(TERMCOLOR_TARGET_WINDOWS) +#if defined(_MSC_VER) +#if !defined(NOMINMAX) +#define NOMINMAX +#endif +#endif # include # include #endif @@ -2949,10 +3008,16 @@ private: } // namespace details } // namespace indicators -#pragma once + +#endif + + +#ifndef INDICATORS_PROGRESS_BAR +#define INDICATORS_PROGRESS_BAR // #include - +#ifndef INDICATORS_STREAM_HELPER +#define INDICATORS_STREAM_HELPER // #include // #include @@ -3172,6 +3237,8 @@ private: } // namespace details } // namespace indicators +#endif + #include #include #include @@ -3179,7 +3246,8 @@ private: // #include // #include // #include - +#ifndef INDICATORS_TERMINAL_SIZE +#define INDICATORS_TERMINAL_SIZE #include @@ -3220,7 +3288,7 @@ static inline size_t terminal_width() { return terminal_size().second; } #endif - +#endif #include #include #include @@ -3567,7 +3635,11 @@ public: } // namespace indicators -#pragma once +#endif + + +#ifndef INDICATORS_BLOCK_PROGRESS_BAR +#define INDICATORS_BLOCK_PROGRESS_BAR // #include // #include @@ -3854,7 +3926,11 @@ public: } // namespace indicators -#pragma once +#endif + + +#ifndef INDICATORS_INDETERMINATE_PROGRESS_BAR +#define INDICATORS_INDETERMINATE_PROGRESS_BAR // #include @@ -4088,7 +4164,11 @@ public: } // namespace indicators -#pragma once +#endif + + +#ifndef INDICATORS_MULTI_PROGRESS +#define INDICATORS_MULTI_PROGRESS #include #include #include @@ -4097,7 +4177,8 @@ public: // #include // #include - +#ifndef INDICATORS_CURSOR_MOVEMENT +#define INDICATORS_CURSOR_MOVEMENT #if defined(_MSC_VER) #if !defined(NOMINMAX) @@ -4143,6 +4224,8 @@ static inline void move_left(int cols) { std::cout << "\033[" << cols << "D"; } #endif } // namespace indicators + +#endif // #include namespace indicators { @@ -4213,7 +4296,12 @@ public: } // namespace indicators -#pragma once +#endif + + +#ifndef INDICATORS_DYNAMIC_PROGRESS +#define INDICATORS_DYNAMIC_PROGRESS + #include #include // #include @@ -4328,7 +4416,11 @@ public: } // namespace indicators -#pragma once +#endif + + +#ifndef INDICATORS_PROGRESS_SPINNER +#define INDICATORS_PROGRESS_SPINNER // #include @@ -4551,3 +4643,6 @@ public: }; } // namespace indicators + +#endif + diff --git a/utils/amalgamate/amalgamate.py b/utils/amalgamate/amalgamate.py index f68b79d..c20fc8f 100644 --- a/utils/amalgamate/amalgamate.py +++ b/utils/amalgamate/amalgamate.py @@ -62,7 +62,7 @@ class Amalgamation(object): return None def __init__(self, args): - with open(args.config, 'r', encoding="utf8") as f: + with open(args.config, 'r') as f: config = json.loads(f.read()) for key in config: setattr(self, key, config[key]) @@ -77,7 +77,7 @@ class Amalgamation(object): amalgamation = "" if self.prologue: - with open(self.prologue, 'r', encoding="utf8") as f: + with open(self.prologue, 'r') as f: amalgamation += datetime.datetime.now().strftime(f.read()) if self.verbose: @@ -92,7 +92,7 @@ class Amalgamation(object): # actual_path = self.actual_path(file_path) print(" - processing \"{0}\"".format(file_path)) t = TranslationUnit(file_path, self, True) - amalgamation += t.content + amalgamation += t.content + "\n\n" with open(self.target, 'w', encoding="utf8") as f: f.write(amalgamation)