IDHelpers.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  @file IDHelpers.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@supagro.inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_TOOLS_IDHELPERS_HPP__
41 #define __OPENFLUID_TOOLS_IDHELPERS_HPP__
42 
43 #include <string>
44 
45 #include <openfluid/core/TypeDefs.hpp>
47 #include <openfluid/dllexport.hpp>
48 
49 
50 namespace openfluid { namespace tools {
51 
52 
54 
55 
56 /**
57  Checks whether an alphanumeric name is valid or not.\n
58  To be valid, a name must only contain alphanumeric characters.
59  @param[in] Name the name to check
60  @return true if the name is valid
61 */
62 bool OPENFLUID_API isValidAlphaNumName(const std::string& Name);
63 
64 
65 /**
66  Checks whether a ware ID is valid or not.\n
67  To be valid, a ware ID must only contain alphanumeric, '_', '-', '.' characters,
68  and must begin by an alphanumeric character.
69  @param[in] ID the ware ID to check
70  @return true if the ID is valid
71 */
73 
74 
75 /**
76  Checks whether a variable name (without type) is valid or not.\n
77  To be valid, a variable name must only contain alphanumeric, '_', '-' or '.' characters,
78  and must begin by an alphanumeric character.
79  @param[in] Name the variable name to check
80  @return true if the name is valid
81 */
83 
84 
85 /**
86  Checks whether a variable name (with or without type) is valid or not.\n
87  To be valid, a variable name must only contain alphanumeric, '_', '-' or '.' characters,
88  must begin by an alphanumeric character, and can be suffixed by a valid type into square brackets.
89  @param[in] Name the variable name to check
90  @return true if the name is valid
91 */
93 
94 
95 /**
96  Checks whether an attribute name is valid or not.\n
97  To be valid, an attribute name must only contain alphanumeric, '_', '-' or '.' characters,
98  and must begin by an alphanumeric character.
99  @param[in] Name the attribute name to check
100  @return true if the name is valid
101 */
103 
104 
105 /**
106  Checks and extracts variable name and type from a full variable name (with or without type).\n
107  To be valid, a variable name must only contain alphanumeric, '_', '-' or '.' characters,
108  must begin by an alphanumeric character, and can be suffixed by a valid type into square brackets.
109  @param[in] Name the variable name to process
110  @param[out] VarName the extracted variable name
111  @param[out] VarType the extracted variable type
112  @return true if the check and extraction are OK
113 */
117 
118 } } // namespaces
119 
120 
121 #endif /* __OPENFLUID_TOOLS_IDHELPERS_HPP__ */
bool OPENFLUID_API extractVariableNameAndType(const openfluid::core::VariableName_t &Name, openfluid::core::VariableName_t &VarName, openfluid::core::Value::Type &VarType)
std::string UnitsClass_t
Definition: TypeDefs.hpp:71
std::string VariableName_t
Definition: TypeDefs.hpp:86
bool OPENFLUID_API isValidAttributeName(const openfluid::core::AttributeName_t &Name)
std::string WareID_t
Definition: TypeDefs.hpp:50
std::string OPENFLUID_API classIDToString(const openfluid::core::UnitsClass_t &Class, openfluid::core::UnitID_t ID)
Type
Definition: Value.hpp:68
bool OPENFLUID_API isValidWareID(const openfluid::ware::WareID_t &ID)
bool OPENFLUID_API isValidAlphaNumName(const std::string &Name)
Definition: ApplicationException.hpp:47
std::string AttributeName_t
Definition: TypeDefs.hpp:81
#define OPENFLUID_API
Definition: dllexport.hpp:87
bool OPENFLUID_API isValidTypedVariableName(const openfluid::core::VariableName_t &Name)
bool OPENFLUID_API isValidVariableName(const openfluid::core::VariableName_t &Name)
unsigned int UnitID_t
Definition: TypeDefs.hpp:61