MCPcopy Create free account
hub / github.com/OSGeo/PROJ / pj_param_exists

Function pj_param_exists

src/param.cpp:72–107  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

70
71/**************************************************************************************/
72paralist *pj_param_exists(paralist *list, const char *parameter) {
73 /***************************************************************************************
74 Determine whether a given parameter exists in a paralist. If it does,
75 return a pointer to the corresponding list element - otherwise return 0.
76
77 In support of the pipeline syntax, the search is terminated once a
78 "+step" list element is reached, in which case a 0 is returned, unless the
79 parameter searched for is actually "step", in which case a pointer to the
80 "step" list element is returned.
81
82 This function is equivalent to the pj_param (...) call with the "opt"
83 argument set to the parameter name preceeeded by a 't'. But by using this
84 one, one avoids writing the code allocating memory for a new copy of
85 parameter name, and prepending the t (for compile time known names, this is
86 obviously not an issue).
87 ***************************************************************************************/
88 paralist *next = list;
89 const char *c = strchr(parameter, '=');
90 size_t len = strlen(parameter);
91 if (c)
92 len = c - parameter;
93 if (list == nullptr)
94 return nullptr;
95
96 for (next = list; next; next = next->next) {
97 if (0 == strncmp(parameter, next->param, len) &&
98 (next->param[len] == '=' || next->param[len] == 0)) {
99 next->used = 1;
100 return next;
101 }
102 if (0 == strcmp(parameter, "step"))
103 return nullptr;
104 }
105
106 return nullptr;
107}
108
109/************************************************************************/
110/* pj_param() */

Callers 15

pj_paramFunction · 0.85
setup_pushpopFunction · 0.85
cs2cs_emulation_setupFunction · 0.85
torad_coordFunction · 0.85
todeg_coordFunction · 0.85
PJ_PROJECTIONFunction · 0.85
axisswap.cppFile · 0.85
set.cppFile · 0.85
topocentric.cppFile · 0.85
read_conventionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected