/* XBN Java: Generically useful, non-GUI Java code. http://sourceforge.net/projects/xbnjava Copyright (C) 1997-2003, Jeff Epstein All rights reserved. Modifications: No Redistribution in binary form, with or without modifications, are permitted provided that the following conditions are met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * If modifications are made to source code then this license should indicate that fact in the "Modifications" section above. * Neither the author, nor the contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [NOTE: This license contains NO advertising clause.] */ package xbn.config; import xbn.XBNObject; import xbn.string.SOBString; /**
Configuration related to variables in a ConfigReader, provided via CRConfig. Provided to ConfigReader via CRConfig.
Source code: CRCVariable.java
Create a CRCVariable with default settings.
Equal to CRCVariable(new CRCVTrim())
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, (new CRCVUnescape()))
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), crcv_unescape)
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), s_nullValue)
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), b_1stLineWSIsEmptyString)
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, crcv_unescape, "__NULL__")
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, (new CRCVUnescape()), s_nullValue)
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, (new CRCVUnescape()), b_1stLineWSIsEmptyString)
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), crcv_unescape, s_nullValue)
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), crcv_unescape, b_1stLineWSIsEmptyString)
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), s_nullValue, b_1stLineWSIsEmptyString)
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, crcv_unescape, s_nullValue, true)
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, crcv_unescape, "__NULL__", b_1stLineWSIsEmptyString)
Create a CRCVariable.
Equal to CRCVariable(crcv_trim, (new CRCVUnescape()), "__NULL__", b_1stLineWSIsEmptyString)
Create a CRCVariable.
Equal to CRCVariable((new CRCVTrim()), crcv_unescape, s_nullValue, b_1stLineWSIsEmptyString)
Create a CRCVariable.
This object, as a whole, is provided to the CRConfig constructor. Some of these requirements are enforced there, some here.
Regarding these characters:
crcv_trim.getESChar()
(only if crcv_trim.doUseESChar()
equals true)crcv_unescape.getEscapeChar()
They must all be unique, not invisible, and crcv_unescape.getUSCIgnore().isSpcfcIgnored(THE_CHAR)
must equal false.
Get the CRCVTrim for direct manipulation.
@return crcv_trim Exactly as provided to the constructor. **/ public final CRCVTrim getCRCVTrim() { return crcvt; } /**Get the CRCVUnescape for direct manipulation.
@return crcv_unescape Exactly as provided to the constructor. **/ public final CRCVUnescape getCRCVUnescape() { return crcvu; } /**Get the special string defined as null.
When the first line of the value of a variable is equal to this, the value is equal to null.
For the sake of this documentation section, assume this string and the special empty string character equal their default values ("__NULL__
" and '|
', respectively).
To make a variable's value literally equal to "__NULL__
", you must trim value lines (getCRCVTrim().doTrimVLs()
must equal true).
If the empty string character is being used (getCRCVTrim().doUseESChar()
equals true), set your variable's value equal to __NU\\|LL__
.
If the empty string character is not being used, set the second or subsequent line of the value equal to __NULL__
. This method requires that is1stLineWSEmptyString equals false.
If the first line of a variable's value is nothing but whitespace, should it be considered as empty string?
For example, take this variable:
name_of_variable1 = This is an "X": x and the value "one": 1 name_of_variable2= Value of 2
The first line of this variable's value is only spaces or tabs, or nothing (empty string). If this function returns true, you'll get a "stray text found" error, when CRLineAnalyzer attempts to process the "This" line.
If this function returns false, then the value is "...This...is...the...value of 1".
I personally prefer the former: The user gets an error. In order to make the first line of the value have whitespace only, configure CRCVTrim to trim value lines and to use the special empty string character:
name_of_variable1 = | This is a pipe \\| and the value of 1
For whitespace on the first line:
name_of_variable1 = | | This is a pipe \\| and the value of 1@return b_1stLineWSIsEmptyString Exactly as provided to the constructor. **/ public final boolean is1stLineWSEmptyString() { return b1stLineWSIsES; } /**
Get some information about this CRCVariable.
**/ public String toString() { return this.getClass().getName() + ": getNullValue()='" + getNullValue() + "', is1stLineWSEmptyString()=" + is1stLineWSEmptyString() + ", [" + getCRCVTrim().toString() + "], [" + getCRCVUnescape().toString() + "]"; } }