libUPnP
1.8.0
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
upnp
src
inc
strintmap.h
1
2
//
3
// Copyright (c) 2000-2003 Intel Corporation
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are met:
8
//
9
// * Redistributions of source code must retain the above copyright notice,
10
// this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above copyright notice,
12
// this list of conditions and the following disclaimer in the documentation
13
// and/or other materials provided with the distribution.
14
// * Neither name of Intel Corporation nor the names of its contributors
15
// may be used to endorse or promote products derived from this software
16
// without specific prior written permission.
17
//
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
22
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
//
31
32
#ifndef GENLIB_UTIL_STRINTMAP_H
33
#define GENLIB_UTIL_STRINTMAP_H
34
35
#include <stdlib.h>
36
#include "util.h"
37
38
// Util to map from a string to an integer and vice versa
39
40
typedef
struct
// str_int_entry
41
{
42
char
*name;
// a value in string form
43
int
id;
// same value in integer form
44
}
str_int_entry
;
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
50
/************************************************************************
51
* Function : map_str_to_int
52
*
53
* Parameters :
54
* IN const char* name ; string containing the name to be matched
55
* IN size_t name_len ; size of the string to be matched
56
* IN str_int_entry* table ; table of entries that need to be
57
* matched.
58
* IN int num_entries ; number of entries in the table that need
59
* to be searched.
60
* IN xboolean case_sensitive ; whether the case should be case
61
* sensitive or not
62
*
63
* Description : Match the given name with names from the entries in the
64
* table. Returns the index of the table when the entry is found.
65
*
66
* Return : int ;
67
* index - On Success
68
* -1 - On failure
69
*
70
* Note :
71
************************************************************************/
72
int
map_str_to_int( IN
const
char
* name, IN
size_t
name_len,
73
IN
str_int_entry
* table, IN
int
num_entries,
74
IN xboolean case_sensitive );
75
76
77
/************************************************************************
78
* Function : map_int_to_str
79
*
80
* Parameters :
81
* IN int id ; ID to be matched
82
* IN str_int_entry* table ; table of entries that need to be
83
* matched.
84
* IN int num_entries ; number of entries in the table that need
85
* to be searched.
86
*
87
* Description : Returns the index from the table where the id matches
88
* the entry from the table.
89
*
90
* Return : int ;
91
*
92
* Note :
93
************************************************************************/
94
int
map_int_to_str( IN
int
id
, IN
str_int_entry
* table,
95
IN
int
num_entries );
96
97
#ifdef __cplusplus
98
}
// extern C
99
#endif
100
101
102
#endif // GENLIB_UTIL_STRINTMAP_H
Generated on Fri Dec 16 2016 21:00:29 for libUPnP by
1.8.1.2