Merge branch 'master' of congo:dev/ohcount
[ohcount] / test / expected_dir / haxe1.hx
1 haxe    comment /*
2 haxe    comment # ***** BEGIN LICENSE BLOCK *****
3 haxe    comment Copyright the original author or authors.
4 haxe    comment Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
5 haxe    comment you may not use this file except in compliance with the License.
6 haxe    comment You may obtain a copy of the License at
7 haxe    comment         http://www.mozilla.org/MPL/MPL-1.1.html
8 haxe    comment Unless required by applicable law or agreed to in writing, software
9 haxe    comment distributed under the License is distributed on an "AS IS" BASIS,
10 haxe    comment WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 haxe    comment See the License for the specific language governing permissions and
12 haxe    comment limitations under the License.
13 haxe    blank   
14 haxe    comment # ***** END LICENSE BLOCK *****
15 haxe    comment */
16 haxe    blank   
17 haxe    code    package sandy.parser;
18 haxe    blank   
19 haxe    comment /**
20 haxe    comment  * The Parser factory class creates instances of parser classes.
21 haxe    comment  * The specific parser can be specified in the create method's second parameter.
22 haxe    comment  *
23 haxe    comment  * @author              Thomas Pfeiffer - kiroukou
24 haxe    comment  * @author Niel Drummond - haXe port
25 haxe    comment  *
26 haxe    comment  *
27 haxe    comment  *
28 haxe    comment  * @example To parse a 3DS file at runtime:
29 haxe    comment  *
30 haxe    comment  * <listing version="3.0">
31 haxe    comment  *     var parser:IParser = Parser.create( "/path/to/my/3dsfile.3ds", Parser.max );
32 haxe    comment  * </listing>
33 haxe    comment  *
34 haxe    comment  */
35 haxe    blank   
36 haxe    code    class Parser
37 haxe    code    {
38 haxe    comment         /**
39 haxe    comment          * Parameter that is used to specify that the ASE (ASCII Scene Export)
40 haxe    comment          * Parser should be used
41 haxe    comment          */
42 haxe    code            public static var ASE:String = "ASE";
43 haxe    comment         /**
44 haxe    comment          * Parameter that is used to specify that the 3DS (3D Studio) Parser
45 haxe    comment          * should be used
46 haxe    comment          */
47 haxe    code            public static var MAX_3DS:String = "3DS";
48 haxe    comment         /**
49 haxe    comment          * Parameter that is used to specify that the COLLADA (COLLAborative
50 haxe    comment          * Design Activity ) Parser should be used
51 haxe    comment          */
52 haxe    code            public static var COLLADA:String = "DAE";
53 haxe    blank   
54 haxe    comment         /**
55 haxe    comment          * The create method chooses which parser to use. This can be done automatically
56 haxe    comment          * by looking at the file extension or by passing the parser type String as the
57 haxe    comment          * second parameter.
58 haxe    comment          *
59 haxe    comment          * @example To parse a 3DS file at runtime:
60 haxe    comment          *
61 haxe    comment          * <listing version="3.0">
62 haxe    comment          *     var parser:IParser = Parser.create( "/path/to/my/3dsfile.3ds", Parser.MAX );
63 haxe    comment          * </listing>
64 haxe    comment          *
65 haxe    comment          * @param p_sFile                       Can be either a string pointing to the location of the
66 haxe    comment          *                                                      file or an instance of an embedded file
67 haxe    comment          * @param p_sParserType         The parser type string
68 haxe    comment          * @param p_nScale                      The scale factor
69 haxe    comment          * @return                                      The parser to be used
70 haxe    comment          */
71 haxe    code            public static function create( p_sFile:Dynamic, ?p_sParserType:String, ?p_nScale:Float ):IParser
72 haxe    code            {
73 haxe    code            if ( p_nScale == null ) p_nScale = 1;
74 haxe    blank   
75 haxe    code                    var l_sExt:String,l_iParser:IParser = null;
76 haxe    comment                 // --
77 haxe    code                    if( Std.is( p_sFile, String ) && p_sParserType == null )
78 haxe    code                    {
79 haxe    code                            l_sExt = (p_sFile.split('.')).reverse()[0];
80 haxe    code                    }
81 haxe    code                    else
82 haxe    code                    {
83 haxe    code                            l_sExt = p_sParserType;
84 haxe    code                    }
85 haxe    comment                 // --
86 haxe    code                    switch( l_sExt.toUpperCase() )
87 haxe    code                    {
88 haxe    code                            case "ASE":
89 haxe    code                                    l_iParser = new ASEParser( p_sFile, p_nScale );
90 haxe    code                            case "OBJ":
91 haxe    code                            case "DAE":
92 haxe    code                                    l_iParser = new ColladaParser( p_sFile, p_nScale );
93 haxe    code                            case "3DS":
94 haxe    code                                    l_iParser = new Parser3DS( p_sFile, p_nScale );
95 haxe    code                            default:
96 haxe    code                    }
97 haxe    comment                 // --
98 haxe    code                    return l_iParser;
99 haxe    code            }
100 haxe    code    }
101 haxe    blank