OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 * A JavaScript value representing a 32-bit unsigned integer. | 1342 * A JavaScript value representing a 32-bit unsigned integer. |
1343 */ | 1343 */ |
1344 class Uint32 : public Integer { | 1344 class Uint32 : public Integer { |
1345 public: | 1345 public: |
1346 V8EXPORT uint32_t Value() const; | 1346 V8EXPORT uint32_t Value() const; |
1347 private: | 1347 private: |
1348 V8EXPORT Uint32(); | 1348 V8EXPORT Uint32(); |
1349 }; | 1349 }; |
1350 | 1350 |
1351 | 1351 |
1352 /** | |
1353 * An instance of the built-in Date constructor (ECMA-262, 15.9). | |
1354 */ | |
1355 class Date : public Value { | |
1356 public: | |
1357 V8EXPORT static Local<Value> New(double time); | |
1358 | |
1359 /** | |
1360 * A specialization of Value::NumberValue that is more efficient | |
1361 * because we know the structure of this object. | |
1362 */ | |
1363 V8EXPORT double NumberValue() const; | |
1364 | |
1365 static inline Date* Cast(v8::Value* obj); | |
1366 | |
1367 /** | |
1368 * Notification that the embedder has changed the time zone, | |
1369 * daylight savings time, or other date / time configuration | |
1370 * parameters. V8 keeps a cache of various values used for | |
1371 * date / time computation. This notification will reset | |
1372 * those cached values for the current context so that date / | |
1373 * time configuration changes would be reflected in the Date | |
1374 * object. | |
1375 * | |
1376 * This API should not be called more than needed as it will | |
1377 * negatively impact the performance of date operations. | |
1378 */ | |
1379 V8EXPORT static void DateTimeConfigurationChangeNotification(); | |
1380 | |
1381 private: | |
1382 V8EXPORT static void CheckCast(v8::Value* obj); | |
1383 }; | |
1384 | |
1385 | |
1386 /** | |
1387 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | |
1388 */ | |
1389 class RegExp : public Value { | |
1390 public: | |
1391 /** | |
1392 * Regular expression flag bits. They can be or'ed to enable a set | |
1393 * of flags. | |
1394 */ | |
1395 enum Flags { | |
1396 kNone = 0, | |
1397 kGlobal = 1, | |
1398 kIgnoreCase = 2, | |
1399 kMultiline = 4 | |
1400 }; | |
1401 | |
1402 /** | |
1403 * Creates a regular expression from the given pattern string and | |
1404 * the flags bit field. May throw a JavaScript exception as | |
1405 * described in ECMA-262, 15.10.4.1. | |
1406 * | |
1407 * For example, | |
1408 * RegExp::New(v8::String::New("foo"), | |
1409 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) | |
1410 * is equivalent to evaluating "/foo/gm". | |
1411 */ | |
1412 V8EXPORT static Local<RegExp> New(Handle<String> pattern, | |
1413 Flags flags); | |
1414 | |
1415 /** | |
1416 * Returns the value of the source property: a string representing | |
1417 * the regular expression. | |
1418 */ | |
1419 V8EXPORT Local<String> GetSource() const; | |
1420 | |
1421 /** | |
1422 * Returns the flags bit field. | |
1423 */ | |
1424 V8EXPORT Flags GetFlags() const; | |
1425 | |
1426 static inline RegExp* Cast(v8::Value* obj); | |
1427 | |
1428 private: | |
1429 V8EXPORT static void CheckCast(v8::Value* obj); | |
1430 }; | |
1431 | |
1432 | |
1433 enum PropertyAttribute { | 1352 enum PropertyAttribute { |
1434 None = 0, | 1353 None = 0, |
1435 ReadOnly = 1 << 0, | 1354 ReadOnly = 1 << 0, |
1436 DontEnum = 1 << 1, | 1355 DontEnum = 1 << 1, |
1437 DontDelete = 1 << 2 | 1356 DontDelete = 1 << 2 |
1438 }; | 1357 }; |
1439 | 1358 |
1440 enum ExternalArrayType { | 1359 enum ExternalArrayType { |
1441 kExternalByteArray = 1, | 1360 kExternalByteArray = 1, |
1442 kExternalUnsignedByteArray, | 1361 kExternalUnsignedByteArray, |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 V8EXPORT ScriptOrigin GetScriptOrigin() const; | 1669 V8EXPORT ScriptOrigin GetScriptOrigin() const; |
1751 static inline Function* Cast(Value* obj); | 1670 static inline Function* Cast(Value* obj); |
1752 V8EXPORT static const int kLineOffsetNotFound; | 1671 V8EXPORT static const int kLineOffsetNotFound; |
1753 private: | 1672 private: |
1754 V8EXPORT Function(); | 1673 V8EXPORT Function(); |
1755 V8EXPORT static void CheckCast(Value* obj); | 1674 V8EXPORT static void CheckCast(Value* obj); |
1756 }; | 1675 }; |
1757 | 1676 |
1758 | 1677 |
1759 /** | 1678 /** |
| 1679 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
| 1680 */ |
| 1681 class Date : public Object { |
| 1682 public: |
| 1683 V8EXPORT static Local<Value> New(double time); |
| 1684 |
| 1685 /** |
| 1686 * A specialization of Value::NumberValue that is more efficient |
| 1687 * because we know the structure of this object. |
| 1688 */ |
| 1689 V8EXPORT double NumberValue() const; |
| 1690 |
| 1691 static inline Date* Cast(v8::Value* obj); |
| 1692 |
| 1693 /** |
| 1694 * Notification that the embedder has changed the time zone, |
| 1695 * daylight savings time, or other date / time configuration |
| 1696 * parameters. V8 keeps a cache of various values used for |
| 1697 * date / time computation. This notification will reset |
| 1698 * those cached values for the current context so that date / |
| 1699 * time configuration changes would be reflected in the Date |
| 1700 * object. |
| 1701 * |
| 1702 * This API should not be called more than needed as it will |
| 1703 * negatively impact the performance of date operations. |
| 1704 */ |
| 1705 V8EXPORT static void DateTimeConfigurationChangeNotification(); |
| 1706 |
| 1707 private: |
| 1708 V8EXPORT static void CheckCast(v8::Value* obj); |
| 1709 }; |
| 1710 |
| 1711 |
| 1712 /** |
| 1713 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
| 1714 */ |
| 1715 class RegExp : public Object { |
| 1716 public: |
| 1717 /** |
| 1718 * Regular expression flag bits. They can be or'ed to enable a set |
| 1719 * of flags. |
| 1720 */ |
| 1721 enum Flags { |
| 1722 kNone = 0, |
| 1723 kGlobal = 1, |
| 1724 kIgnoreCase = 2, |
| 1725 kMultiline = 4 |
| 1726 }; |
| 1727 |
| 1728 /** |
| 1729 * Creates a regular expression from the given pattern string and |
| 1730 * the flags bit field. May throw a JavaScript exception as |
| 1731 * described in ECMA-262, 15.10.4.1. |
| 1732 * |
| 1733 * For example, |
| 1734 * RegExp::New(v8::String::New("foo"), |
| 1735 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) |
| 1736 * is equivalent to evaluating "/foo/gm". |
| 1737 */ |
| 1738 V8EXPORT static Local<RegExp> New(Handle<String> pattern, |
| 1739 Flags flags); |
| 1740 |
| 1741 /** |
| 1742 * Returns the value of the source property: a string representing |
| 1743 * the regular expression. |
| 1744 */ |
| 1745 V8EXPORT Local<String> GetSource() const; |
| 1746 |
| 1747 /** |
| 1748 * Returns the flags bit field. |
| 1749 */ |
| 1750 V8EXPORT Flags GetFlags() const; |
| 1751 |
| 1752 static inline RegExp* Cast(v8::Value* obj); |
| 1753 |
| 1754 private: |
| 1755 V8EXPORT static void CheckCast(v8::Value* obj); |
| 1756 }; |
| 1757 |
| 1758 |
| 1759 /** |
1760 * A JavaScript value that wraps a C++ void*. This type of value is | 1760 * A JavaScript value that wraps a C++ void*. This type of value is |
1761 * mainly used to associate C++ data structures with JavaScript | 1761 * mainly used to associate C++ data structures with JavaScript |
1762 * objects. | 1762 * objects. |
1763 * | 1763 * |
1764 * The Wrap function V8 will return the most optimal Value object wrapping the | 1764 * The Wrap function V8 will return the most optimal Value object wrapping the |
1765 * C++ void*. The type of the value is not guaranteed to be an External object | 1765 * C++ void*. The type of the value is not guaranteed to be an External object |
1766 * and no assumptions about its type should be made. To access the wrapped | 1766 * and no assumptions about its type should be made. To access the wrapped |
1767 * value Unwrap should be used, all other operations on that object will lead | 1767 * value Unwrap should be used, all other operations on that object will lead |
1768 * to unpredictable results. | 1768 * to unpredictable results. |
1769 */ | 1769 */ |
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4055 | 4055 |
4056 | 4056 |
4057 } // namespace v8 | 4057 } // namespace v8 |
4058 | 4058 |
4059 | 4059 |
4060 #undef V8EXPORT | 4060 #undef V8EXPORT |
4061 #undef TYPE_CHECK | 4061 #undef TYPE_CHECK |
4062 | 4062 |
4063 | 4063 |
4064 #endif // V8_H_ | 4064 #endif // V8_H_ |
OLD | NEW |