aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/ParseUtils.js
diff options
context:
space:
mode:
authorJon Reid2012-03-06 14:14:01 -0800
committerJon Reid2012-03-06 14:14:01 -0800
commit60bba95eaffa8b5c741c6c85fb84b327cd75d6c3 (patch)
tree0087ad093418638ff1d0b4362715bd7b2d147eba /js/helper-classes/3D/ParseUtils.js
parentd64f8c9fc1dd5fb15ad78ad61bed1ef3736321bb (diff)
parent342fb451bd251358068a0dcb10e9dc218b79a176 (diff)
downloadninja-60bba95eaffa8b5c741c6c85fb84b327cd75d6c3.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into Timeline-uber
Diffstat (limited to 'js/helper-classes/3D/ParseUtils.js')
-rwxr-xr-xjs/helper-classes/3D/ParseUtils.js84
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>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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///////////////////////////////////////////////////////////////////////
11function 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