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@inra.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_TOOLS_IDHELPERS_HPP__
41 #define __OPENFLUID_TOOLS_IDHELPERS_HPP__
42 
43 
44 #include <string>
45 
46 #include <openfluid/core/TypeDefs.hpp>
48 #include <openfluid/dllexport.hpp>
49 
50 
51 namespace openfluid { namespace tools {
52 
53 /**
54  Generates string from class and ID of a spatial unit using the "Class#ID" pattern.
55  @param[in] Class The units class
56  @param[in] ID The unit ID
57  @return the generated string
58 */
60 
61 
62 /**
63  Checks whether an alphanumeric name is valid or not.\n
64  To be valid, a name must only contain alphanumeric characters.
65  @param[in] Name the name to check
66  @return true if the name is valid
67 */
68 bool OPENFLUID_API isValidAlphaNumName(const std::string& Name);
69 
70 
71 /**
72  Checks whether a ware ID is valid or not.\n
73  To be valid, a ware ID must only contain alphanumeric, '_', '-', '.' characters,
74  and must begin by an alphanumeric character.
75  @param[in] ID the ware ID to check
76  @return true if the ID is valid
77 */
79 
80 
81 /**
82  Checks whether a variable name (without type) is valid or not.\n
83  To be valid, a variable name must only contain alphanumeric, '_', '-' or '.' characters,
84  and must begin by an alphanumeric character.
85  @param[in] Name the variable name to check
86  @return true if the name is valid
87 */
89 
90 
91 /**
92  Checks whether a variable name (with or without type) is valid or not.\n
93  To be valid, a variable name must only contain alphanumeric, '_', '-' or '.' characters,
94  must begin by an alphanumeric character, and can be suffixed by a valid type into square brackets.
95  @param[in] Name the variable name to check
96  @return true if the name is valid
97 */
99 
100 
101 /**
102  Checks whether an attribute name is valid or not.\n
103  To be valid, an attribute name must only contain alphanumeric, '_', '-' or '.' characters,
104  and must begin by an alphanumeric character.
105  @param[in] Name the attribute name to check
106  @return true if the name is valid
107 */
109 
110 
111 /**
112  Checks and extracts variable name and type from a full variable name (with or without type).\n
113  To be valid, a variable name must only contain alphanumeric, '_', '-' or '.' characters,
114  must begin by an alphanumeric character, and can be suffixed by a valid type into square brackets.
115  @param[in] Name the variable name to process
116  @param[out] VarName the extracted variable name
117  @param[out] VarType the extracted variable type
118  @return true if the check and extraction are OK
119 */
123 
124 } } // namespaces
125 
126 
127 #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)
bool OPENFLUID_API isValidVariableName(const openfluid::core::VariableName_t &Name)
Type
Definition: Value.hpp:68
bool OPENFLUID_API isValidTypedVariableName(const openfluid::core::VariableName_t &Name)
std::string OPENFLUID_API classIDToString(const openfluid::core::UnitsClass_t &Class, openfluid::core::UnitID_t ID)
std::string AttributeName_t
Definition: TypeDefs.hpp:81
std::string WareID_t
Definition: TypeDefs.hpp:49
bool OPENFLUID_API isValidAlphaNumName(const std::string &Name)
bool OPENFLUID_API isValidWareID(const openfluid::ware::WareID_t &ID)
bool OPENFLUID_API isValidAttributeName(const openfluid::core::AttributeName_t &Name)
Definition: ApplicationException.hpp:47
std::string VariableName_t
Definition: TypeDefs.hpp:86
std::string UnitsClass_t
Definition: TypeDefs.hpp:71
unsigned int UnitID_t
Definition: TypeDefs.hpp:61
#define OPENFLUID_API
Definition: dllexport.hpp:86