public void SubstringConstructor()
{
    AString astr=   new AString();
    AString res=    new AString();

    constructorTest( "a"        , res, false ); UT_EQ( "a",        res );
    constructorTest( " a"       , res, false ); UT_EQ( " a",       res );
    constructorTest( "a "       , res, false ); UT_EQ( "a ",       res );
    constructorTest( "a b"      , res, false ); UT_EQ( "a b",      res );
    constructorTest( " a b"     , res, false ); UT_EQ( " a b",     res );
    constructorTest( "a b "     , res, false ); UT_EQ( "a b ",     res );

    constructorTest( "a"        , res, true  ); UT_EQ( "a",        res );
    constructorTest( " a"       , res, true  ); UT_EQ( "a",        res );
    constructorTest( "a "       , res, true  ); UT_EQ( "a",        res );
    constructorTest( "a b"      , res, true  ); UT_EQ( "a b",      res );
    constructorTest( " a b"     , res, true  ); UT_EQ( "a b",      res );
    constructorTest( "a b "     , res, true  ); UT_EQ( "a b",      res );

    // changing whitespaces
    {
        {
            astr.Clear()._( "xy xz abc xy" );
            Substring subs= new Substring();
            subs.Set(astr).Trim("xy ".ToCharArray()).CopyTo( res );
            UT_EQ( "z abc",      res );
        }

        {
            Substring subs= new Substring( "xy xz abc xy" );
            subs.TrimStart("xy ".ToCharArray());
            subs.TrimEnd("xy ".ToCharArray());
            subs.CopyTo( res );
            UT_EQ( "z abc",      res );
        }
    }

    // test other constructors
    {
        astr.Clear()._( " astring ");
        UT_TRUE  ( (new Substring()).IsEmpty() );
        UT_TRUE  ( (new Substring()).IsNull() );
        UT_EQ( "astring",  (new Substring( astr)).Trim() .ToString() );
        UT_EQ( "str",      (new Substring( astr,  2, 3 )).ToString() );
        UT_EQ( "",         (new Substring( astr, 20, 3 )).ToString() );
        UT_TRUE (          (new Substring( astr, 20, 3 )).IsEmpty()  );
        UT_FALSE(          (new Substring( astr, 20, 3 )).IsNull()   );


        Substring s2= new Substring( astr);
        UT_EQ( "astring",  new Substring( s2.Trim().ToString() ).ToString() );
        UT_EQ( "str",      (new Substring( (new Substring( astr, 2,3  )))).ToString() );
    }

}
Esempio n. 2
0
    // #############################################################################################
    // Internals
    // #############################################################################################
        /** ****************************************************************************************
         * Internal, recursive helper of #Find.
         *
         * @param       domainPath  Path to search.
         * @param       sensitivity Denotes if domain name search is treated case sensitive or not.
         * @param       maxCreate   The maximum number of sub domains that are created if not
         *                          found at the end of the path.
         * @param[out]  wasCreated  Output parameter that is set \c true if domain was not found
         *                          and hence created.
         * @return The domain found or created.
         ******************************************************************************************/
        protected Domain findRecursive( Substring domainPath, Case sensitivity,
                                        int maxCreate, ref bool wasCreated          )
        {
            //--- get act sub-name and rest of path
            domainPath.Consume( Separator );
            int endSubName= domainPath.IndexOf( Separator );

            ALIB.ASSERT_ERROR( endSubName != 0, "Internal Error" );

            // find end of actual domain name and save rest
            Substring restOfDomainPath= tSubstring2;
            restOfDomainPath.SetNull();
            if ( endSubName > 0 )
                domainPath.Split( endSubName, restOfDomainPath, 1 );

            // search sub-domain
            Domain subDomain= null;

            // "."
            if( domainPath.Equals( "." ) )
                subDomain= this;

            // ".."
            else if( domainPath.Equals( ".." ) )
                subDomain= Parent != null ? Parent : this;


            // search in sub-domain
            else
            {
                int i;
                bool fixedOnce= false;
                for(;;)
                {
                    for( i= 0; i< SubDomains.Count; i++ )
                    {
                        int comparison=   SubDomains[i].Name.CompareTo( domainPath, sensitivity );
                        if( comparison >= 0 )
                        {
                            if ( comparison == 0 )
                                subDomain= SubDomains[i];
                            break;
                        }
                    }

                    // domain found?
                    if ( subDomain != null )
                        break;

                    // try and fix name
                    if( !fixedOnce )
                    {
                        fixedOnce= true;

                        bool illegalCharacterFound= false;
                        for( int cp= 0; cp< domainPath.Length() ; ++cp )
                        {
                            char c= domainPath.CharAt(cp);
                            if (     c <  '-' || c > 'z'
                                  || c == '<' || c == '>'
                                  || c == '[' || c == ']'
                                  || c == '=' || c == '?' || c == ';' || c == ':'
                                  || c == '\\'|| c == '\''|| c == '.' || c == ','
                               )
                            {
                                illegalCharacterFound= true;
                                domainPath.Buf[domainPath.Start + cp]= '#';
                            }
                        }

                        if ( illegalCharacterFound )
                            continue;
                     }

                    // create
                    if ( maxCreate == 0 )
                        return null;
                    wasCreated= true;
                    SubDomains.Insert( i, subDomain= new Domain( this,  new AString( domainPath ) ) );
                    maxCreate--;
                    if ( maxCreate == 0 )
                        return subDomain;

                    break;
                }

            }
            // recursion?
            if ( restOfDomainPath.IsNotEmpty() )
            {
                domainPath.Set( restOfDomainPath );
                return subDomain.findRecursive( domainPath, sensitivity, maxCreate, ref wasCreated );
            }

            // that's it
            return subDomain;
        }
    bool  Load( Variable variable, bool searchOnly= false )
    {
        if ( args == null )
            return false;

        int   optionLength=   variable.Fullname.Length();
        Substring actVar=     new Substring();

        for ( int i= 0; i < args.Length ; i++ )
        {
            // remove whitespaces (if somebody would work with quotation marks...)
            // and request '-' and allow a second '-'
            if ( !actVar.Set( args[i] ).Trim().Consume('-') )
                continue;
            actVar.Consume( '-' );

            if ( variable.Fullname.CompareTo( args[i], Case.Ignore, actVar.Start, optionLength, 0, optionLength ) == 0)
            {
                //again, lets trim before searching the = sign (really almost unnecessary)
                actVar.Start+= optionLength;
                if ( actVar.IsEmpty() )
                {
                    if ( !searchOnly )
                        variable.AddString();
                    return true;
                }

                if ( actVar.Consume( '=', Case.Sensitive, Whitespaces.Trim ) )
                {
                    if ( !searchOnly )
                    {
                        actVar.Trim();
                        StringConverter.LoadFromString( variable, actVar );

                    }
                    return true;
                }
             }
        }

        return false;
    }
public void ParseNumbers()
{
    // ConsumeInteger()
    {
        Substring subs= new Substring();
        int result;
                                   UT_EQ( false,  subs.ConsumeInteger( out result                ) );   UT_EQ(       0,  result );
        subs.Set( ""            ); UT_EQ( false,  subs.ConsumeInteger( out result                ) );   UT_EQ(       0,  result );
        subs.Set( "  ABC"       ); UT_EQ( false,  subs.ConsumeInteger( out result                ) );   UT_EQ(       0,  result );
        subs.Set( "  12345"     ); UT_EQ( true ,  subs.ConsumeInteger( out result                ) );   UT_EQ(   12345,  result );
        subs.Set( "  12 45"     ); UT_EQ( true ,  subs.ConsumeInteger( out result                ) );   UT_EQ(      12,  result );
                                   UT_EQ( true ,  subs.ConsumeInteger( out result                ) );   UT_EQ(      45,  result );

        subs.Set( " 42 ; 7 ; 6 "); UT_EQ( true ,  subs.ConsumeInteger( out result                ) );   UT_EQ(      42,  result );
                                   UT_EQ( false,  subs.ConsumeInteger( out result                ) );   UT_EQ(       0,  result );
                                   UT_EQ( false,  subs.ConsumeInteger( out result                ) );   UT_EQ(       0,  result );

        char[] ws= " ;".ToCharArray();
        subs.Set( " 42 ; 7 ; 6 "); UT_EQ( true ,  subs.ConsumeInteger( out result, ws            ) );   UT_EQ(      42,  result );
                                   UT_EQ( true ,  subs.ConsumeInteger( out result, ws            ) );   UT_EQ(       7,  result );
                                   UT_EQ( true ,  subs.ConsumeInteger( out result, ws            ) );   UT_EQ(       6,  result );
                                   UT_EQ( false,  subs.ConsumeInteger( out result, ws            ) );   UT_EQ(       0,  result );
                                   UT_EQ( false,  subs.ConsumeInteger( out result, ws            ) );   UT_EQ(       0,  result );
    }

    // ConsumeFloat()
    {
        Substring subs= new Substring();
        double result;
                                        UT_EQ( false,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(      0.0,  result );
        subs.Set( ""        )         ; UT_EQ( false,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(      0.0,  result );
        subs.Set( "  ABC"   )         ; UT_EQ( false,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(      0.0,  result );
        subs.Set( "  12345" )         ; UT_EQ( true ,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(  12345.0,  result );
        subs.Set( " 12.45 " )         ; UT_EQ( true ,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(     12.45, result );
        subs.Set( "  12 45" )         ; UT_EQ( true ,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(     12.0,  result );
                                        UT_EQ( true ,  subs.ConsumeFloat  ( out result             ) );   UT_EQ(     45.0,  result );

        char[] ws= " ;".ToCharArray();
        subs.Set( " 42.3 ; 0.7 ; 6 " ); UT_EQ( true ,  subs.ConsumeFloat  ( out result, null, ws   ) );   UT_EQ(     42.3,  result );
                                        UT_EQ( true ,  subs.ConsumeFloat  ( out result, null, ws   ) );   UT_EQ(      0.7,  result );
                                        UT_EQ( true ,  subs.ConsumeFloat  ( out result, null, ws   ) );   UT_EQ(      6.0,  result );
                                        UT_EQ( false,  subs.ConsumeFloat  ( out result, null, ws   ) );   UT_EQ(      0.0,  result );
                                        UT_EQ( false,  subs.ConsumeFloat  ( out result, null, ws   ) );   UT_EQ(      0.0,  result );
    }

}
public void CompareTo()
    {
        Substring tss= new Substring();

        // null string comparison

        String  nullString= null;
        UT_TRUE( tss.CompareTo( nullString) == 0 );
        UT_TRUE( tss.Equals( nullString) );

        tss.Set( "" );
        UT_TRUE( tss.CompareTo( nullString) != 0 );
        UT_TRUE( !tss.Equals( nullString) );

        tss.SetNull();
        UT_TRUE( tss.CompareTo( nullString) == 0 );
        UT_TRUE( tss.Equals( nullString) );

        String t= "abcde";
        tss= new Substring("01"+t+"234", 2, t.Length );

        int result, resSys;
        result= tss.CompareTo( t      );                                     UT_EQ( t.CompareTo( t ),                                result );
        result= tss.CompareTo( t + "x"      );                               UT_EQ( t.CompareTo( t + "x" ),                          result );
        result= tss.CompareTo( t.Substring (0, t.Length -1 )  );             UT_EQ( t.CompareTo( t.Substring (0, t.Length -1 ) ),    result );
        result= tss.CompareTo( "pad" + t,  Case.Sensitive, 3            );   UT_EQ(  0,                                              result );
        result= tss.CompareTo( "pad" + t,  Case.Sensitive, 3, 2         );   UT_EQ(  1,                                              result );


        // greater/smaller strings
        {
            String greater=  "x";
            String greater2= "abcdef";
            String smaller=  "aaa";
            String smaller2= "abcd";
            result= tss.CompareTo( greater  );  resSys= t.CompareTo( greater  ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( greater2 );  resSys= t.CompareTo( greater2 ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( smaller  );  resSys= t.CompareTo( smaller  ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( smaller2 );  resSys= t.CompareTo( smaller2 ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            String ut= t.ToUpper();
            UT_FALSE( 0 ==  tss.CompareTo( ut )                );
            UT_FALSE( 0 ==  tss.CompareTo( ut, Case.Sensitive ));
            UT_TRUE ( 0 ==  tss.CompareTo( ut, Case.Ignore    ));
        }

        {
            AString greater=  new AString( "x"      );
            AString greater2= new AString( "abcdef" );
            AString smaller=  new AString( "aaa"    );
            AString smaller2= new AString( "abcd"   );
            result= tss.CompareTo( greater  );  resSys= t.CompareTo( greater  .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( greater2 );  resSys= t.CompareTo( greater2 .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( smaller  );  resSys= t.CompareTo( smaller  .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( smaller2 );  resSys= t.CompareTo( smaller2 .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            AString ut= new AString (t.ToUpper());
            UT_FALSE( 0 ==  tss.CompareTo( ut )                );
            UT_FALSE( 0 ==  tss.CompareTo( ut, Case.Sensitive ));
            UT_TRUE ( 0 ==  tss.CompareTo( ut, Case.Ignore    ));
        }
        {
            Substring greater=  new Substring( "123x"       , 3 );
            Substring greater2= new Substring( "123abcdef"  , 3 );
            Substring smaller=  new Substring( "123aaa"     , 3 );
            Substring smaller2= new Substring( "123abcd"    , 3 );
            result= tss.CompareTo( greater  );  resSys= t.CompareTo( greater  .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( greater2 );  resSys= t.CompareTo( greater2 .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( smaller  );  resSys= t.CompareTo( smaller  .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            result= tss.CompareTo( smaller2 );  resSys= t.CompareTo( smaller2 .ToString() ); UT_TRUE( result==resSys || (result < 0 && resSys < 0) || (result > 0 && resSys > 0) );
            Substring ut= new Substring( t.ToUpper() );
            UT_FALSE( 0 ==  tss.CompareTo( ut )                );
            UT_FALSE( 0 ==  tss.CompareTo( ut, Case.Sensitive ));
            UT_TRUE ( 0 ==  tss.CompareTo( ut, Case.Ignore    ));
        }
    }
Esempio n. 6
0
    /** ****************************************************************************************
     * Reads a prefix string from the ALib configuration system.
     * This internal method is used when a new domain is created,
     *
     * @param dom         The domain to set the verbosity for.
     ******************************************************************************************/
    protected void  getDomainPrefixFromConfig( Domain  dom )
    {
        Variable variable= new Variable( ALox.PREFIXES, GetName() );
        if( 0 == variable.Load() )
            return;

        Tokenizer prefixTok=        new Tokenizer();
        Tokenizer prefixTokInner=   new Tokenizer();
        Substring domainStr=        new Substring();
        AString   domainStrBuf=     new AString();
        Substring prefixStr=        new Substring();
        for( int varNo= 0; varNo< variable.Size(); varNo++ )
        {
            prefixTok.Set( variable.GetString( varNo ), '=' );

            domainStr.Set( prefixTok.Next() );
            if ( domainStr.StartsWith( "INTERNAL_DOMAINS", DomainSensitivity ) )
            {
                domainStrBuf._()._( domainStr.Buf, domainStr.Start + 16, domainStr.Length() -16 );
                while ( domainStrBuf.CharAtStart() == '/' )
                    domainStrBuf.DeleteStart( 1 );
                domainStrBuf.InsertAt( ALox.InternalDomains, 0 );
                domainStr.Set( domainStrBuf );
            }

            prefixTokInner.Set( prefixTok.Next(), ',' );
            prefixStr.Set( prefixTokInner.Next() );
            if ( prefixStr.IsEmpty() )
                continue;
            if ( prefixStr.Consume( '\"' ) )
                prefixStr.ConsumeFromEnd( '\"' );

            Inclusion otherPLs= Inclusion.Include;
            prefixTokInner.Next();
            if ( prefixTokInner.Actual.IsNotEmpty() )
                otherPLs= ALIB.ReadInclusion( prefixTokInner.Actual  );

            int searchMode= 0;
            if ( domainStr.Consume       ( '*' ) )    searchMode+= 2;
            if ( domainStr.ConsumeFromEnd( '*' ) )    searchMode+= 1;
            if(     ( searchMode == 0 && dom.FullPath.Equals          ( domainStr,    DomainSensitivity )     )
                ||  ( searchMode == 1 && dom.FullPath.StartsWith      ( domainStr,    DomainSensitivity )     )
                ||  ( searchMode == 2 && dom.FullPath.EndsWith        ( domainStr,    DomainSensitivity )     )
                ||  ( searchMode == 3 && dom.FullPath.IndexOf         ( domainStr, 0, DomainSensitivity ) >=0 )
                )
            {
                dom.PrefixLogables.Add( new Domain.PL( new AString( prefixStr ), otherPLs ) );

                // log info on this
                intMsg._()._NC( "String \"" )._NC( prefixStr )._NC ( "\" added as prefix logable for domain \'" )
                          ._NC( dom.FullPath )
                          ._NC( "\'. (Retrieved from variable" )
                          ._NC( variable.Fullname )._( ".)" );
                logInternal( Verbosity.Info, "PFX", intMsg );
            }
        }
    }
 public void Trim()
 {
     Substring subs= new Substring();
     {
         String t;
         t= ""          ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( ""            , subs.ToString() );
         t= " "         ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( ""            , subs.ToString() );
         t= "  "        ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( ""            , subs.ToString() );
         t= "abc"       ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= "abc"       ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= " abc"      ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= "  abc"     ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= " \tabc"    ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= "\t abc"    ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= "abc\r\n"   ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= "\tabc\r\n" ; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc"         , subs.ToString() );
         t= "\tabc\rx\n"; subs.Set(" pad " + t + " abc ", 5, t.Length).Trim();        UT_EQ( "abc\rx"      , subs.ToString() );
     }
 }
public void IniFileTest()
{
    // write sample config file
    //UT_PRINT(""); UT_PRINT( "### Configuration with IniFile ###" );
    String iniFileContents=
     "##########################################################################"  +"\n"
    +"## unit test config file"                                                    +"\n"
    +"##########################################################################"  +"\n"
    +"// this is also a comment"                                                   +"\n"
    +"; and this is as well"                                                       +"\n"
    +""                                                                            +"\n"
    +"HOME= overwritten_by_environment"                                            +"\n"
    +"HOMEPATH= overwritten_by_environment"                                        +"\n"
    +""                                                                            +"\n"
    +"concat=    start =5,          \\"                                            +"\n"
    +"           end   =32,       \\"                                              +"\n"
    +"           \\#no comment,   \\"                                              +"\n"
    +"           \\;nocomment,   \\"                                               +"\n"
    +"           ;a comment,   \\"                                                 +"\n"
    +"           getsLonger,    \\"                                                +"\n"
    +"           getsLongerxxx,   \\"                                              +"\n"
    +"           getsshorter,    \\"                                               +"\n"
    +"           getsLongerxxxxx,  \\"                                             +"\n"
    +"           getsLongerxxxxxxxxx,  \\"                                         +"\n"
    +"           getsshorterxx,    \\"                                             +"\n"
    +"           last"                                                             +"\n"
    +""                                                                            +"\n"
    +""                                                                            +"\n"
    +"CUBA=a country"                                                              +"\n"
    +"# The size "                                                                 +"\n"
    +" SIZE=  25 "                                                                 +"\n"
    +""                                                                            +"\n"
    +"# doble comment line"                                                        +"\n"
    +"# double, i meant"                                                           +"\n"
    +"2Comments= much talk"                                                        +"\n"
    +""                                                                            +"\n"
    +"# A great section"                                                           +"\n"
    +"[Great Section] "                                                            +"\n"
    +"SectionVar=5"                                                                +"\n"
    +"Double=12.3"                                                                 +"\n"
    +"Tricky=  backslash\\\\"                                                      +"\n"
    +"# A 2nd section"                                                             +"\n"
    +"[2nd Section] "                                                              +"\n"
    +"SectionVar=6"                                                                +"\n"
    +""                                                                            +"\n"
    +""                                                                            +"\n"
    +"[Great Section] "                                                            +"\n"
    +"SECTION_CONTINUED   = yEs"                                                   +"\n"
    +""                                                                            +"\n"
    +""                                                                            +"\n"
    +"[ESC] "                                                                      +"\n"
    +"Blanks=  \" x \""                                                            +"\n"
    +"Blanks2= \" x \" \\"                                                         +"\n"
    +"         \" y \" "                                                           +"\n"
    +"Tabs=\t\t\\tx\\t"                                                            +"\n"
    +"nrslash= \"\\n\\r//\\\\\""                                                   +"\n"
   ;

    String fileName= Environment.CurrentDirectory + "/unittest_testiniFile.cfg";

    // write sample config file
    {
        StreamWriter file= new StreamWriter( fileName );
        file.Write( iniFileContents );
        file.Close();
    }

    IniFile iniFile= new IniFile( fileName );
    UT_TRUE( (IniFile.Status.OK == iniFile.LastStatus) );

    // check some values
    Variable var= new Variable();
    iniFile.Load( var.Define( "",    "CUBA") );         UT_EQ( "a country",      var.GetString() );
    iniFile.Load( var.Define( "",    "cUbA") );         UT_EQ( "a country",      var.GetString() );
    iniFile.Load( var.Define( "",    "SIZE") );         UT_EQ( "25",             var.GetString() );
    iniFile.Load( var.Define( "",    "concat", ',') );  UT_EQ( 11 , var.Size());
                                                        UT_EQ( "start =5"       , var.GetString(0) );
                                                        UT_EQ( "end   =32"      , var.GetString(1) );
                                                        UT_EQ( "#no comment"    , var.GetString(2) );
                                                        UT_EQ( ";nocomment"     , var.GetString(3) );

    iniFile.Load( var.Define( "ESC", "Blanks"  ) );   UT_EQ( " x "      , var.GetString() );
    iniFile.Load( var.Define( "ESC", "Blanks2" ) );   UT_EQ( " x  y "   , var.GetString() );
    iniFile.Load( var.Define( "ESC", "Tabs"    ) );   UT_EQ( "\tx\t"    , var.GetString() );
    iniFile.Load( var.Define( "ESC", "nrslash" ) );   UT_EQ( "\n\r//\\" , var.GetString() );

    iniFile.Load( var.Define( "Great Section",  "SectionVar"       ) );   UT_EQ( "5"  , var.GetString() );
    iniFile.Load( var.Define( "2nd Section",    "SectionVar"       ) );   UT_EQ( "6"  , var.GetString() );
    iniFile.Load( var.Define( "Great Section",  "SECTION_CONTINUED") );   UT_EQ( "yEs", var.GetString() );
    iniFile.Load( var.Define( "Great Section",  "Tricky"           ) );   UT_EQ( "backslash\\", var.GetString() );

    // add it to ALIB config
    ALox.Init();
    ALIB.Config.InsertPlugin( iniFile, Configuration.PrioIniFile );
    ALIB.Config.Load( var.Define( "",               "CUBA"              ) );   UT_EQ( "a country"  , var.GetString() );
    ALIB.Config.Load( var.Define( "",               "cUbA"              ) );   UT_EQ( "a country"  , var.GetString() );
    ALIB.Config.Load( var.Define( "",               "SIZE"              ) );   UT_EQ( "25"         , var.GetString() );
    ALIB.Config.Load( var.Define( "",               "concat"            ) );   UT_EQ( 11 , var.Size());
                                                                               UT_EQ( "start =5"   , var.GetString(0) );
                                                                               UT_EQ( "end   =32"  , var.GetString(1) );
    ALIB.Config.Load( var.Define( "Great Section",  "SectionVar"        ) );   UT_EQ( "5"          , var.GetString() );
    ALIB.Config.Load( var.Define( "2nd Section",    "SectionVar"        ) );   UT_EQ( "6"          , var.GetString() );
    ALIB.Config.Load( var.Define( "Great Section",  "SECTION_CONTINUED" ) );   UT_EQ( "yEs"        , var.GetString() );
    ALIB.Config.Load( var.Define( "Great Section",  "Tricky"            ) );   UT_EQ( "backslash\\", var.GetString() );
    ALIB.Config.Load( var.Define( "Great Section",  "SECTION_CONTINUED" ) );   UT_TRUE( var.IsTrue() );


    // check if environment variable "home" overwrites INI file
    AString vIniFile= new AString();   iniFile.Load( var.Define( "", "hOme" ) );               UT_EQ( "overwritten_by_environment", var.GetString() );
    int prio= ALIB.Config.Load( var.Define("", "hOme" ));
    if (prio != Configuration.PrioEnvironment ) // Windows platform?
    {
        prio= ALIB.Config.Load( var.Define("", "hOmePAth") );
        iniFile.Load( var.Define( "", "hOmePAth") );    UT_EQ( "overwritten_by_environment", var.GetString() );
    }
    UT_EQ( Configuration.PrioEnvironment, prio );

    UT_TRUE( var.GetString().Length() > 0 );
    UT_TRUE( !vIniFile.Equals( var.GetString()) );

    // change a value and write a new one
    var.Define( "New Section",  "newvar");
    var.Priority= Configuration.PrioIniFile;
    UT_EQ( Configuration.PrioIniFile, ALIB.Config.Store( var, "new" ) );
    ALIB.Config.Load  ( var.Define("New Section",  "newvar") );  UT_EQ( "new",   var.GetString() );

    var.Define( "",             "newvar");
    var.Priority= Configuration.PrioIniFile;
    UT_EQ( Configuration.PrioIniFile, ALIB.Config.Store( var, "aworx") );
    ALIB.Config.Load  ( var.Define("",             "newvar") );  UT_EQ( "aworx", var.GetString() );


    var.Define( "",   "newvarList", ',');
    var.AddString("val1=5");
    var.AddString("val2=10");
    var.AddString("val3=hello");
    var.Priority= Configuration.PrioIniFile;
    UT_EQ( Configuration.PrioIniFile, ALIB.Config.Store(var) );
    ALIB.Config.Load (  var.Define( "",  "newvarList")   );

    var.Define( "",   "commented", ',', "2lines" );
    var.Priority= Configuration.PrioIniFile;
    UT_EQ( Configuration.PrioIniFile, ALIB.Config.Store(  var,  "this is c-line 1 \nand this line 2" ) );

    // write the file
    iniFile.FileName._(".writeback.txt");
    iniFile.WriteFile();

    // load the written file into another config
    IniFile readBack= new IniFile( iniFile.FileName.ToString() );
    Variable varBack= new Variable();

    // compare all
    UT_TRUE( (IniFile.Status.OK == readBack.LastStatus) );

    {
        AString msg= new AString();
        Substring orig= new Substring();
        Substring back= new Substring();
        foreach ( IniFile.Section section in iniFile.Sections )
        {
            foreach ( IniFile.Entry entry in section.Entries )
            {
                msg.Clear()._( "Reading variable " ).Field()._( section.Name )._( '/' )._( entry.Name );
                UT_PRINT( msg );


                char delim= '\0';
                if(     entry.Name.Equals("concat")
                    ||  entry.Name.Equals("newvarList")       )
                    delim= ',';

                iniFile .Load( var    .Define( section.Name, entry.Name, delim) );
                readBack.Load( varBack.Define( section.Name, entry.Name, delim) );

                UT_EQ( var.Size(), varBack.Size() );
                for ( int i= 0; i< var.Size(); i++ )
                {
                    int idx= var.GetString(i).IndexOf('=');
                    if( idx < 0 )
                    {
                        UT_EQ( var.GetString(i), varBack.GetString(i) );
                    }
                    else
                    {
                        int idxBack= varBack.GetString(i).IndexOf('=');
                        orig.Set( var    .GetString(i), 0, idx     );
                        back.Set( varBack.GetString(i), 0, idxBack );
                        UT_EQ( orig.Trim().ToString(), back.Trim().ToString() );
                        orig.Set( var    .GetString(i), idx     +1 );
                        back.Set( varBack.GetString(i), idxBack +1 );
                        UT_EQ( orig.Trim().ToString(), back.Trim().ToString() );
                    }
                }
            }
        }
    }

    readBack.Load ( var.Define( "New Section",  "newvar" ) );   UT_EQ( "new"  , var.GetString() );
    readBack.Load ( var.Define( "",             "newvar" ) );   UT_EQ( "aworx", var.GetString() );


    ALIB.Config.RemovePlugin( iniFile );


    ALIB.Config.InsertPlugin( readBack, Configuration.PrioIniFile );
    ALIB.Config.Load ( var.Define( "New Section",  "newvar") );   UT_EQ( "new"   , var.GetString() );
    ALIB.Config.Load ( var.Define( "",             "newvar") );   UT_EQ( "aworx" , var.GetString() );

    ALIB.Config.RemovePlugin( readBack );
}
    public void Consume()
    {
        // null substring
        {
            Substring s= new Substring();
            Substring r= new Substring("oldval");
            UT_EQ(  '\0',      s.Consume       ( )         );
            UT_EQ(  0,         s.Consume       (  0   , r) ); UT_TRUE(r.IsNull());
            UT_EQ(  0,         s.Consume       (  5   , r) ); UT_TRUE(r.IsNull());
            UT_EQ(  false,     s.Consume       ( 'a' )     );
            UT_EQ(  false,     s.Consume       ( "word" )  );
            UT_EQ(  '\0',      s.ConsumeFromEnd( )         );
            UT_EQ(  0,         s.ConsumeFromEnd(  0  )     );
            UT_EQ(  0,         s.ConsumeFromEnd(  5  )     );
            UT_EQ(  false,     s.ConsumeFromEnd( 'a' )     );
            UT_EQ(  false,     s.ConsumeFromEnd( "word" )  );
        }

        // empty substring
        {
            Substring s= new Substring("aaaaaaaaaaaa");
            Substring r= new Substring("oldval");
            s.Start= 5;
            s.End=   4;
            UT_EQ(  '\0',      s.Consume       ( )         );
            UT_EQ(  0,         s.Consume       (  0  ,r )  ); UT_TRUE( r.IsNotNull()); UT_TRUE(r.IsEmpty());
            UT_EQ(  0,         s.Consume       (  5  ,r )  ); UT_TRUE( r.IsNotNull()); UT_TRUE(r.IsEmpty());
            UT_EQ(  false,     s.Consume       ( 'a' )     );
            UT_EQ(  false,     s.Consume       ( "word" )  );
            UT_EQ(  '\0',      s.ConsumeFromEnd( )         );
            UT_EQ(  0,         s.ConsumeFromEnd(  0  )     );
            UT_EQ(  0,         s.ConsumeFromEnd(  5  )     );
            UT_EQ(  false,     s.ConsumeFromEnd( 'a' )     );
            UT_EQ(  false,     s.ConsumeFromEnd( "word" )  );
        }

        // substring of length 1
        {
            Substring s= new Substring("aaaaaaaaaaaa");
            Substring r= new Substring("oldval");

            s.Start= s.End= 5; UT_EQ(  'a',       s.Consume       ( )         ); UT_EQ( 0, s.Length() );
            s.Start= s.End= 5; UT_EQ(  1,         s.Consume       (  0  )     ); UT_EQ( 1, s.Length() );
            s.Start= s.End= 5; UT_EQ(  0,         s.Consume       (  1  , r ) ); UT_EQ( 0, s.Length() ); UT_TRUE(r.Equals("a"));
            s.Start= s.End= 5; UT_EQ(  0,         s.Consume       (  5  , r ) ); UT_EQ( 0, s.Length() ); UT_TRUE(r.Equals("a"));
            s.Start= s.End= 5; UT_EQ(  true,      s.Consume       ( 'a' )     ); UT_EQ( 0, s.Length() );
            s.Start= s.End= 5; UT_EQ(  false,     s.Consume       ( 'b' )     ); UT_EQ( 1, s.Length() );
            s.Start= s.End= 5; UT_EQ(  false,     s.Consume       ( "word" )  ); UT_EQ( 1, s.Length() );
            s.Start= s.End= 5; UT_EQ(  'a',       s.ConsumeFromEnd( )         ); UT_EQ( 0, s.Length() );
            s.Start= s.End= 5; UT_EQ(  1,         s.ConsumeFromEnd(  0  )     ); UT_EQ( 1, s.Length() );
            s.Start= s.End= 5; UT_EQ(  0,         s.ConsumeFromEnd(  1  )     ); UT_EQ( 0, s.Length() );
            s.Start= s.End= 5; UT_EQ(  0,         s.ConsumeFromEnd(  5  )     ); UT_EQ( 0, s.Length() );
            s.Start= s.End= 5; UT_EQ(  true,      s.ConsumeFromEnd( 'a' )     ); UT_EQ( 0, s.Length() );
            s.Start= s.End= 5; UT_EQ(  false,     s.ConsumeFromEnd( 'b' )     ); UT_EQ( 1, s.Length() );
            s.Start= s.End= 5; UT_EQ(  false,     s.ConsumeFromEnd( "word" )  ); UT_EQ( 1, s.Length() );
        }

        // substring of length 2
        {
            Substring s= new Substring("12ab3456");
            Substring r= new Substring("oldval");

            s.Start= 2; s.End= 3; UT_EQ(  'a',       s.Consume       ( )         ); UT_EQ( 1, s.Length() );
                                  UT_EQ(  'b',       s.Consume       ( )         ); UT_EQ( 0, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  'b',       s.ConsumeFromEnd( )         ); UT_EQ( 1, s.Length() );
                                  UT_EQ(  'a',       s.ConsumeFromEnd( )         ); UT_EQ( 0, s.Length() );

            s.Start= 2; s.End= 3; UT_EQ(  2,         s.Consume       (  0 , r )  ); UT_EQ( 2, s.Length() ); UT_TRUE(r.IsNotNull()); UT_TRUE(r.IsEmpty());
            s.Start= 2; s.End= 3; UT_EQ(  1,         s.Consume       (  1 , r )  ); UT_EQ( 1, s.Length() ); UT_TRUE(r.Equals("a"));
            s.Start= 2; s.End= 3; UT_EQ(  0,         s.Consume       (  2 , r )  ); UT_EQ( 0, s.Length() ); UT_TRUE(r.Equals("ab"));
            s.Start= 2; s.End= 3; UT_EQ(  0,         s.Consume       (  3 , r )  ); UT_EQ( 0, s.Length() ); UT_TRUE(r.Equals("ab"));
            s.Start= 2; s.End= 3; UT_EQ(  2,         s.ConsumeFromEnd(  0 , r )  ); UT_EQ( 2, s.Length() ); UT_TRUE(r.IsNotNull()); UT_TRUE(r.IsEmpty());
            s.Start= 2; s.End= 3; UT_EQ(  1,         s.ConsumeFromEnd(  1 , r )  ); UT_EQ( 1, s.Length() ); UT_TRUE(r.Equals("b"));
            s.Start= 2; s.End= 3; UT_EQ(  0,         s.ConsumeFromEnd(  2 , r )  ); UT_EQ( 0, s.Length() ); UT_TRUE(r.Equals("ab"));
            s.Start= 2; s.End= 3; UT_EQ(  0,         s.ConsumeFromEnd(  3 , r )  ); UT_EQ( 0, s.Length() ); UT_TRUE(r.Equals("ab"));

            s.Start= 2; s.End= 3; UT_EQ(  false,     s.Consume       ( 'b' )     ); UT_EQ( 2, s.Length() );
                                  UT_EQ(  true,      s.Consume       ( 'a' )     ); UT_EQ( 1, s.Length() );
                                  UT_EQ(  true,      s.Consume       ( 'b' )     ); UT_EQ( 0, s.Length() );
                                  UT_EQ(  false,     s.Consume       ( 'a' )     ); UT_EQ( 0, s.Length() );
                                  UT_EQ(  false,     s.Consume       ( 'b' )     ); UT_EQ( 0, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  false,     s.ConsumeFromEnd( 'a' )     ); UT_EQ( 2, s.Length() );
                                  UT_EQ(  true,      s.ConsumeFromEnd( 'b' )     ); UT_EQ( 1, s.Length() );
                                  UT_EQ(  true,      s.ConsumeFromEnd( 'a' )     ); UT_EQ( 0, s.Length() );
                                  UT_EQ(  false,     s.ConsumeFromEnd( 'b' )     ); UT_EQ( 0, s.Length() );
                                  UT_EQ(  false,     s.ConsumeFromEnd( 'a' )     ); UT_EQ( 0, s.Length() );

            s.Start= 2; s.End= 3; UT_EQ(  false,     s.Consume       ( "word" )  ); UT_EQ( 2, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  false,     s.Consume       ( "AB"   )  ); UT_EQ( 2, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  true,      s.Consume       ( "ab"   )  ); UT_EQ( 0, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  false,     s.ConsumeFromEnd( "word" )  ); UT_EQ( 2, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  false,     s.ConsumeFromEnd( "AB"   )  ); UT_EQ( 2, s.Length() );
            s.Start= 2; s.End= 3; UT_EQ(  true,      s.ConsumeFromEnd( "ab"   )  ); UT_EQ( 0, s.Length() );
        }

        // 3 words
        {
            Substring s= new Substring("word1 word2 word3");

            UT_EQ(  'w',       s.Consume       ( )         );
            UT_EQ(  'o',       s.Consume       ( )         );
            UT_EQ(  'r',       s.Consume       ( )         );
            UT_EQ(  'd',       s.Consume       ( )         );
            UT_EQ(  '1',       s.Consume       ( )         );

            UT_EQ(  false    , s.Consume       ('w'                        )   );
            UT_EQ(  true     , s.Consume       ('w'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  true     , s.Consume       ('o'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  false    , s.Consume       ('o'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  true     , s.Consume       ('r'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  false    , s.Consume       ("D2"    , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  false    , s.Consume       ("D2"                       )   );
            UT_EQ(  true     , s.Consume       ("d2"                       )   );

            UT_EQ(  2        , s.Consume       ( 4 )   );
            UT_EQ(  "d3"     , s.ToString() );

                      s= new Substring("word1 word2 word3");

            UT_EQ(  '3',       s.ConsumeFromEnd( )         );
            UT_EQ(  'd',       s.ConsumeFromEnd( )         );
            UT_EQ(  'r',       s.ConsumeFromEnd( )         );
            UT_EQ(  'o',       s.ConsumeFromEnd( )         );
            UT_EQ(  'w',       s.ConsumeFromEnd( )         );

            UT_EQ(  false    , s.ConsumeFromEnd('2'                        )   );
            UT_EQ(  true     , s.ConsumeFromEnd('2'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  true     , s.ConsumeFromEnd('d'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  false    , s.ConsumeFromEnd('d'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  true     , s.ConsumeFromEnd('r'     , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  false    , s.ConsumeFromEnd("WO"    , Case.Sensitive, Whitespaces.Trim )   );
            UT_EQ(  false    , s.ConsumeFromEnd("WO"                       )   );
            UT_EQ(  true     , s.ConsumeFromEnd("wo"                       )   );

            UT_EQ(  2        , s.ConsumeFromEnd( 4 )   );
            UT_EQ(  "wo"     , s.ToString() );
        }

        // consume AString, Substring
        {
            Substring s= new Substring("word1 word2 word3 word4");
            Substring sConsume= new Substring( "1234word12", 4, 4 );
            AString   aConsume= new AString  (     "word"         );

            UT_EQ(  true,      s.Consume       ( sConsume )  );
            UT_EQ(  false,     s.Consume       ( sConsume )  );
            UT_EQ(  '1',       s.Consume       ( )           );
            UT_EQ(  false,     s.Consume       ( sConsume )  );
            UT_EQ(  true,      s.Consume       ( sConsume, Case.Sensitive, Whitespaces.Trim ) );
            UT_EQ(  '2',       s.Consume       ( )           );
            UT_EQ(  ' ',       s.Consume       ( )           );

            UT_EQ(  true,      s.Consume       ( aConsume )  );
            UT_EQ(  false,     s.Consume       ( aConsume )  );
            UT_EQ(  '3',       s.Consume       ( )           );
            UT_EQ(  false,     s.Consume       ( aConsume )  );
            UT_EQ(  true,      s.Consume       ( aConsume, Case.Sensitive, Whitespaces.Trim ) );

                      s.Set("1word  2word 3word  4word");

            UT_EQ(  true,      s.ConsumeFromEnd( sConsume )  );
            UT_EQ(  false,     s.ConsumeFromEnd( sConsume )  );
            UT_EQ(  '4',       s.ConsumeFromEnd( )           );
            UT_EQ(  false,     s.ConsumeFromEnd( sConsume )  );
            UT_EQ(  true,      s.ConsumeFromEnd( sConsume, Case.Sensitive, Whitespaces.Trim ) );
            UT_EQ(  '3',       s.ConsumeFromEnd( )           );
            UT_EQ(  ' ',       s.ConsumeFromEnd( )           );

            UT_EQ(  true,      s.ConsumeFromEnd( aConsume )  );
            UT_EQ(  false,     s.ConsumeFromEnd( aConsume )  );
            UT_EQ(  '2',       s.ConsumeFromEnd( )           );
            UT_EQ(  false,     s.ConsumeFromEnd( aConsume )  );
            UT_EQ(  true,      s.ConsumeFromEnd( aConsume, Case.Sensitive, Whitespaces.Trim ) );
        }
    }
Esempio n. 10
0
        /** ****************************************************************************************
         * Cuts the given number of characters from the end of the Substring and optionally
         * places the portion that was cut in parameter \p target (if provided).<br>
         * Parameter \p regionLength is checked to be between 0 and length. If negative, nothing
         * is cut and \p target is set empty. If \p regionLength is greater than this
         * objects' length, all contents is 'moved' to \p target.
         *
         * @param regionLength  The length of the region at the start to delete.
         * @param target        An optional target \b %Substring that receives the portion that
         *                      is cut from this object. Defaults to null.
         *
         * @return The new length of the substring.
         ******************************************************************************************/
        public int        ConsumeFromEnd( int regionLength,  Substring target= null )
        {
            if ( regionLength < 0 )
            {
                if ( target != null )
                    target.Clear();
                return  Length();
            }
            if ( regionLength > Length() )
                regionLength= Length();

            if ( target != null )
                target.Set( this, Length() - regionLength, regionLength );

            End-= regionLength;
            hash= 0;
            return Length();
        }
Esempio n. 11
0
        /** ****************************************************************************************
         * Splits this substring into two parts. What remains in this object is the region
         * from 0 to \p position.
         * \p target receives the rest. If \p separatorWidth is given, this is subtracted from
         * the front of \p target.
         *
         * @param position        The index where this object is split.
         * @param target          The target substring to receive the right part of the string.
         * @param separatorWidth  This does not change what remains in this object, but defines
         *                        the number of characters that are cut from the front of the
         *                        \p target. Defaults to 0.
         *
         * @return \c this to allow concatenated calls.
         ******************************************************************************************/
        public Substring Split( int position, Substring target, int separatorWidth  =0 )
        {
            CString.AdjustRegion( Length(), ref position, ref separatorWidth );

            target.Set( this, position + separatorWidth, Length() - position - separatorWidth );
            End= Start  + position -1;
            return this;
        }
Esempio n. 12
0
        /** ****************************************************************************************
         * Cuts the given number of characters from the beginning of the Substring and optionally
         * places the portion that was cut in parameter \p target (if provided).<br>
         * Parameter \p regionLength is checked to be between 0 and length. If negative, nothing
         * is cut and \p target is set empty. If \p regionLength is greater than this
         * objects' length, all contents is 'moved' to \p target.
         *
         * @param regionLength  The length of the region at the start to delete.
         * @param target        An optional target \b %Substring that receives the portion that
         *                      is cut from this object. Defaults to null.
         *
         * @return The new length of the substring.
         ******************************************************************************************/
        public int        Consume( int regionLength,  Substring target= null )
        {
            if ( regionLength < 0 )
            {
                if ( target != null )
                    target.Clear();
                return  Length();
            }
            if ( regionLength > Length() )
                regionLength= Length();

            if ( target != null )
                target.Set( this, 0, regionLength );

            Start+= regionLength;
            hash= 0;
            return Length();
        }
Esempio n. 13
0
    /** ****************************************************************************************
     * Implements functionality for configuration variable \c LOXNAME_DUMP_STATE_ON_EXIT.
     * Is called when a logger is removed.
     ******************************************************************************************/
    protected void dumpStateOnLoggerRemoval()
    {
        if( !loggerAddedSinceLastDebugState )
            return;
        loggerAddedSinceLastDebugState= false;

        Variable variable= new Variable( ALox.DUMP_STATE_ON_EXIT, GetName() );
        variable.Load();

        String      domain=         null;
        Verbosity   verbosity=      Verbosity.Info;

        Substring tok= new Substring();
        int flags= 0;
        for( int tokNo= 0; tokNo< variable.Size(); tokNo++ )
        {
            tok.Set( variable.GetString( tokNo ) );
            if( tok.IsEmpty() )
                continue;

            // state flags
                 if( tok.Equals( "NONE"            , Case.Ignore ) )  { flags= 0; break; }
            else if( tok.Equals( "Basic"           , Case.Ignore ) )  flags|= (int) Lox.StateInfo.Basic           ;
            else if( tok.Equals( "Version"         , Case.Ignore ) )  flags|= (int) Lox.StateInfo.Version         ;
            else if( tok.Equals( "Loggers"         , Case.Ignore ) )  flags|= (int) Lox.StateInfo.Loggers         ;

            else if( tok.Equals( "Domains"         , Case.Ignore ) )  flags|= (int) Lox.StateInfo.Domains         ;
            else if( tok.Equals( "InternalDomains" , Case.Ignore ) )  flags|= (int) Lox.StateInfo.InternalDomains ;
            else if( tok.Equals( "ScopeDomains"    , Case.Ignore ) )  flags|= (int) Lox.StateInfo.ScopeDomains    ;
            else if( tok.Equals( "DSR"             , Case.Ignore ) )  flags|= (int) Lox.StateInfo.DSR             ;
            else if( tok.Equals( "PrefixLogables"  , Case.Ignore ) )  flags|= (int) Lox.StateInfo.PrefixLogables  ;
            else if( tok.Equals( "Once"            , Case.Ignore ) )  flags|= (int) Lox.StateInfo.Once            ;
            else if( tok.Equals( "LogData"         , Case.Ignore ) )  flags|= (int) Lox.StateInfo.LogData         ;
            else if( tok.Equals( "ThreadMappings"  , Case.Ignore ) )  flags|= (int) Lox.StateInfo.ThreadMappings  ;

            else if( tok.Equals( "SPTR"            , Case.Ignore ) )  flags|= (int) Lox.StateInfo.SPTR            ;


            else if( tok.Equals( "All"             , Case.Ignore ) )  flags|= (int) Lox.StateInfo.All             ;

            // domain and verbosity
            else if( tok.Consume( "domain", Case.Ignore, Whitespaces.Trim ) )
            {
                if( tok.Consume( '=', Case.Sensitive, Whitespaces.Trim ) )
                    domain= tok.Trim().ToString();
            }
            else if( tok.Consume( "verbosity", Case.Ignore, Whitespaces.Trim ) )
            {
                if( tok.Consume( '=', Case.Sensitive, Whitespaces.Trim ) )
                    verbosity= ALox.ReadVerbosity( tok.Trim() );
            }

            // unknown argument
            else
            {
                logInternal( Verbosity.Error, "VAR", intMsg._()
                             ._( "Unknown argument '" )._(tok)
                             ._( "' in variable " )._(variable.Fullname)._( " = \"")._(variable.GetString())._('\"') );
            }
        }

        if ( flags != 0 )
        {
            State( domain, verbosity, "Auto dump state on exit requested: ", (Lox.StateInfo) flags );
        }
    }
Esempio n. 14
0
    /** ****************************************************************************************
     * Implements functionality for configuration variable \c LOXNAME_LOGGERNAME_VERBOSITY.
     * Is called when a logger is removed.
     * @param logger      The logger to write the verbosity for.
     ******************************************************************************************/
    protected void  writeVerbositiesOnLoggerRemoval( Logger logger )
    {
        // When writing back we will use this priority as the maximum to write. This way, if this was
        // an automatic default value, we will not write back into the user's variable store.
        // As always, only if the app fetches new variables on termination, this is entry is copied.
        Variable variable= new Variable( ALox.VERBOSITY, GetName(), logger.GetName() );
        variable.Load();

        // first token is "writeback" ?
        if ( variable.Size() == 0 )
            return;
        Substring firstArg= new Substring( variable.GetString() );
        if ( !firstArg.Consume( "writeback", Case.Ignore, Whitespaces.Trim ) )
            return;

        // optionally read a destination variable name
        Substring destVarCategory = new Substring();
        Substring destVarName     = new Substring();
        if( firstArg.Trim().IsNotEmpty() )
        {
            // separate category from variable name
            int catSeparatorIdx= firstArg.IndexOf( '_' );
            if (catSeparatorIdx >= 0 )
            {
                destVarCategory.Set( firstArg, 0                   , catSeparatorIdx );
                destVarName    .Set( firstArg, catSeparatorIdx + 1);
            }
            else
                destVarName.Set( firstArg );

            if ( destVarName.IsEmpty() )
            {
                logInternal( Verbosity.Error, "VAR", intMsg._()
                             ._( "Argument 'writeback' in variable " )
                             ._( variable.Fullname)
                             ._( "\n  Error:    Wrong destination variable name format\"" )
                             ._( firstArg )._( "\"" )  );
                return;
            }
        }

        // either write directly into LOX_LOGGER_VERBOSITY variable...
        Variable destVar= null;
        if( destVarName.IsEmpty() )
        {
            variable.ClearValues( 1 );
            destVar= variable;
        }
        // ...or into a new given variable
        else
        {
            destVar= new Variable( destVarCategory, destVarName, ALox.VERBOSITY.Delim );
            destVar.FormatHints=         variable.FormatHints;
            destVar.FormatAttrAlignment= variable.FormatAttrAlignment;
            destVar.Comments._("Created at runtime through config option 'writeback' in variable \"")._( variable.Fullname )._("\".");
        }

        // collect verbosities
        {
            int loggerNoMainDom= domains        .GetLoggerNo( logger );
            int loggerNoIntDom=  internalDomains.GetLoggerNo( logger );

            if ( loggerNoMainDom >= 0 ) verbositySettingToVariable( domains        , loggerNoMainDom, destVar );
            if ( loggerNoIntDom  >= 0 ) verbositySettingToVariable( internalDomains, loggerNoIntDom , destVar );
        }

        // now store using the same plug-in as original variable has
        destVar.Priority= variable.Priority;
        destVar.Store();

        // internal logging
        intMsg._()._( "Argument 'writeback' in variable " )._( variable.Fullname )
                  ._( ":\n  Verbosities for logger \"" )   ._( logger.GetName() )
                  ._( "\" written " );

        if( destVarName.IsEmpty() )
            intMsg._( "(to source variable)." );
        else
            intMsg._( "to variable \"" )  ._( destVar.Fullname ) ._("\".") ;
        logInternal( Verbosity.Info, "VAR", intMsg._( destVarName )._( "\"." ) );


        // verbose logging of the value written
        intMsg._()._("  Value:");
        for( int i= 0; i< destVar.Size() ; i++ )
            intMsg._( "\n    " )._( destVar.GetString(i) );
        logInternal( Verbosity.Verbose, "VAR", intMsg );
    }
Esempio n. 15
0
 /** ****************************************************************************************
  * Searches in the values of this variable for the pattern
  * <c>attrName = result</c> and
  * sets parameter \p result to the string following this pattern.
  *
  * @param      attrName     The name of the attribute searched.
  * @param[out] result       A substring with the result.
  * @param      attrDelim    The delimiter to search for. Defaults to '='.
  * @return \c true if the attribute was found, \c false otherwise.
  ******************************************************************************************/
 public bool    GetAttribute( String attrName, Substring result, char attrDelim= '=' )
 {
     for ( int i= 0; i< Size(); i++ )
     {
         result.Set( GetString(i ) );
         if (    result.Consume( attrName,  Case.Ignore, Whitespaces.Trim )
              && result.Consume( attrDelim, Case.Ignore, Whitespaces.Trim ) )
         {
             result.Trim();
             return true;
         }
     }
     return false;
 }
    public void IndexOf()
    {
        Substring subs;
        // indexOf()
        {
            subs= new Substring("ABCD");
            UT_EQ( -1,      subs.IndexOf('X') );
            UT_EQ(  0,      subs.IndexOf('A') );
            UT_EQ(  1,      subs.IndexOf('B') );
            UT_EQ(  2,      subs.IndexOf('C') );
            UT_EQ(  3,      subs.IndexOf('D') );
        }


        // search characters
        subs.Set( "abc@" +   "abcd abcd" + "abc@de", 4, 9 );
        {
            UT_EQ(   -1 ,  subs.IndexOf( '@', -5   ) );
            UT_EQ(   -1 ,  subs.IndexOf( '@'       ) );
            UT_EQ(   -1 ,  subs.IndexOf( '@', 5    ) );
            UT_EQ(   -1 ,  subs.IndexOf( '@', 150  ) );

            UT_EQ(    0 ,  subs.IndexOf( 'a'       ) );
            UT_EQ(    1 ,  subs.IndexOf( 'b'       ) );
            UT_EQ(    2 ,  subs.IndexOf( 'c'       ) );

            UT_EQ(    0 ,  subs.IndexOf( 'a', 0    ) );
            UT_EQ(    1 ,  subs.IndexOf( 'b', 0    ) );
            UT_EQ(    2 ,  subs.IndexOf( 'c', 0    ) );

            UT_EQ(    5 ,  subs.IndexOf( 'a', 1    ) );
            UT_EQ(    1 ,  subs.IndexOf( 'b', 1    ) );
            UT_EQ(    2 ,  subs.IndexOf( 'c', 1    ) );

            UT_EQ(    5 ,  subs.IndexOf( 'a', 2    ) );
            UT_EQ(    6 ,  subs.IndexOf( 'b', 2    ) );
            UT_EQ(    2 ,  subs.IndexOf( 'c', 2    ) );

            UT_EQ(    5 ,  subs.IndexOf( 'a', 3    ) );
            UT_EQ(    6 ,  subs.IndexOf( 'b', 3    ) );
            UT_EQ(    7 ,  subs.IndexOf( 'c', 3    ) );

            UT_EQ(    8 ,  subs.IndexOf( 'd', 7    ) );
            UT_EQ(    8 ,  subs.IndexOf( 'd', 8    ) );
            UT_EQ(   -1 ,  subs.IndexOf( 'd', 9    ) );
        }

        // search null, empty string
        subs.Set( "abc@" +   "abcd abcd" + "abc@de", 4, 9 );
        {
            UT_EQ(  0 ,  subs.IndexOf( (AString) null       ) );
            UT_EQ(  5 ,  subs.IndexOf( (AString) null,   5  ) );
            UT_EQ( -1 ,  subs.IndexOf( (AString) null,  50  ) );

            UT_EQ(  0 ,  subs.IndexOf( (AString) null, - 5  ) );

            UT_EQ(  0 ,  subs.IndexOf( (String) null        ) );
            UT_EQ(  5 ,  subs.IndexOf( (String) null,    5  ) );
            UT_EQ( -1 ,  subs.IndexOf( (String) null,   50  ) );
            UT_EQ(  0 ,  subs.IndexOf( (String) null, -  5  ) );

            UT_EQ(  0 ,  subs.IndexOf( "",            -  5  ) );
            UT_EQ(  0 ,  subs.IndexOf( "",               0  ) );
            UT_EQ(  4 ,  subs.IndexOf( "",               4  ) );
            UT_EQ( -1 ,  subs.IndexOf( "",             100  ) );
        }

        // search
        subs.Set( "abc@" +   "abcd abcd" + "abc@de", 4, 9 );
        {
            UT_EQ(  0 ,  subs.IndexOf( "abcd"     ) );
            UT_EQ(  1 ,  subs.IndexOf( "b"        ) );
            UT_EQ(  4 ,  subs.IndexOf( " abcd"    ) );
            UT_EQ(  5 ,  subs.IndexOf( "abcd",  1 ) );
            UT_EQ(  0 ,  subs.IndexOf( "abcd",- 1 ) );
            UT_EQ(  -1,  subs.IndexOf( "xyz", -10 ) );
        }

        // ignore case
        String t= "Hello A-Worx util";
        subs.Set( "abc@" +   t + "abc@de", 4, t.Length );
        {
            UT_EQ(  6 ,  subs.IndexOf( "a-worx",   0    ,Case.Ignore ) );
            UT_EQ(  6 ,  subs.IndexOf( "a-worx",   1    ,Case.Ignore ) );
            UT_EQ(  6 ,  subs.IndexOf( "a-worx", -10    ,Case.Ignore ) );
            UT_EQ(  6 ,  subs.IndexOf( "a-worx",   6    ,Case.Ignore ) );
            UT_EQ(  -1,  subs.IndexOf( "a-worx",   7    ,Case.Ignore ) );
            UT_EQ(  -1,  subs.IndexOf( "a-worx", 100    ,Case.Ignore ) );
            UT_EQ(   0,  subs.IndexOf( "hel",      0    ,Case.Ignore ) );
            UT_EQ(  -1,  subs.IndexOf( "hel",      1    ,Case.Ignore ) );
            UT_EQ(  13,  subs.IndexOf( "util",     1    ,Case.Ignore ) );
            UT_EQ(  13,  subs.IndexOf( "UTIL",     5    ,Case.Ignore ) );
            UT_EQ(  13,  subs.IndexOf( "UTIL",    13    ,Case.Ignore ) );
            UT_EQ(  -1,  subs.IndexOf( "UTIL",    14    ,Case.Ignore ) );
        }
        // ------------------ search one of several characters ------------------
        subs.Set( "abc@" +   "abcd abcde" + "abc@de", 4, 10 );
        {
            // search one of
            int l= subs.Length();
            UT_EQ(   4,  subs.IndexOfAny    ( CString.DefaultWhitespaces,Inclusion.Include  ) );
            UT_EQ(  -1,  subs.IndexOfAny    ( "x"    .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(  -1,  subs.IndexOfAny    ( "xy"   .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(  -1,  subs.IndexOfAny    ( "xyz"  .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "xyd"  .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "d"    .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "xyd"  .ToCharArray() ,Inclusion.Include,  -2 ) );
            UT_EQ(   8,  subs.IndexOfAny    ( "xyd"  .ToCharArray() ,Inclusion.Include,   4 ) );
            UT_EQ(  -1,  subs.IndexOfAny    ( "xyd"  .ToCharArray() ,Inclusion.Include,  20 ) );

            UT_EQ(  -1,  subs.LastIndexOfAny( ""     .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "x"    .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "xy"   .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "xyz"  .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(   8,  subs.LastIndexOfAny( "xyd"  .ToCharArray() ,Inclusion.Include      ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "xyd"  .ToCharArray() ,Inclusion.Include,  -2 ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "xyd"  .ToCharArray() ,Inclusion.Include,   2 ) );
            UT_EQ(   3,  subs.LastIndexOfAny( "xyd"  .ToCharArray() ,Inclusion.Include,   4 ) );
            UT_EQ(   0,  subs.LastIndexOfAny( "a"    .ToCharArray() ,Inclusion.Include,   4 ) );
            UT_EQ(   1,  subs.LastIndexOfAny( "b"    .ToCharArray() ,Inclusion.Include,   4 ) );
            UT_EQ(   1,  subs.LastIndexOfAny( "ba"   .ToCharArray() ,Inclusion.Include,   4 ) );
            UT_EQ(   0,  subs.LastIndexOfAny( "xa"   .ToCharArray() ,Inclusion.Include,   4 ) );
            UT_EQ(   8,  subs.LastIndexOfAny( "xyd"  .ToCharArray() ,Inclusion.Include,  20 ) );
            UT_EQ(   8,  subs.LastIndexOfAny( "d"    .ToCharArray() ,Inclusion.Include,  20 ) );
            UT_EQ(   9,  subs.LastIndexOfAny( "e"    .ToCharArray() ,Inclusion.Include,  20 ) );

            // search NOT one of
            UT_EQ(   0,  subs.IndexOfAny    ( ""     .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   0,  subs.IndexOfAny    ( "x"    .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   0,  subs.IndexOfAny    ( "xy"   .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   0,  subs.IndexOfAny    ( "xyz"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   1,  subs.IndexOfAny    ( "a"    .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   2,  subs.IndexOfAny    ( "ba"   .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "abc"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "acb"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "cba"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   3,  subs.IndexOfAny    ( "xcba" .ToCharArray() ,Inclusion.Exclude      ) );

            UT_EQ( l-1,  subs.LastIndexOfAny( ""     .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-1,  subs.LastIndexOfAny( "x"    .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-1,  subs.LastIndexOfAny( "xy"   .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-2,  subs.LastIndexOfAny( "e"    .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-3,  subs.LastIndexOfAny( "de"   .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-4,  subs.LastIndexOfAny( "cde"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-4,  subs.LastIndexOfAny( "ced"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ( l-4,  subs.LastIndexOfAny( "ecd"  .ToCharArray() ,Inclusion.Exclude      ) );
            UT_EQ(   5,  subs.LastIndexOfAny( "ecd"  .ToCharArray() ,Inclusion.Exclude, 5   ) );
            UT_EQ(   4,  subs.LastIndexOfAny( "ecd"  .ToCharArray() ,Inclusion.Exclude, 4   ) );
            UT_EQ(   1,  subs.LastIndexOfAny( "acd"  .ToCharArray() ,Inclusion.Exclude, 3   ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "abc"  .ToCharArray() ,Inclusion.Exclude, 2   ) );
            UT_EQ(   3,  subs.LastIndexOfAny( "xay"  .ToCharArray() ,Inclusion.Exclude, 3   ) );
            UT_EQ(   2,  subs.LastIndexOfAny( "d"    .ToCharArray() ,Inclusion.Exclude, 3   ) );
            UT_EQ(  -1,  subs.LastIndexOfAny( "a"    .ToCharArray() ,Inclusion.Exclude, 0   ) );
        }

    }
Esempio n. 17
0
    // #############################################################################################
    // file IO
    // #############################################################################################

        /** ****************************************************************************************
         * Clears all configuration data and reads the file. It might happen that lines are
         * ignored or otherwise marked as faulty. All numbers of such lines get collected in
         * field LinesWithReadErrors.
         * @return Returns the #Status of the operation.
         ******************************************************************************************/
        public IniFile.Status  ReadFile()
        {
            Reset();
            LastStatus= Status.OK;

            // read all variables
            StreamReader file;
            try
            {
                file= new StreamReader( FileName.ToString() );
            }
            catch( Exception )
            {
                return LastStatus= Status.ERROR_OPENING_FILE;
            }

            String      lineS;
            AString     name=       new AString();
            AString     value=      new AString();
            AString     comments=   new AString();
            Section     actSection= (IniFile.Section) Sections[0];
            Substring   line=       new Substring();

            int         lineNo= 0;
            bool        fileHeaderRead= false;

            char[]      separatorCharacters= value._( "=" )._( CString.DefaultWhitespaces )
                                                  .ToString().ToCharArray();

            LinesWithReadErrors.Clear();
            while ( (lineS= file.ReadLine()) != null )
            {
                lineNo++;

                bool isEmpty=       line.Set( lineS ).Trim().IsEmpty();
                bool isCommentLine= startsWithCommentSymbol( line );

                if ( isCommentLine )
                {
                    if ( comments.IsNotEmpty() )
                        comments.NewLine();
                    comments._(line);
                    continue;
                }

                // still processing file header?
                if ( !fileHeaderRead )
                {
                    fileHeaderRead= true;
                    FileComments._()._( comments );
                    comments.Clear();
                }

                // empty line?
                if ( isEmpty )
                {
                    if ( comments.IsNotEmpty() )
                        comments.NewLine();
                    continue;
                }

                // section line
                if ( line.Consume( '[' ) )
                {
                    fileHeaderRead= true;

                    // we do not care if there is no closing bracket. But if there is one, we remove it.
                    if( !line.ConsumeFromEnd(']') )
                        LinesWithReadErrors.Add( lineNo );

                    // search the section in our section list (if section existed already, new comments
                    // are dropped)
                    actSection= (IniFile.Section) SearchOrCreateSection( line, comments);
                    comments.Clear();

                    continue;
                }

                // variable line?
                value.Clear();
                int idx= line.IndexOfAny( separatorCharacters, Inclusion.Include );
                if( idx < 0 )
                {
                    name._()._( line );
                    line.Clear();
                }
                else
                {
                    name._()._( line.Buf, line.Start, idx );
                    line.Consume( idx );
                    value._(line);
                }

                // read continues as long as lines end with '\' (must not be '\\')
                while (     line.CharAtEnd()  == '\\'
                        &&  line.CharAtEnd(1) != '\\' )
                {
                    value.NewLine();

                    if ( (lineS= file.ReadLine()) == null  )
                    {
                        // last line of the file ended with '\' !
                        line.Clear();
                        break;
                    }
                    line.Set( lineS ).TrimEnd();
                    value._( line );
                }

                // insert entry with raw value
                {
                    IniFile.Entry entry= (IniFile.Entry) actSection.GetEntry( name, true );
                    entry.Values  .Clear();
                    entry.Comments._()._( comments );
                    entry.RawValue._()._( value );

                    // if there is just no raw value, we add an empty string to the entries' values
                    if ( value.IsEmpty() )
                        entry.Values.Add( new AString() );
                }

                comments.Clear();

            }
            file.Close();

            return LastStatus;
        }
Esempio n. 18
0
    /** ****************************************************************************************
     * Reads the verbosity for the given logger and domain from the ALib configuration system.
     * This internal method is used in two occasions:
     * - when a new logger is added: recursively for all existing domains (\p configStr is
     *   given)
     * - when a new domain is created on the fly(\p configStr is not given)
     *
     * @param logger      The logger to set the verbosity for.
     * @param dom         The domain to set the verbosity for.
     * @param variable    The (already read) variable to set verbosities from.
     ******************************************************************************************/
    protected void  getVerbosityFromConfig( Logger  logger,  Domain  dom, Variable variable  )
    {
        // get logger number. It may happen that the logger is not existent in this domain tree.
        int loggerNo= dom.GetLoggerNo( logger ) ;
        if ( loggerNo < 0 )
            return;

        Tokenizer verbosityTknzr=   new Tokenizer();
        Substring domainStr=      new Substring();
        AString   domainStrBuf=   new AString();
        for( int varNo= 0; varNo< variable.Size(); varNo++ )
        {
            verbosityTknzr.Set( variable.GetString( varNo ), '=' );

            domainStr.Set( verbosityTknzr.Next() );
            if ( domainStr.StartsWith( "INTERNAL_DOMAINS", DomainSensitivity ) )
            {
                domainStrBuf._()._( domainStr.Buf, domainStr.Start + 16, domainStr.Length() -16 );
                while ( domainStrBuf.CharAtStart() == '/' )
                    domainStrBuf.DeleteStart( 1 );
                domainStrBuf.InsertAt( ALox.InternalDomains, 0 );
                domainStr.Set( domainStrBuf );
            }

            Substring verbosityStr=  verbosityTknzr.Next();
            if ( verbosityStr.IsEmpty() )
                continue;

            int searchMode= 0;
            if ( domainStr.Consume       ( '*' ) )    searchMode+= 2;
            if ( domainStr.ConsumeFromEnd( '*' ) )    searchMode+= 1;
            if(     ( searchMode == 0 && dom.FullPath.Equals          ( domainStr,    DomainSensitivity )     )
                ||  ( searchMode == 1 && dom.FullPath.StartsWith      ( domainStr,    DomainSensitivity )     )
                ||  ( searchMode == 2 && dom.FullPath.EndsWith        ( domainStr,    DomainSensitivity )     )
                ||  ( searchMode == 3 && dom.FullPath.IndexOf         ( domainStr, 0, DomainSensitivity ) >=0 )
                )
            {
                Verbosity verbosity= ALox.ReadVerbosity( verbosityStr);
                dom.SetVerbosity( loggerNo, verbosity, variable.Priority );

                // log info on this
                intMsg._()._NC( "Logger \"" )._NC( logger.GetName() ) ._NC( "\":" ).Tab(11 + maxLoggerNameLength)
                          ._( '\'' )._NC( dom.FullPath )
                          ._( '\'' ).InsertChars(' ', maxDomainPathLength - dom.FullPath.Length() + 1 )
                          ._("= Verbosity." );
                          ALox.ToString( verbosity, dom.GetPriority(loggerNo), intMsg ).TrimEnd()
                          ._('.');
                logInternal( Verbosity.Info, "LGR", intMsg );
            }
        }
    }