diff options
Diffstat (limited to 'js/helper-classes/3D/ParseUtils.js')
-rwxr-xr-x | js/helper-classes/3D/ParseUtils.js | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/js/helper-classes/3D/ParseUtils.js b/js/helper-classes/3D/ParseUtils.js deleted file mode 100755 index 556253e9..00000000 --- a/js/helper-classes/3D/ParseUtils.js +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | /////////////////////////////////////////////////////////////////////// | ||
8 | // Class Utils | ||
9 | // Vector Utility functions | ||
10 | /////////////////////////////////////////////////////////////////////// | ||
11 | function ParseUtils( theStr ) | ||
12 | { | ||
13 | /////////////////////////////////////////////////////////////////////// | ||
14 | // Instance variables | ||
15 | /////////////////////////////////////////////////////////////////////// | ||
16 | this._strBuffer = theStr; | ||
17 | |||
18 | /////////////////////////////////////////////////////////////////////// | ||
19 | // Property accessors | ||
20 | /////////////////////////////////////////////////////////////////////// | ||
21 | this.getBuffer = function() { return this._strBuffer; } | ||
22 | this.setBuffer = function(b) { this._strBuffer = b; } | ||
23 | |||
24 | /////////////////////////////////////////////////////////////////////// | ||
25 | // Methods | ||
26 | /////////////////////////////////////////////////////////////////////// | ||
27 | this.nextValue = function( prop, endKeyArg, advanceBufferArg ) | ||
28 | { | ||
29 | if (!this._strBuffer) return; | ||
30 | |||
31 | // make the 2 & 3rd argument optional. default is to advance the string | ||
32 | var endKey = "\n", advanceBuffer = true; | ||
33 | if (endKeyArg) | ||
34 | endKey = endKeyArg; | ||
35 | if (advanceBufferArg) | ||
36 | advanceBuffer = advanceBufferArg; | ||
37 | |||
38 | var iStart = this._strBuffer.indexOf( prop ); | ||
39 | if (iStart < 0) return; | ||
40 | |||
41 | var iEnd = this._strBuffer.indexOf( endKey, iStart ); | ||
42 | if (iEnd < 0) throw new Error( "property " + prop + " improperly terminated: " + this._strBuffer); | ||
43 | |||
44 | iStart += prop.length; | ||
45 | var nChars = iEnd - iStart; | ||
46 | var rtnStr = this._strBuffer.substr( iStart, nChars ); | ||
47 | |||
48 | if (advanceBuffer) | ||
49 | this._strBuffer = this._strBuffer.substr( iEnd + endKey.length ); | ||
50 | |||
51 | return rtnStr; | ||
52 | } | ||
53 | |||
54 | this.nextToken = function() | ||
55 | { | ||
56 | if (!this._strBuffer) return; | ||
57 | |||
58 | // find the limits | ||
59 | var index = this._strBuffer.search( /\S/ ); // first non-whitespace character | ||
60 | if (index > 0) this._strBuffer = this._strBuffer.slice(index); | ||
61 | index = this._strBuffer.search( /\s/ ); // first whitespace character marking the end of the token | ||
62 | |||
63 | var token; | ||
64 | if (index > 0) | ||
65 | { | ||
66 | token = this._strBuffer.slice(0, index); | ||
67 | this._strBuffer = this._strBuffer.slice( index ); | ||
68 | } | ||
69 | |||
70 | return token; | ||
71 | } | ||
72 | |||
73 | this.advancePastToken = function( token ) | ||
74 | { | ||
75 | var index = this._strBuffer.indexOf( token ); | ||
76 | if (index < 0) | ||
77 | console.log( "could not find token: " + token + " in string: " + this._strBuffer ); | ||
78 | else | ||
79 | this._strBuffer = this._strBuffer.substr( index + token.length ); | ||
80 | } | ||
81 | |||
82 | } | ||
83 | |||
84 | |||