PCL
GlobalSettings.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.7.0
6 // ----------------------------------------------------------------------------
7 // pcl/GlobalSettings.h - Released 2024-06-18T15:48:54Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2024 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_GlobalSettings_h
53 #define __PCL_GlobalSettings_h
54 
56 
57 #include <pcl/Defs.h>
58 #include <pcl/Diagnostics.h>
59 
60 #include <pcl/Color.h>
61 #include <pcl/String.h>
62 
63 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
64 #include <pcl/Font.h>
65 #endif
66 
67 namespace pcl
68 {
69 
70 // ----------------------------------------------------------------------------
71 
87 namespace GlobalVariableType
88 {
89  enum value_type
90  {
91  Undefined, // The requested global variable doesn't exist
92  Flag, // bool
93  Integer, // int
94  Unsigned, // unsigned
95  Real, // double
96  Color, // RGBA (= uint32)
97  Font, // Font
98  String // String
99  };
100 }
101 
102 // ----------------------------------------------------------------------------
103 
396 class PCL_CLASS PixInsightSettings
397 {
398 public:
399 
403  using variable_type = GlobalVariableType::value_type;
404 
409  PixInsightSettings() = delete;
410 
416 
421  PixInsightSettings& operator =( const PixInsightSettings& ) = delete;
422 
427  virtual ~PixInsightSettings() = delete;
428 
432  static variable_type GlobalVariableType( const IsoString& globalId );
433 
438  static bool IsGlobalVariableDefined( const IsoString& globalId )
439  {
440  return GlobalVariableType( globalId ) != GlobalVariableType::Undefined;
441  }
442 
446  static bool GlobalFlag( const IsoString& globalId );
447 
451  static int GlobalInteger( const IsoString& globalId );
452 
456  static unsigned GlobalUnsigned( const IsoString& globalId );
457 
461  static double GlobalReal( const IsoString& globalId );
462 
466  static RGBA GlobalColor( const IsoString& globalId );
467 
468 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
472  static Font GlobalFont( const IsoString& globalId );
473 #endif
474 
478  static String GlobalString( const IsoString& globalId );
479 
485  static void BeginUpdate();
486 
492  static void EndUpdate();
493 
503  static void CancelUpdate();
504 
508  static void SetGlobalFlag( const IsoString& globalId, bool );
509 
513  static void SetGlobalInteger( const IsoString& globalId, int );
514 
518  static void SetGlobalUnsigned( const IsoString& globalId, unsigned );
519 
523  static void SetGlobalReal( const IsoString& globalId, double );
524 
528  static void SetGlobalColor( const IsoString& globalId, RGBA );
529 
530 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
534  static void SetGlobalFont( const IsoString& globalId, const Font& );
535 #endif
536 
540  static void SetGlobalString( const IsoString& globalId, const String& );
541 };
542 
543 // ----------------------------------------------------------------------------
544 
545 } // pcl
546 
547 #endif // __PCL_GlobalSettings_h
548 
549 // ----------------------------------------------------------------------------
550 // EOF pcl/GlobalSettings.h - Released 2024-06-18T15:48:54Z
Client-side interface to a PixInsight Font object.
Definition: Font.h:207
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5425
Retrieves global settings from the PixInsight core application.
static Font GlobalFont(const IsoString &globalId)
static void SetGlobalFlag(const IsoString &globalId, bool)
static void SetGlobalUnsigned(const IsoString &globalId, unsigned)
static void SetGlobalString(const IsoString &globalId, const String &)
virtual ~PixInsightSettings()=delete
static bool GlobalFlag(const IsoString &globalId)
PixInsightSettings(const PixInsightSettings &)=delete
static void BeginUpdate()
static void SetGlobalInteger(const IsoString &globalId, int)
static bool IsGlobalVariableDefined(const IsoString &globalId)
static RGBA GlobalColor(const IsoString &globalId)
static void SetGlobalReal(const IsoString &globalId, double)
static void CancelUpdate()
static double GlobalReal(const IsoString &globalId)
static variable_type GlobalVariableType(const IsoString &globalId)
static unsigned GlobalUnsigned(const IsoString &globalId)
static void SetGlobalColor(const IsoString &globalId, RGBA)
static String GlobalString(const IsoString &globalId)
static void SetGlobalFont(const IsoString &globalId, const Font &)
static void EndUpdate()
static int GlobalInteger(const IsoString &globalId)
Unicode (UTF-16) string.
Definition: String.h:8113
uint32 RGBA
Definition: Color.h:92
PCL root namespace.
Definition: AbstractImage.h:77