1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache log4cxx: OptionConverter Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="classes.html"><span>Alphabetical List</span></a></li>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul></div>
<div class="nav">
<a class="el" href="namespacelog4cxx.html">log4cxx</a>::<a class="el" href="namespacelog4cxx_1_1helpers.html">helpers</a>::<a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html">OptionConverter</a></div>
<h1>OptionConverter Class Reference</h1><!-- doxytag: class="log4cxx::helpers::OptionConverter" --><a href="classlog4cxx_1_1helpers_1_1_option_converter-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
A convenience class to convert property values to specific types.
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#84695a8b2e45b1ab42caef5dc65534eb">convertSpecialChars</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &s)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#6ea7dcdf1610e5d7e7f3d6004db6ef3c">toBoolean</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &value, bool dEfault)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">If <code>value</code> is "true", then <code>true</code> is returned. <a href="#6ea7dcdf1610e5d7e7f3d6004db6ef3c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#c849988e20a74924dae77bc1a6e6e4fb">toInt</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &value, int dEfault)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static long </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#f0b5a6bd84b27ef758e7d6d74b362ebf">toFileSize</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &value, long dEfault)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">LevelPtr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#53e994f695af6def12f5caa8b0f2f5de">toLevel</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &value, const <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">LevelPtr</a> &defaultValue)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#06323a5e7986b04e0799254c8e313b82">findAndSubst</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &key, <a class="el" href="classlog4cxx_1_1helpers_1_1_properties.html">Properties</a> &props)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Find the value corresponding to <code>key</code> in <code>props</code>. <a href="#06323a5e7986b04e0799254c8e313b82"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#45b8aeeafeace89385672ffab025e9d1">substVars</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &val, <a class="el" href="classlog4cxx_1_1helpers_1_1_properties.html">Properties</a> &props)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Perform variable substitution in string <code>val</code> from the values of keys found in the system propeties. <a href="#45b8aeeafeace89385672ffab025e9d1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#e6cbcb2248b2c331c8a6fe1c057f676c">getSystemProperty</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &key, const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &def)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the specified system property. <a href="#e6cbcb2248b2c331c8a6fe1c057f676c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#2bf6497289e61895072587bd71985ea6">instantiateByClassName</a> (const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &className, const <a class="el" href="classlog4cxx_1_1helpers_1_1_class.html">Class</a> &superClass, const <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> &defaultValue)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Instantiate an object given a class name. <a href="#2bf6497289e61895072587bd71985ea6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#95d3941c5882b39163dc3f229a2c0317">instantiateByKey</a> (<a class="el" href="classlog4cxx_1_1helpers_1_1_properties.html">Properties</a> &props, const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &key, const <a class="el" href="classlog4cxx_1_1helpers_1_1_class.html">Class</a> &superClass, const <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> &defaultValue)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cxx_1_1helpers_1_1_option_converter.html#03defb93e089056749f0e5523ec6315f">selectAndConfigure</a> (const <a class="el" href="classlog4cxx_1_1_file.html">File</a> &configFileName, const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> &clazz, <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">spi::LoggerRepositoryPtr</a> &hierarchy)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Configure <a class="el" href="namespacelog4cxx.html">log4cxx</a> given a configFileName. <a href="#03defb93e089056749f0e5523ec6315f"></a><br></td></tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="84695a8b2e45b1ab42caef5dc65534eb"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::convertSpecialChars" ref="84695a8b2e45b1ab42caef5dc65534eb" args="(const LogString &s)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> convertSpecialChars </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>s</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="06323a5e7986b04e0799254c8e313b82"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::findAndSubst" ref="06323a5e7986b04e0799254c8e313b82" args="(const LogString &key, Properties &props)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> findAndSubst </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>key</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classlog4cxx_1_1helpers_1_1_properties.html">Properties</a> & </td>
<td class="mdname" nowrap> <em>props</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Find the value corresponding to <code>key</code> in <code>props</code>.
<p>
Then perform variable substitution on the found value. </td>
</tr>
</table>
<a class="anchor" name="e6cbcb2248b2c331c8a6fe1c057f676c"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::getSystemProperty" ref="e6cbcb2248b2c331c8a6fe1c057f676c" args="(const LogString &key, const LogString &def)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> getSystemProperty </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>key</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>def</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Gets the specified system property.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>The key to search for. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>def</em> </td><td>The default value to return. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>the string value of the system property, or the default value if there is no property with that key. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="2bf6497289e61895072587bd71985ea6"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::instantiateByClassName" ref="2bf6497289e61895072587bd71985ea6" args="(const LogString &className, const Class &superClass, const ObjectPtr &defaultValue)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> instantiateByClassName </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>className</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="classlog4cxx_1_1helpers_1_1_class.html">Class</a> & </td>
<td class="mdname" nowrap> <em>superClass</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> & </td>
<td class="mdname" nowrap> <em>defaultValue</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Instantiate an object given a class name.
<p>
Check that the <code>className</code> is a subclass of <code>superClass</code>. If that test fails or the object could not be instantiated, then <code>defaultValue</code> is returned.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>className</em> </td><td>The fully qualified class name of the object to instantiate. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>superClass</em> </td><td>The class to which the new object should belong. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>defaultValue</em> </td><td>The object to return in case of non-fulfillment </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="95d3941c5882b39163dc3f229a2c0317"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::instantiateByKey" ref="95d3941c5882b39163dc3f229a2c0317" args="(Properties &props, const LogString &key, const Class &superClass, const ObjectPtr &defaultValue)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> instantiateByKey </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cxx_1_1helpers_1_1_properties.html">Properties</a> & </td>
<td class="mdname" nowrap> <em>props</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>key</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="classlog4cxx_1_1helpers_1_1_class.html">Class</a> & </td>
<td class="mdname" nowrap> <em>superClass</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">ObjectPtr</a> & </td>
<td class="mdname" nowrap> <em>defaultValue</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="03defb93e089056749f0e5523ec6315f"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::selectAndConfigure" ref="03defb93e089056749f0e5523ec6315f" args="(const File &configFileName, const LogString &clazz, spi::LoggerRepositoryPtr &hierarchy)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static void selectAndConfigure </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="classlog4cxx_1_1_file.html">File</a> & </td>
<td class="mdname" nowrap> <em>configFileName</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>clazz</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">spi::LoggerRepositoryPtr</a> & </td>
<td class="mdname" nowrap> <em>hierarchy</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Configure <a class="el" href="namespacelog4cxx.html">log4cxx</a> given a configFileName.
<p>
The configFileName must point to a file which will be interpreted by a new instance of a <a class="el" href="namespacelog4cxx.html">log4cxx</a> configurator.<p>
All configurations steps are taken on the <code>hierarchy</code> passed as a parameter.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>configFileName</em> </td><td>The location of the configuration file. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>clazz</em> </td><td>The classname, of the <a class="el" href="namespacelog4cxx.html">log4cxx</a> configurator which will parse the file <code>configFileName</code>. This must be a subclass of Configurator, or null. If this value is null then a default configurator of <a class="el" href="classlog4cxx_1_1_property_configurator.html">PropertyConfigurator</a> is used, unless the filename pointed to by <code>configFileName</code> ends in '.xml', in which case DOMConfigurator is used. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>hierarchy</em> </td><td>The <a class="el" href="classlog4cxx_1_1_hierarchy.html">Hierarchy</a> to act on. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="45b8aeeafeace89385672ffab025e9d1"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::substVars" ref="45b8aeeafeace89385672ffab025e9d1" args="(const LogString &val, Properties &props)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> substVars </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>val</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classlog4cxx_1_1helpers_1_1_properties.html">Properties</a> & </td>
<td class="mdname" nowrap> <em>props</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Perform variable substitution in string <code>val</code> from the values of keys found in the system propeties.
<p>
The variable substitution delimeters are <b>${</b> and <b>}</b>.<p>
For example, if the <a class="el" href="classlog4cxx_1_1helpers_1_1_system.html">System</a> properties contains "key=value", then the call <pre>
String s = OptionConverter.substituteVars("Value of key is ${key}.");
</pre><p>
will set the variable <code>s</code> to "Value of key is value.".<p>
If no value could be found for the specified key, then the <code>props</code> parameter is searched, if the value could not be found there, then substitution defaults to the empty string.<p>
For example, if system propeties contains no value for the key "inexistentKey", then the call<p>
<pre>
String s = OptionConverter.subsVars("Value of inexistentKey is [${inexistentKey}]");
</pre> will set <code>s</code> to "Value of inexistentKey is []"<p>
An <a class="el" href="classlog4cxx_1_1helpers_1_1_illegal_argument_exception.html">IllegalArgumentException</a> is thrown if <code>val</code> contains a start delimeter "${" which is not balanced by a stop delimeter "}". <p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>val</em> </td><td>The string on which variable substitution is performed. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>props</em> </td><td>The properties from which variable substitution is performed. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classlog4cxx_1_1helpers_1_1_illegal_argument_exception.html">IllegalArgumentException</a></em> </td><td>if <code>val</code> is malformed. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="6ea7dcdf1610e5d7e7f3d6004db6ef3c"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::toBoolean" ref="6ea7dcdf1610e5d7e7f3d6004db6ef3c" args="(const LogString &value, bool dEfault)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static bool toBoolean </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>value</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>bool </td>
<td class="mdname" nowrap> <em>dEfault</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
If <code>value</code> is "true", then <code>true</code> is returned.
<p>
If <code>value</code> is "false", then <code>true</code> is returned. Otherwise, <code>default</code> is returned.<p>
Case of value is unimportant. </td>
</tr>
</table>
<a class="anchor" name="f0b5a6bd84b27ef758e7d6d74b362ebf"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::toFileSize" ref="f0b5a6bd84b27ef758e7d6d74b362ebf" args="(const LogString &value, long dEfault)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static long toFileSize </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>value</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>long </td>
<td class="mdname" nowrap> <em>dEfault</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="c849988e20a74924dae77bc1a6e6e4fb"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::toInt" ref="c849988e20a74924dae77bc1a6e6e4fb" args="(const LogString &value, int dEfault)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static int toInt </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>value</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>int </td>
<td class="mdname" nowrap> <em>dEfault</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="53e994f695af6def12f5caa8b0f2f5de"></a><!-- doxytag: member="log4cxx::helpers::OptionConverter::toLevel" ref="53e994f695af6def12f5caa8b0f2f5de" args="(const LogString &value, const LevelPtr &defaultValue)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">static <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">LevelPtr</a> toLevel </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="namespacelog4cxx.html#d7ec98d27bca7666e23f27dd1fb181c8">LogString</a> & </td>
<td class="mdname" nowrap> <em>value</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const <a class="el" href="classlog4cxx_1_1helpers_1_1_object_ptr_t.html">LevelPtr</a> & </td>
<td class="mdname" nowrap> <em>defaultValue</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="optionconverter_8h.html">optionconverter.h</a></ul>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
</BODY>
</HTML>
|