RAVE
rave_utilities.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2009 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of RAVE.
5
6RAVE is free software: you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11RAVE is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with RAVE. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
26#ifndef RAVE_UTILITIES_H
27#define RAVE_UTILITIES_H
28#include "rave_attribute.h"
29#include "raveobject_list.h"
31#include <strings.h>
32
33#ifdef _MSC_VER
34#ifndef strncasecmp
35#define strcasecmp(x, y) _stricmp(x,y)
36#endif
37#endif
38
46int RaveUtilities_addLongAttributeToList(RaveObjectList_t* l, const char* name, long value);
47
55int RaveUtilities_addDoubleAttributeToList(RaveObjectList_t* l, const char* name, double value);
56
64int RaveUtilities_addStringAttributeToList(RaveObjectList_t* l, const char* name, const char* value);
65
74int RaveUtilities_replaceLongAttributeInList(RaveObjectList_t* l, const char* name, long value);
75
84int RaveUtilities_replaceDoubleAttributeInList(RaveObjectList_t* l, const char* name, double value);
85
94int RaveUtilities_replaceStringAttributeInList(RaveObjectList_t* l, const char* name, const char* value);
95
102
111
119
126char* RaveUtilities_trimText(const char* str, int len);
127
134char* RaveUtilities_toLower(const char* str, int len);
135
142char* RaveUtilities_toUpper(const char* str, int len);
143
151RaveList_t* RaveUtilities_getTrimmedTokens(const char* str, int c);
152
160int RaveUtilities_arrayContains(const char* arr[], const char* str, int casecmp);
161
168
174
180
187char* RaveUtilities_handleSourceVersion(const char* source, RaveIO_ODIM_Version version);
188
198int RaveUtilities_isSourceValid(const char* source, RaveIO_ODIM_Version version);
199
200#endif /* RAVE_UTILITIES_H */
Used for keeping track on attributes.
struct _RaveList_t RaveList_t
Defines a list.
Definition rave_list.h:33
RaveIO_ODIM_Version
The /Conventions version in a ODIM HDF5 file.
Definition rave_types.h:43
char * RaveUtilities_trimText(const char *str, int len)
Trims the text from all leading and trailing whitespaces.
Definition rave_utilities.c:205
char * RaveUtilities_toUpper(const char *str, int len)
Translates a string to upper case.
Definition rave_utilities.c:258
int RaveUtilities_addDoubleAttributeToList(RaveObjectList_t *l, const char *name, double value)
Adds a double attribute to an object list.
Definition rave_utilities.c:49
void RaveUtilities_removeAttributeFromList(RaveObjectList_t *l, const char *name)
Removes the rave attribute with specified name from the list.
Definition rave_utilities.c:162
char * RaveUtilities_toLower(const char *str, int len)
Translates a string to lower case.
Definition rave_utilities.c:242
int RaveUtilities_getRaveAttributeDoubleFromHash(RaveObjectHashTable_t *h, const char *name, double *v)
Gets the double value from a rave attribute that resides in a hash table.
Definition rave_utilities.c:182
int RaveUtilities_addStringAttributeToList(RaveObjectList_t *l, const char *name, const char *value)
Adds a string attribute to an object list.
Definition rave_utilities.c:64
int RaveUtilities_isLegacyProjEnabled(void)
Returns if legacy PROJ (PROJ.4 and PROJ 5) is enabled or not.
Definition rave_utilities.c:375
int RaveUtilities_arrayContains(const char *arr[], const char *str, int casecmp)
Checks if the array arr contains the string str.
Definition rave_utilities.c:335
int RaveUtilities_isCFConventionSupported(void)
Returns if CF convention IO support is activated or not.
Definition rave_utilities.c:366
int RaveUtilities_isXmlSupported(void)
Returns if xml support is activated or not since expat support is optional and ought to be tested.
Definition rave_utilities.c:357
int RaveUtilities_replaceStringAttributeInList(RaveObjectList_t *l, const char *name, const char *value)
Replaces the content of a attribute in the object list.
Definition rave_utilities.c:134
int RaveUtilities_addLongAttributeToList(RaveObjectList_t *l, const char *name, long value)
Adds a long attribute to an object list.
Definition rave_utilities.c:34
char * RaveUtilities_handleSourceVersion(const char *source, RaveIO_ODIM_Version version)
Handles the source value according to version.
Definition rave_utilities.c:384
int RaveUtilities_replaceDoubleAttributeInList(RaveObjectList_t *l, const char *name, double value)
Replaces the content of a attribute in the object list.
Definition rave_utilities.c:107
int RaveUtilities_isSourceValid(const char *source, RaveIO_ODIM_Version version)
Verifies if the source is valid according to ODIM version rules.
Definition rave_utilities.c:427
RaveList_t * RaveUtilities_getTrimmedTokens(const char *str, int c)
Returns a list of tokens delimited by 'c'.
Definition rave_utilities.c:274
int RaveUtilities_iswhitespace(char c)
Returns if the character is a whitespace character or not, i.e.
Definition rave_utilities.c:199
int RaveUtilities_replaceLongAttributeInList(RaveObjectList_t *l, const char *name, long value)
Replaces the content of a attribute in the object list.
Definition rave_utilities.c:79
Implementation of a rave object hashtable that maps between strings and rave core objects.
struct _RaveObjectHashTable_t RaveObjectHashTable_t
Defines a hash table.
Definition raveobject_hashtable.h:38
Implementation of a rave object list that ensures that the objects contained within the list are rele...
struct _RaveObjectList_t RaveObjectList_t
Defines a list.
Definition raveobject_list.h:38