1 /* svn_token.h : value/string-token functions
3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
27 #include "svn_error.h"
32 #endif /* __cplusplus */
35 /** A mapping between a string STR and an enumeration value VAL.
37 * Maps are an array of these, terminated with a struct where STR == NULL.
39 typedef struct svn_token_map_t
46 /* A value used by some token functions to indicate an unrecognized token. */
47 #define SVN_TOKEN_UNKNOWN (-9999)
50 /* Return the string form of the given VALUE as found in MAP. If the value
51 is not recognized, then a MALFUNCTION will occur. */
53 svn_token__to_word(const svn_token_map_t *map,
57 /* NOTE: in the following functions, if WORD is NULL, then SVN_TOKEN_UNKNOWN
58 will be returned, or will cause the appropriate MALFUNCTION or ERROR. */
60 /* Return the integer value of the given token WORD, as found in MAP. If the
61 string is not recognized, then a MALFUNCTION will occur.
63 Note: this function is for persisted string values. Because this function
64 will throw a MALFUNCTION, it should not be used for network input or
67 svn_token__from_word_strict(const svn_token_map_t *map,
71 /* Store the integer value of WORD into *VALUE. If the string is not
72 recognized, then SVN_ERR_BAD_TOKEN is returned. */
74 svn_token__from_word_err(int *value,
75 const svn_token_map_t *map,
79 /* Return the integer value of the given token WORD as found in MAP. If the
80 string is not recognized, then SVN_TOKEN_UNKNOWN will be returned. */
82 svn_token__from_word(const svn_token_map_t *map,
86 /* Return the integer value of the given token WORD/LEN as found in MAP. If
87 the string is not recognized, then SVN_TOKEN_UNKNOWN will be returned. */
89 svn_token__from_mem(const svn_token_map_t *map,
96 #endif /* __cplusplus */
98 #endif /* SVN_TOKEN_H */