Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4743 | Rev 4756 | ||
|---|---|---|---|
| Line 46... | Line 46... | ||
| 46 | */ |
46 | */ |
| 47 | #define CHAR_MAP_MAGIC_VALUE 0x12345611 |
47 | #define CHAR_MAP_MAGIC_VALUE 0x12345611 |
| 48 | 48 | ||
| 49 | /** Adds the value with the key to the map. |
49 | /** Adds the value with the key to the map. |
| 50 | * Creates new nodes to map the key. |
50 | * Creates new nodes to map the key. |
| 51 | * @param map The character string to integer map. Input/output parameter. |
51 | * @param[in,out] map The character string to integer map. |
| 52 | * @param identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found. Input parameter. |
52 | * @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found. |
| 53 | * @param length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found. Input parameter. |
53 | * @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found. |
| 54 | * @param value The integral value to be stored for the key character string. Input parameter. |
54 | * @param[in] value The integral value to be stored for the key character string. |
| 55 | * @returns EOK on success. |
55 | * @returns EOK on success. |
| 56 | * @returns ENOMEM if there is not enough memory left. |
56 | * @returns ENOMEM if there is not enough memory left. |
| 57 | * @returns EEXIST if the key character string is already used. |
57 | * @returns EEXIST if the key character string is already used. |
| 58 | */ |
58 | */ |
| 59 | int char_map_add_item( char_map_ref map, const char * identifier, size_t length, const int value ); |
59 | int char_map_add_item( char_map_ref map, const char * identifier, size_t length, const int value ); |
| 60 | 60 | ||
| 61 | /** Returns the node assigned to the key from the map. |
61 | /** Returns the node assigned to the key from the map. |
| 62 | * @param map The character string to integer map. Input parameter. |
62 | * @param[in] map The character string to integer map. |
| 63 | * @param identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found. Input parameter. |
63 | * @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found. |
| 64 | * @param length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found. Input parameter. |
64 | * @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found. |
| 65 | * @returns The node holding the integral value assigned to the key character string. |
65 | * @returns The node holding the integral value assigned to the key character string. |
| 66 | * @returns NULL if the key is not assigned a node. |
66 | * @returns NULL if the key is not assigned a node. |
| 67 | */ |
67 | */ |
| 68 | char_map_ref char_map_find_node( const char_map_ref map, const char * identifier, const size_t length ); |
68 | char_map_ref char_map_find_node( const char_map_ref map, const char * identifier, const size_t length ); |
| 69 | 69 | ||
| 70 | /** Returns the value assigned to the map. |
70 | /** Returns the value assigned to the map. |
| 71 | * @param map The character string to integer map. Input parameter. |
71 | * @param[in] map The character string to integer map. |
| 72 | * @returns The integral value assigned to the map. |
72 | * @returns The integral value assigned to the map. |
| 73 | * @returns CHAR_MAP_NULL if the map is not assigned a value. |
73 | * @returns CHAR_MAP_NULL if the map is not assigned a value. |
| 74 | */ |
74 | */ |
| 75 | int char_map_get_value( const char_map_ref map ); |
75 | int char_map_get_value( const char_map_ref map ); |
| 76 | 76 | ||
| 77 | /** Checks if the map is valid. |
77 | /** Checks if the map is valid. |
| 78 | * @param map The character string to integer map. Input parameter. |
78 | * @param[in] map The character string to integer map. |
| 79 | * @returns TRUE if the map is valid. |
79 | * @returns TRUE if the map is valid. |
| 80 | * @returns FALSE otherwise. |
80 | * @returns FALSE otherwise. |
| 81 | */ |
81 | */ |
| 82 | int char_map_is_valid( const char_map_ref map ); |
82 | int char_map_is_valid( const char_map_ref map ); |
| 83 | 83 | ||