diff --git a/BUILD b/BUILD index f23c256..0465f9d 100644 --- a/BUILD +++ b/BUILD @@ -1,3 +1,30 @@ +######################################################################################################################## +# # +# @file BUILD # +# # +# @brief Defines build rules including tests for the top level utilities. # +# @copyright Copyright (C) 2023 by Tom Hicks # +# # +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated # +# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the # +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the following conditions: # +# # +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the # +# Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS # +# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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. # +# # +######################################################################################################################## load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") package( @@ -20,6 +47,37 @@ cc_test( ], ) +cc_library( + name = "console_logger", + srcs = ["console_logger.cpp"], + hdrs = ["console_logger.h"], + deps = [":logger"], +) + +cc_test( + name = "console_logger_test", + srcs = ["console_logger_test.cpp"], + deps = [ + ":console_logger", + "@tinytest", + ], +) + +cc_library( + name = "logger", + srcs = ["logger.cpp"], + hdrs = ["logger.h"], +) + +cc_test( + name = "logger_test", + srcs = ["logger_test.cpp"], + deps = [ + ":logger", + "@tinytest", + ], +) + cc_library( name = "pretty_print", srcs = ["pretty_print.cpp"], @@ -35,3 +93,21 @@ cc_test( "@tinytest", ], ) + +cc_library( + name = "windows_logger", + srcs = ["windows_logger.cpp"], + hdrs = ["windows_logger.h"], + target_compatible_with = ["@platforms//os:windows"], + deps = [":logger"], +) + +cc_test( + name = "windows_logger_test", + srcs = ["windows_logger_test.cpp"], + target_compatible_with = ["@platforms//os:windows"], + deps = [ + ":windows_logger", + "@tinytest", + ], +) diff --git a/WORKSPACE b/WORKSPACE index f8fe56a..9b19011 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,3 +1,31 @@ +######################################################################################################################## +# # +# @file WORKSPACE # +# # +# @brief Defines external modules available to all BUILD files in this workspace. This also marks the root folder of # +# the workspace # +# @copyright Copyright (C) 2023 by Tom Hicks # +# # +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated # +# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the # +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the following conditions: # +# # +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the # +# Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS # +# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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. # +# # +######################################################################################################################## load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Hedron's Compile Commands Extractor for Bazel diff --git a/ansi_escapes.cpp b/ansi_escapes.cpp index e0e7e0f..f2d9595 100644 --- a/ansi_escapes.cpp +++ b/ansi_escapes.cpp @@ -1,11 +1,31 @@ -/*************************************************************************************** - * @file ansi_escapes.cpp * - * * - * @brief Defines constants and functions for working with screen colors. * - * @copyright * - * Copyright 2023 Tom Hicks * - * Licensed under the MIT license see the LICENSE file for details. * - ***************************************************************************************/ +/********************************************************************************************************************** + * * + * @file ansi_escapes.cpp * + * * + * @brief Defines constants and functions for working with screen colors. * + * @copyright Copyright (C) 2023 by Tom Hicks * + * * + * Licensed under the MIT license see below for details. * + * * + * MIT License * + * * + * Copyright (c) 2023 Tom Hicks * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * + * the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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. * + * * + **********************************************************************************************************************/ #include "ansi_escapes.h" namespace CPPUtils { diff --git a/ansi_escapes.h b/ansi_escapes.h index 57b63b4..ff587b5 100644 --- a/ansi_escapes.h +++ b/ansi_escapes.h @@ -1,13 +1,33 @@ +/********************************************************************************************************************** + * * + * @file ansi_escapes.h * + * * + * @brief Defines constants and functions for working with screen colors. * + * @copyright Copyright (C) 2023 by Tom Hicks * + * * + * Licensed under the MIT license see below for details. * + * * + * MIT License * + * * + * Copyright (c) 2023 Tom Hicks * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * + * the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 CPP_Utils__ansi_escapes_h__ #define CPP_Utils__ansi_escapes_h__ -/*************************************************************************************** - * @file ansi_escapes.h * - * * - * @brief Defines constants and functions for working with screen colors. * - * @copyright * - * Copyright 2023 Tom Hicks * - * Licensed under the MIT license see the LICENSE file for details. * - ***************************************************************************************/ #include #include #include diff --git a/ansi_escapes_test.cpp b/ansi_escapes_test.cpp index 8d37ca3..13a70a2 100644 --- a/ansi_escapes_test.cpp +++ b/ansi_escapes_test.cpp @@ -1,11 +1,31 @@ -/*************************************************************************************** - * @file ansi_escapes_test.cpp * - * * - * @brief Defines constants and functions for working with screen colors. * - * @copyright * - * Copyright 2023 Tom Hicks * - * Licensed under the MIT license see the LICENSE file for details. * - ***************************************************************************************/ +/********************************************************************************************************************** + * * + * @file ansi_escapes_test.cpp * + * * + * @brief Defines constants and functions for working with screen colors. * + * @copyright Copyright (C) 2023 by Tom Hicks * + * * + * Licensed under the MIT license see below for details. * + * * + * MIT License * + * * + * Copyright (c) 2023 Tom Hicks * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * + * the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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. * + * * + **********************************************************************************************************************/ // clang-format off #include "ansi_escapes.h" #include "tinytest.h" diff --git a/pretty_print.cpp b/pretty_print.cpp index b8ef9e8..8f91eed 100644 --- a/pretty_print.cpp +++ b/pretty_print.cpp @@ -1,11 +1,31 @@ -/*************************************************************************************** - * @file pretty_print.cpp * - * * - * @brief Defines functions for printing objects in a frendlier manner. * - * @copyright * - * Copyright 2023 Tom Hicks * - * Licensed under the MIT license see the LICENSE file for details. * - ***************************************************************************************/ +/********************************************************************************************************************** + * * + * @file pretty_print.cpp * + * * + * @brief Defines functions for printing objects in a frendlier manner. * + * @copyright Copyright (C) 2023 by Tom Hicks * + * * + * Licensed under the MIT license see below for details. * + * * + * MIT License * + * * + * Copyright (c) 2023 Tom Hicks * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * + * the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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. * + * * + **********************************************************************************************************************/ #include "pretty_print.h" namespace CPPUtils { diff --git a/pretty_print.h b/pretty_print.h index 7fc74bb..6154363 100644 --- a/pretty_print.h +++ b/pretty_print.h @@ -1,13 +1,35 @@ +/********************************************************************************************************************** + * * + * @file pretty_print.h * + * * + * @brief Declares function templates for printing objects in a friendlier manner. * + * This specifically helps for printing stl containers, tuples, pairs, and queues as well as quoting strings * + * contained within them. * + * @copyright Copyright (C) 2023 by Tom Hicks * + * * + * Licensed under the MIT license see below for details. * + * * + * MIT License * + * * + * Copyright (c) 2023 Tom Hicks * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * + * the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 CPP_UTILS_pretty_print_h__ #define CPP_UTILS_pretty_print_h__ -/*************************************************************************************** - * @file pretty_print.cpp * - * * - * @brief Defines functions for printing objects in a frendlier manner. * - * @copyright * - * Copyright 2023 Tom Hicks * - * Licensed under the MIT license see the LICENSE file for details. * - ***************************************************************************************/ #include #include #include diff --git a/pretty_print_test.cpp b/pretty_print_test.cpp index 3f97653..0873e0d 100644 --- a/pretty_print_test.cpp +++ b/pretty_print_test.cpp @@ -1,11 +1,31 @@ -/*************************************************************************************** - * @file pretty_print_test.cpp * - * * - * @brief Defines tests for functions for printing objects in a frendlier manner. * - * @copyright * - * Copyright 2023 Tom Hicks * - * Licensed under the MIT license see the LICENSE file for details. * - ***************************************************************************************/ +/********************************************************************************************************************** + * * + * @file pretty_print_test.cpp * + * * + * @brief Defines test for the printing functions declared in pretty_print.h. * + * @copyright Copyright (C) 2023 by Tom Hicks * + * * + * Licensed under the MIT license see below for details. * + * * + * MIT License * + * * + * Copyright (c) 2023 Tom Hicks * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * + * the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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. * + * * + **********************************************************************************************************************/ // clang-format off #include "pretty_print.h" #include "tinytest.h"