mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Fixed the NOMINMAX issue for Windows build with latest termcolor #76, replaced #pragma once with #ifndef-define pairs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_BLOCK_PROGRESS_BAR
|
||||
#define INDICATORS_BLOCK_PROGRESS_BAR
|
||||
|
||||
#include <indicators/color.hpp>
|
||||
#include <indicators/details/stream_helper.hpp>
|
||||
@@ -285,3 +286,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_STREAM_HELPER
|
||||
#define INDICATORS_STREAM_HELPER
|
||||
|
||||
#include <indicators/display_width.hpp>
|
||||
#include <indicators/setting.hpp>
|
||||
@@ -217,4 +218,6 @@ private:
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
} // namespace indicators
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_DISPLAY_WIDTH
|
||||
#define INDICATORS_DISPLAY_WIDTH
|
||||
|
||||
#include <clocale>
|
||||
#if __has_include(<codecvt>)
|
||||
#include <codecvt>
|
||||
@@ -312,3 +314,5 @@ static inline int display_width(const std::wstring &input) {
|
||||
#endif
|
||||
|
||||
} // namespace unicode
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_DYNAMIC_PROGRESS
|
||||
#define INDICATORS_DYNAMIC_PROGRESS
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <indicators/color.hpp>
|
||||
@@ -113,3 +115,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_INDETERMINATE_PROGRESS_BAR
|
||||
#define INDICATORS_INDETERMINATE_PROGRESS_BAR
|
||||
|
||||
#include <indicators/details/stream_helper.hpp>
|
||||
|
||||
@@ -232,3 +233,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_MULTI_PROGRESS
|
||||
#define INDICATORS_MULTI_PROGRESS
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
@@ -77,3 +78,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_PROGRESS_BAR
|
||||
#define INDICATORS_PROGRESS_BAR
|
||||
|
||||
#include <indicators/details/stream_helper.hpp>
|
||||
|
||||
@@ -355,3 +356,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_PROGRESS_SPINNER
|
||||
#define INDICATORS_PROGRESS_SPINNER
|
||||
|
||||
#include <indicators/details/stream_helper.hpp>
|
||||
|
||||
@@ -222,3 +223,5 @@ public:
|
||||
};
|
||||
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,9 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_PROGRESS_TYPE
|
||||
#define INDICATORS_PROGRESS_TYPE
|
||||
|
||||
namespace indicators {
|
||||
enum class ProgressType { incremental, decremental };
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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 <cstddef>
|
||||
#include <indicators/color.hpp>
|
||||
@@ -217,3 +218,5 @@ using ProgressType = details::Setting<ProgressType, details::ProgressBarOption::
|
||||
using Stream = details::Setting<std::ostream &, details::ProgressBarOption::stream>;
|
||||
} // namespace option
|
||||
} // namespace indicators
|
||||
|
||||
#endif
|
||||
@@ -40,6 +40,11 @@
|
||||
#if defined(TERMCOLOR_TARGET_POSIX)
|
||||
# include <unistd.h>
|
||||
#elif defined(TERMCOLOR_TARGET_WINDOWS)
|
||||
#if defined(_MSC_VER)
|
||||
#if !defined(NOMINMAX)
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#endif
|
||||
# include <io.h>
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#ifndef INDICATORS_TERMINAL_SIZE
|
||||
#define INDICATORS_TERMINAL_SIZE
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -40,3 +41,4 @@ static inline size_t terminal_width() { return terminal_size().second; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user