9.2
general documentation
cs_gui_util.h
Go to the documentation of this file.
1#ifndef CS_GUI_UTIL_H
2#define CS_GUI_UTIL_H
3
4/*============================================================================
5 * Management of the GUI parameters file: xpath request and utilities
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_base.h"
35#include "base/cs_tree.h"
36
37/*=============================================================================
38 * Public function prototypes
39 *============================================================================*/
40
41/*----------------------------------------------------------------------------
42 * Load the XML file in memory.
43 *
44 * parameter:
45 * filename <-- XML file containing the parameters
46 *
47 * returns:
48 * error code (0 in case of success)
49 *----------------------------------------------------------------------------*/
50
51int
52cs_gui_load_file(const char *filename);
53
54/*-----------------------------------------------------------------------------
55 * Check the xml file version.
56 *----------------------------------------------------------------------------*/
57
58void
60
61/*-----------------------------------------------------------------------------
62 * Return the number of characters needed to print an integer number
63 *
64 * parameters:
65 * num <-- integer number
66 *
67 * returns:
68 * number of characters required
69 *----------------------------------------------------------------------------*/
70
71int
73
74/*-----------------------------------------------------------------------------
75 * Compare two strings.
76 *
77 * parameters:
78 * s1 <-- first string
79 * s2 <-- second string
80 *
81 * returns:
82 * 1 if the strings are equal, 0 otherwise.
83 *----------------------------------------------------------------------------*/
84
85int
86cs_gui_strcmp(const char *s1,
87 const char *s2);
88
89/*-----------------------------------------------------------------------------
90 * Test if 2 real values are equal (avoiding compiler warnings)
91 *
92 * parameters:
93 * v1 <-- first value to compare
94 * v2 <-- second value to compare
95 *
96 * returns:
97 * 1 if values are equal, 0 otherwise
98 *----------------------------------------------------------------------------*/
99
100int
102 cs_real_t v2);
103
104/*----------------------------------------------------------------------------*/
114/*----------------------------------------------------------------------------*/
115
116void
117cs_gui_node_get_int(cs_tree_node_t *node,
118 int *value);
119
120/*----------------------------------------------------------------------------*/
130/*----------------------------------------------------------------------------*/
131
132void
133cs_gui_node_get_real(cs_tree_node_t *node,
134 cs_real_t *value);
135
136/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148void
149cs_gui_node_get_status_int(cs_tree_node_t *node,
150 int *status);
151
152/*----------------------------------------------------------------------------*/
162/*----------------------------------------------------------------------------*/
163
164void
165cs_gui_node_get_status_bool(cs_tree_node_t *node,
166 bool *status);
167
168/*----------------------------------------------------------------------------*/
180/*----------------------------------------------------------------------------*/
181
182const char *
183cs_gui_node_get_tag(cs_tree_node_t *node,
184 const char *tag_name);
185
186/*----------------------------------------------------------------------------*/
197/*----------------------------------------------------------------------------*/
198
199void
200cs_gui_node_get_child_int(cs_tree_node_t *node,
201 const char *child_name,
202 int *value);
203
204/*----------------------------------------------------------------------------*/
215/*----------------------------------------------------------------------------*/
216
217void
218cs_gui_node_get_child_real(cs_tree_node_t *node,
219 const char *child_name,
220 cs_real_t *value);
221
222/*----------------------------------------------------------------------------*/
234/*----------------------------------------------------------------------------*/
235
236void
237cs_gui_node_get_child_status_int(cs_tree_node_t *node,
238 const char *child_name,
239 int *status);
240
241/*----------------------------------------------------------------------------*/
253/*----------------------------------------------------------------------------*/
254
255void
256cs_gui_node_get_child_status_bool(cs_tree_node_t *node,
257 const char *child_name,
258 bool *status);
259
260/*----------------------------------------------------------------------------*/
261
262#endif /* CS_GUI_UTIL_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
void cs_gui_node_get_status_bool(cs_tree_node_t *node, bool *status)
Update an bool-valued status value based on a node's status tag.
Definition: cs_gui_util.cpp:341
void cs_gui_node_get_child_status_bool(cs_tree_node_t *node, const char *child_name, bool *status)
Update a bool-valued status value based on a node child's status tag.
Definition: cs_gui_util.cpp:509
void cs_gui_node_get_int(cs_tree_node_t *node, int *value)
Update an integer value based on a tree node.
Definition: cs_gui_util.cpp:248
int cs_gui_is_equal_real(cs_real_t v1, cs_real_t v2)
Definition: cs_gui_util.cpp:218
void cs_gui_node_get_child_int(cs_tree_node_t *node, const char *child_name, int *value)
Update an integer value based on a tree's child node.
Definition: cs_gui_util.cpp:400
void cs_gui_node_get_real(cs_tree_node_t *node, cs_real_t *value)
Update an real value based on a tree node.
Definition: cs_gui_util.cpp:281
void cs_gui_check_version(void)
Check the XML file version.
Definition: cs_gui_util.cpp:117
void cs_gui_node_get_child_real(cs_tree_node_t *node, const char *child_name, cs_real_t *value)
Update an integer value based on a tree's child node.
Definition: cs_gui_util.cpp:437
int cs_gui_load_file(const char *filename)
Load the XML file in memory.
Definition: cs_gui_util.cpp:98
const char * cs_gui_node_get_tag(cs_tree_node_t *node, const char *tag_name)
Return a string value associated with a "tag" child node and whose presence should be guaranteed.
Definition: cs_gui_util.cpp:370
void cs_gui_node_get_child_status_int(cs_tree_node_t *node, const char *child_name, int *status)
Update an integer-valued status value based on a node child's status tag.
Definition: cs_gui_util.cpp:475
int cs_gui_strcmp(const char *s1, const char *s2)
Definition: cs_gui_util.cpp:197
void cs_gui_node_get_status_int(cs_tree_node_t *node, int *status)
Update an integer-valued status value based on a node's status tag.
Definition: cs_gui_util.cpp:314
int cs_gui_characters_number(int num)
Definition: cs_gui_util.cpp:169