IOFunctions.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 SCHUNK GmbH & Co. KG
3  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10 
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef UTIL_IOFUNCTIONS_H
19 #define UTIL_IOFUNCTIONS_H
20 
21 // ---- global includes ----------------------------------------------------- ;
22 
23 #include "../Util/GlobalDefines.h"
24 #include <stdio.h>
25 #include <stdlib.h> // to use getenv
26 #include <iostream>
27 
28 #if defined(__QNX__) && defined(__WATCOMC__)
29 #include <iomanip>
30 #endif
31 
32 // ---- constants ----------------------------------------------------------- ;
33 
34 const int BUFFER_LENGTH = 256;
35 
36 const int OKAY = 0;
37 const int KEY_BUT_NO_EQUAL = 1;
38 const int NO_KEY = 2;
39 const int FOUND_EOF = 3;
40 const int NO_OPEN_BRACKET = 4;
41 const int NO_SEPERATOR = 5;
42 const int NO_CLOSED_BRACKET = 6;
43 const int KEY_BUT_WRONG_NUMBER = 7;
44 
45 // ---- local includes ------------------------------------------------------ ;
46 
47 // ---- local functions ----------------------------------------------------- ;
48 
49 int util_searchString(const char* acSectionName, const char* acKeyName, const char* acDefaultString, char* acReturnString, int iSize, const char* acFileName);
50 
51 int util_setString(const char* acSectionName, const char* acKeyName, const char* acString, const char* acFileName);
52 
53 #ifdef WITHSTREAMS
54 // checks for a given keyword and positions the stream at the
55 // corresponding argument
56 int util_posArgForKey(
57  std::istream& clIn,
58  const char* acKey,
59  int iNumber = -1,
60  char cDelim = '=');
61 
62 // generates error messsages according to a error status
63 // returned for example by posArgForKey(..)
64 void util_parseError(int iStatus,
65  const char* acKey,
66  int iNumber = -1);
67 
68 // combines posArgForKey(..) and parseError(..) to one function call
69 void util_posArgForKeyWithCheck(
70  std::istream& clIn,
71  const char* acKey,
72  int iNumber = -1,
73  char cDelim = '=');
74 
75 #endif // WITHSTREAMS
76 #endif // UTIL_IOFUNCTIONS_H
int util_searchString(const char *acSectionName, const char *acKeyName, const char *acDefaultString, char *acReturnString, int iSize, const char *acFileName)
const int KEY_BUT_NO_EQUAL
Definition: IOFunctions.h:37
const int NO_CLOSED_BRACKET
Definition: IOFunctions.h:42
const int NO_SEPERATOR
Definition: IOFunctions.h:41
const int FOUND_EOF
Definition: IOFunctions.h:39
const int KEY_BUT_WRONG_NUMBER
Definition: IOFunctions.h:43
const int OKAY
Definition: IOFunctions.h:36
int util_setString(const char *acSectionName, const char *acKeyName, const char *acString, const char *acFileName)
const int BUFFER_LENGTH
Definition: IOFunctions.h:34
const int NO_OPEN_BRACKET
Definition: IOFunctions.h:40
const int NO_KEY
Definition: IOFunctions.h:38


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Mon Nov 25 2019 03:48:19