LCOV - code coverage report
Current view: top level - source/gui/SettingTypes - CGUIColor.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 1 2 50.0 %
Date: 2023-01-19 00:18:29 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /* Copyright (C) 2021 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #ifndef INCLUDED_GUICOLOR
      19             : #define INCLUDED_GUICOLOR
      20             : 
      21             : #include "graphics/Color.h"
      22             : #include "ps/CStrForward.h"
      23             : 
      24             : class CGUI;
      25             : 
      26             : /**
      27             :  * Same as the CColor class, but this one can also parse colors predefined in the GUI page (such as "yellow").
      28             :  */
      29             : struct CGUIColor : CColor
      30             : {
      31             :     // Take advantage of compiler warnings if unintentionally copying this
      32             :     NONCOPYABLE(CGUIColor);
      33             : 
      34             :     // Defines move semantics so that the structs using the class can use it.
      35             :     MOVABLE(CGUIColor);
      36             : 
      37        1935 :     CGUIColor() : CColor() {}
      38             : 
      39           0 :     CGUIColor(float r, float g, float b, float a) : CColor(r, g, b, a) {}
      40             : 
      41             :     /**
      42             :      * Load color depending on current GUI page.
      43             :      */
      44             :     bool ParseString(const CGUI& pGUI, const CStr8& value, int defaultAlpha = 255);
      45             : 
      46             :     /**
      47             :      * Ensure that all users check for predefined colors.
      48             :      */
      49             :     bool ParseString(const CStr8& value, int defaultAlpha = 255) = delete;
      50             : };
      51             : #endif // INCLUDED_GUICOLOR

Generated by: LCOV version 1.13