| 111 | } |
| 112 | |
| 113 | Switches::in_sw_tab_t* Switches::findSwitchMod(Firebird::string& sw, bool* invalidSwitchInd) |
| 114 | { |
| 115 | /************************************** |
| 116 | * |
| 117 | * f i n d S w i t c h M o d |
| 118 | * |
| 119 | ************************************** |
| 120 | * |
| 121 | * Functional description |
| 122 | * Returns pointer to in_sw_tab entry for current switch |
| 123 | * If not a switch, returns NULL. |
| 124 | * |
| 125 | **************************************/ |
| 126 | fb_assert(m_copy && m_table); |
| 127 | if (!m_copy || !m_table) |
| 128 | complain("Switches: calling findSwitchMod for a const switch table"); |
| 129 | |
| 130 | if (sw.isEmpty() || sw[0] != switch_char) |
| 131 | { |
| 132 | return 0; |
| 133 | } |
| 134 | if (sw.length() == 1) |
| 135 | { |
| 136 | if (invalidSwitchInd) |
| 137 | *invalidSwitchInd = true; |
| 138 | return 0; |
| 139 | } |
| 140 | |
| 141 | sw.erase(0, 1); |
| 142 | sw.upper(); |
| 143 | |
| 144 | FB_SIZE_T iter = 0; |
| 145 | for (in_sw_tab_t* in_sw_tab = m_table; in_sw_tab->in_sw_name; ++in_sw_tab, ++iter) |
| 146 | { |
| 147 | if ((!m_minLength || sw.length() >= in_sw_tab->in_sw_min_length) && |
| 148 | matchSwitch(sw, in_sw_tab->in_sw_name, m_opLengths[iter])) |
| 149 | { |
| 150 | return in_sw_tab; |
| 151 | } |
| 152 | } |
| 153 | fb_assert(iter == m_count - 1); |
| 154 | if (invalidSwitchInd) |
| 155 | *invalidSwitchInd = true; |
| 156 | |
| 157 | return NULL; |
| 158 | } |
| 159 | |
| 160 | const Switches::in_sw_tab_t* Switches::getTable() const |
| 161 | { |
no test coverage detected