MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / findSwitch

Method findSwitch

src/common/classes/Switches.cpp:69–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69const Switches::in_sw_tab_t* Switches::findSwitch(Firebird::string sw, bool* invalidSwitchInd) const
70{
71/**************************************
72 *
73 * f i n d S w i t c h
74 *
75 **************************************
76 *
77 * Functional description
78 * Returns pointer to in_sw_tab entry for current switch
79 * If not a switch, returns NULL.
80 * If no match, invalidSwitch is set to true (if the pointer is given)
81 *
82 **************************************/
83 if (sw.isEmpty() || sw[0] != switch_char)
84 {
85 return 0;
86 }
87 if (sw.length() == 1)
88 {
89 if (invalidSwitchInd)
90 *invalidSwitchInd = true;
91 return 0;
92 }
93
94 sw.erase(0, 1);
95 sw.upper();
96
97 FB_SIZE_T iter = 0;
98 for (const in_sw_tab_t* in_sw_tab = m_base; in_sw_tab->in_sw_name; ++in_sw_tab, ++iter)
99 {
100 if ((!m_minLength || sw.length() >= in_sw_tab->in_sw_min_length) &&
101 matchSwitch(sw, in_sw_tab->in_sw_name, m_opLengths[iter]))
102 {
103 return in_sw_tab;
104 }
105 }
106 fb_assert(iter == m_count - 1);
107 if (invalidSwitchInd)
108 *invalidSwitchInd = true;
109
110 return 0;
111}
112
113Switches::in_sw_tab_t* Switches::findSwitchMod(Firebird::string& sw, bool* invalidSwitchInd)
114{

Callers 7

aliceFunction · 0.80
svc_api_gbakFunction · 0.80
get_function_optionFunction · 0.80
nbackupFunction · 0.80
get_switchesFunction · 0.80
validateFunction · 0.80
fbtraceFunction · 0.80

Calls 4

upperMethod · 0.80
isEmptyMethod · 0.45
lengthMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected