OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** | |
6 * | |
7 * Built-in types, collections, | |
8 * and other core functionality for every Dart program. | |
9 * | |
10 * This library is automatically imported. | |
11 * | |
12 * Some classes in this library, | |
13 * such as [String] and [num], | |
14 * support Dart's built-in data types. | |
15 * Other classes, such as [List] and [Map], provide data structures | |
16 * for managing collections of objects. | |
17 * And still other classes represent commonly used types of data | |
18 * such as URIs, dates and times, and errors. | |
19 * | |
20 * ## Numbers and booleans | |
21 * | |
22 * [int] and [double] provide support for Dart's built-in numerical data types: | |
23 * integers and double-precision floating point numbers, respectively. | |
24 * An object of type [bool] is either true or false. | |
25 * Variables of these types can be constructed from literals: | |
26 * | |
27 * int meaningOfLife = 42; | |
28 * double valueOfPi = 3.141592; | |
29 * bool visible = true; | |
30 * | |
31 * ## Strings and regular expressions | |
32 * | |
33 * A [String] is immutable and represents a sequence of characters. | |
34 * | |
35 * String shakespeareQuote = "All the world's a stage, ..."; | |
36 * | |
37 * [StringBuffer] provides a way to construct strings efficiently. | |
38 * | |
39 * StringBuffer moreShakespeare = new StringBuffer(); | |
40 * moreShakespeare.write('And all the men and women '); | |
41 * moreShakespeare.write('merely players; ...'); | |
42 * | |
43 * The String and StringBuffer classes implement string concatenation, | |
44 * interpolation, and other string manipulation features. | |
45 * | |
46 * String philosophy = 'Live on '; | |
47 * String get palindrome => philosophy + philosophy.split('').reversed.join(
); | |
48 * | |
49 * [RegExp] implements Dart regular expressions, | |
50 * which provide a grammar for matching patterns within text. | |
51 * For example, here's a regular expression that matches | |
52 * a string of one or more digits: | |
53 * | |
54 * var numbers = new RegExp(r'\d+'); | |
55 * | |
56 * Dart regular expressions have the same syntax and semantics as | |
57 * JavaScript regular expressions. See | |
58 * <http://ecma-international.org/ecma-262/5.1/#sec-15.10> | |
59 * for the specification of JavaScript regular expressions. | |
60 * | |
61 * ## Collections | |
62 * | |
63 * The dart:core library provides basic collections, | |
64 * such as [List], [Map], and [Set]. | |
65 * | |
66 * A List is an ordered collection of objects, with a length. | |
67 * Lists are sometimes called arrays. | |
68 * Use a List when you need to access objects by index. | |
69 * | |
70 * List superheroes = [ 'Batman', 'Superman', 'Harry Potter' ]; | |
71 * | |
72 * A Set is an unordered collection of unique objects. | |
73 * You cannot get an item by index (position). | |
74 * Adding a duplicate item has no effect. | |
75 * | |
76 * Set villains = new Set(); | |
77 * villains.add('Joker'); | |
78 * villains.addAll( ['Lex Luther', 'Voldemort'] ); | |
79 * | |
80 * A Map is an unordered collection of key-value pairs. | |
81 * Maps are sometimes called associative arrays because | |
82 * maps associate a key to some value for easy retrieval. | |
83 * Keys are unique. | |
84 * Use a Map when you need to access objects | |
85 * by a unique identifier. | |
86 * | |
87 * Map sidekicks = { 'Batman': 'Robin', | |
88 * 'Superman': 'Lois Lane', | |
89 * 'Harry Potter': 'Ron and Hermione' }; | |
90 * | |
91 * In addition to these classes, | |
92 * dart:core contains [Iterable], | |
93 * an interface that defines functionality | |
94 * common in collections of objects. | |
95 * Examples include the ability | |
96 * to run a function on each element in the collection, | |
97 * to apply a test to each element, | |
98 * to retrieve an object, and to determine length. | |
99 * | |
100 * Iterable is implemented by List and Set, | |
101 * and used by Map for its keys and values. | |
102 * | |
103 * For other kinds of collections, check out the | |
104 * [dart:collection](#dart-collection) library. | |
105 * | |
106 * ## Date and time | |
107 * | |
108 * Use [DateTime] to represent a point in time | |
109 * and [Duration] to represent a span of time. | |
110 * | |
111 * You can create DateTime objects with constructors | |
112 * or by parsing a correctly formatted string. | |
113 * | |
114 * DateTime now = new DateTime.now(); | |
115 * DateTime berlinWallFell = new DateTime(1989, 11, 9); | |
116 * DateTime moonLanding = DateTime.parse("1969-07-20"); | |
117 * | |
118 * Create a Duration object specifying the individual time units. | |
119 * | |
120 * Duration timeRemaining = new Duration(hours:56, minutes:14); | |
121 * | |
122 * In addition to DateTime and Duration, | |
123 * dart:core contains the [Stopwatch] class for measuring elapsed time. | |
124 * | |
125 * ## Uri | |
126 * | |
127 * A [Uri] object represents a uniform resource identifier, | |
128 * which identifies a resource on the web. | |
129 * | |
130 * Uri dartlang = Uri.parse('http://dartlang.org/'); | |
131 * | |
132 * ## Errors | |
133 * | |
134 * The [Error] class represents the occurrence of an error | |
135 * during runtime. | |
136 * Subclasses of this class represent specific kinds of errors. | |
137 * | |
138 * ## Other documentation | |
139 * | |
140 * For more information about how to use the built-in types, refer to [Built-in | |
141 * Types](http://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html#bu
ilt-in-types) | |
142 * in Chapter 2 of | |
143 * [Dart: Up and Running](http://www.dartlang.org/docs/dart-up-and-running/). | |
144 * | |
145 * Also, see [dart:core - Numbers, Collections, Strings, and | |
146 * More](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartcore---
numbers-collections-strings-and-more) | |
147 * for more coverage of classes in this package. | |
148 * | |
149 * The | |
150 * [Dart Language Specification](http://www.dartlang.org/docs/spec/) | |
151 * provides technical details. | |
152 */ | |
153 library dart.core; | |
154 | |
155 import "dart:collection"; | |
156 import "dart:_internal" hide Symbol; | |
157 import "dart:_internal" as internal show Symbol; | |
158 import 'dart:_js_helper' show NoInline; | |
159 import "dart:convert" show | |
160 Encoding, ASCII, LATIN1, UTF8, | |
161 BASE64, StringConversionSink, ChunkedConversionSink; | |
162 import "dart:math" show Random; // Used by List.shuffle. | |
163 import "dart:typed_data" show Uint8List; | |
164 | |
165 part "annotations.dart"; | |
166 part "bool.dart"; | |
167 part "comparable.dart"; | |
168 part "date_time.dart"; | |
169 part "double.dart"; | |
170 part "duration.dart"; | |
171 part "errors.dart"; | |
172 part "exceptions.dart"; | |
173 part "expando.dart"; | |
174 part "function.dart"; | |
175 part "identical.dart"; | |
176 part "int.dart"; | |
177 part "invocation.dart"; | |
178 part "iterable.dart"; | |
179 part "iterator.dart"; | |
180 part "list.dart"; | |
181 part "map.dart"; | |
182 part "null.dart"; | |
183 part "num.dart"; | |
184 part "object.dart"; | |
185 part "pattern.dart"; | |
186 part "print.dart"; | |
187 part "regexp.dart"; | |
188 part "set.dart"; | |
189 part "sink.dart"; | |
190 part "stacktrace.dart"; | |
191 part "stopwatch.dart"; | |
192 part "string.dart"; | |
193 part "string_buffer.dart"; | |
194 part "string_sink.dart"; | |
195 part "symbol.dart"; | |
196 part "type.dart"; | |
197 part "uri.dart"; | |
OLD | NEW |