wasCSharpSQLite – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * CharPointer.java -- |
||
3 | * |
||
4 | * Used in the Parser, this class implements the functionality |
||
5 | * of a C character pointer. CharPointers referencing the same |
||
6 | * script share a reference to one array, while maintaining there |
||
7 | * own current index into the array. |
||
8 | * |
||
9 | * Copyright (c) 1997 by Sun Microsystems, Inc. |
||
10 | * |
||
11 | * See the file "license.terms" for information on usage and redistribution |
||
12 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
||
13 | * |
||
14 | * Included in SQLite3 port to C# for use in testharness only; 2008 Noah B Hart |
||
15 | * |
||
16 | * RCS @(#) $Id: CharPointer.java,v 1.4 1999/08/05 03:33:44 mo Exp $ |
||
17 | */ |
||
18 | using System; |
||
19 | |||
20 | namespace tcl.lang |
||
21 | { |
||
22 | public class CharPointer |
||
23 | { |
||
24 | |||
25 | // A string of characters. |
||
26 | |||
27 | public char[] array; |
||
28 | |||
29 | // The current index into the array. |
||
30 | |||
31 | public int index; |
||
32 | internal CharPointer() |
||
33 | { |
||
34 | this.array = null; |
||
35 | this.index = -1; |
||
36 | } |
||
37 | internal CharPointer( CharPointer c ) |
||
38 | { |
||
39 | this.array = c.array; |
||
40 | this.index = c.index; |
||
41 | } |
||
42 | public CharPointer( string str ) |
||
43 | { |
||
44 | int len = str.Length; |
||
45 | this.array = new char[len + 1]; |
||
46 | SupportClass.GetCharsFromString( str, 0, len, ref this.array, 0 ); |
||
47 | this.array[len] = '\x0000'; |
||
48 | this.index = 0; |
||
49 | } |
||
50 | internal char charAt() |
||
51 | { |
||
52 | return ( array[index] ); |
||
53 | } |
||
54 | internal char charAt( int x ) |
||
55 | { |
||
56 | return ( array[index + x] ); |
||
57 | } |
||
58 | public int length() |
||
59 | { |
||
60 | return ( array.Length - 1 ); |
||
61 | } |
||
62 | public override string ToString() |
||
63 | { |
||
64 | return new string( array, 0, array.Length - 1 ); |
||
65 | } |
||
66 | } // end CharPointer |
||
67 | } |