Changeset 135

Show
Ignore:
Timestamp:
04/06/08 18:18:10 (5 months ago)
Author:
mikey
Message:

added support for octal numbers

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/XJConf/converters/PrimitiveValueConverter.php

    r125 r135  
    5555            case 'integer': 
    5656            case 'int': 
     57                if ('0' === $value{0}) { 
     58                    return octdec($value); 
     59                } 
     60                 
    5761                return (integer) $value; 
    5862            case 'double': 
  • trunk/examples/xml/defines.xml

    r27 r135  
    11<defines> 
    22        <tag name="zahl" type="integer"/> 
     3        <tag name="octal" type="integer"/> 
    34        <tag name="foo" type="string"/> 
    45        <tag name="schst" type="UpperString"/> 
  • trunk/examples/xml/test.xml

    r27 r135  
    77        <foo>tomato</foo> 
    88        <zahl>124</zahl> 
     9        <octal>0777</octal> 
    910         
    1011        <schst>tomato</schst> 
  • trunk/tests/integration/Example1TestCase.php

    r119 r135  
    2727        $tagParser = new DefinitionParser(); 
    2828        $defs      = $tagParser->parse(EXAMPLES_DIR . '/xml/defines.xml'); 
    29         $this->assertEqual($defs->countTagDefinitions(), 9); 
     29        $this->assertEqual($defs->countTagDefinitions(), 10); 
    3030         
    3131        $conf = new XmlParser(); 
     
    3535        $this->assertEqual($conf->getConfigValue('foo'), 'tomato'); 
    3636        $this->assertEqual($conf->getConfigValue('zahl'), 124); 
     37        $this->assertEqual($conf->getConfigValue('octal'), 0777); 
    3738        $this->assertEqual($conf->getConfigValue('schst')->getString(), 'TOMATO'); 
    3839        $this->assertEqual($conf->getConfigValue('complex')->render(), '<font color="red" size="3">This is a string.</font>');