Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IProperty.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* IProperty.h (C) 2000-2025 */
9/* */
10/* Property interface. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IPROPERTY_H
13#define ARCANE_CORE_IPROPERTY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28class IPropertyValue;
29class IPropertyType;
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35/*!
36 * \internal
37 * \brief Definition of types for properties.
38 */
40{
41 public:
42
43 virtual ~Property() = default;
44
45 public:
46
47 //! Kind of a property
49 {
50 PkSimple, //!< Simple kind (Real, integer, string, ...)
51 PkEnum, //!< Enumerated kind
52 PkExtended, //!< Extended kind
53 PkComplex //!< Complex kind containing sub-types
54 };
55 //! Simple type in the case of a PkSimple kind
57 {
58 StString,
59 StReal,
60 StInteger,
61 StBool
62 };
63};
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67
68/*!
69 * \internal
70 * \brief Interface of a property value.
71 */
73: public Property
74{
75 public:
76
77 //! Stores the property value in \a str
78 virtual void valueToString(String& str) const = 0;
79 //! Stores the property name in \a str
80 virtual void nameToString(String& str) const = 0;
81 //! Positions the new property value at \a str
82 virtual void setValueFromString(const String& str) = 0;
83 //! Returns whether the current value is the default value
84 virtual bool isDefaultValue() const = 0;
85 //! Returns whether the current value is the original value
86 virtual bool isOriginalValue() const = 0;
87 //! Stores the original property value in \a str
88 virtual void originalValueToString(String& str) const = 0;
89 //! Returns whether the value can be edited.
90 virtual bool canBeEdited() const = 0;
91 //! Returns the type of this property.
92 virtual IPropertyType* type() = 0;
93 //! Returns the instance associated with this value.
95};
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
99
100/*!
101 * \internal
102 * \brief Interface of a property type.
103 */
105: public Property
106{
107 public:
108
109 //! Returns the name of the type in \a str.
110 virtual void typeNameToString(String& str) const = 0;
111
112 //! Returns the kind of the property type
113 virtual ePropertyKind kind() const = 0;
114
115 /*!
116 * \brief Returns the number of possible enumerated values for the type.
117 * This method is only useful for PkEnum kind types. In
118 * other cases, it returns zero.
119 */
120 virtual Integer nbEnumeratedValue() const = 0;
121
122 /*!
123 * \brief Returns the i-th enumerated value of the type.
124 * This method is only useful for PkEnum kind types. In
125 * other cases, it returns the null string.
126 */
127 virtual String enumeratedValue(Integer i) const = 0;
128
129 /*!
130 * \brief Returns the simple type of the property storage.
131 * This method is only valid for PkSimple kind types. For all
132 * other types, it returns StString.
133 */
134 virtual eSimpleType simpleType() const = 0;
135};
136
137/*---------------------------------------------------------------------------*/
138/*---------------------------------------------------------------------------*/
139
140/*!
141 * \internal
142 * \brief Interface of a property type instance.
143 */
145: public Property
146{
147 public:
148
149 //! Stores the instance name in \a str
150 virtual void nameToString(String& str) const = 0;
151 //! Returns the type of the instance.
152 virtual IPropertyType* type() = 0;
153};
154
155/*---------------------------------------------------------------------------*/
156/*---------------------------------------------------------------------------*/
157
158} // namespace Arcane
159
160/*---------------------------------------------------------------------------*/
161/*---------------------------------------------------------------------------*/
162
163#endif
Arcane configuration file.
virtual IPropertyType * type()=0
Returns the type of the instance.
virtual void nameToString(String &str) const =0
Stores the instance name in str.
virtual ePropertyKind kind() const =0
Returns the kind of the property type.
virtual eSimpleType simpleType() const =0
Returns the simple type of the property storage. This method is only valid for PkSimple kind types....
virtual Integer nbEnumeratedValue() const =0
Returns the number of possible enumerated values for the type. This method is only useful for PkEnum ...
virtual void typeNameToString(String &str) const =0
Returns the name of the type in str.
virtual String enumeratedValue(Integer i) const =0
Returns the i-th enumerated value of the type. This method is only useful for PkEnum kind types....
virtual void originalValueToString(String &str) const =0
Stores the original property value in str.
virtual bool isOriginalValue() const =0
Returns whether the current value is the original value.
virtual void nameToString(String &str) const =0
Stores the property name in str.
virtual IPropertyType * type()=0
Returns the type of this property.
virtual void valueToString(String &str) const =0
Stores the property value in str.
virtual bool canBeEdited() const =0
Returns whether the value can be edited.
virtual IPropertyTypeInstance * typeInstance()=0
Returns the instance associated with this value.
virtual void setValueFromString(const String &str)=0
Positions the new property value at str.
virtual bool isDefaultValue() const =0
Returns whether the current value is the default value.
eSimpleType
Simple type in the case of a PkSimple kind.
Definition IProperty.h:57
ePropertyKind
Kind of a property.
Definition IProperty.h:49
@ PkSimple
Simple kind (Real, integer, string, ...).
Definition IProperty.h:50
@ PkComplex
Complex kind containing sub-types.
Definition IProperty.h:53
@ PkEnum
Enumerated kind.
Definition IProperty.h:51
@ PkExtended
Extended kind.
Definition IProperty.h:52
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.