ArrayIterator casted to array should result to the storage array
[hiphop-php.git] / hphp / system / systemlib.h
blob1ae68245ccdcfe33032c9a0f9a4d7f51616788c2
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_SYSTEMLIB_H_
18 #define incl_HPHP_SYSTEMLIB_H_
20 #include "hphp/runtime/base/types.h"
22 namespace HPHP {
23 ///////////////////////////////////////////////////////////////////////////////
25 class ObjectData;
26 class Unit;
27 class Class;
28 class Func;
29 namespace Eval {
30 class PhpFile;
33 #define SYSTEMLIB_CLASSES(x) \
34 x(stdclass) \
35 x(Exception) \
36 x(BadMethodCallException) \
37 x(InvalidArgumentException) \
38 x(RuntimeException) \
39 x(OutOfBoundsException) \
40 x(InvalidOperationException) \
41 x(pinitSentinel) \
42 x(resource) \
43 x(Directory) \
44 x(SplFileInfo) \
45 x(SplFileObject) \
46 x(DateTimeInterface) \
47 x(DateTimeImmutable) \
48 x(DOMDocument) \
49 x(DOMException) \
50 x(PDOException) \
51 x(SoapFault) \
52 x(Closure) \
53 x(Continuation) \
54 x(Serializable) \
55 x(ArrayAccess) \
56 x(ArrayObject) \
57 x(ArrayIterator) \
58 x(Iterator) \
59 x(IteratorAggregate) \
60 x(Traversable) \
61 x(Countable) \
62 x(LazyKVZipIterable) \
63 x(LazyIterableView) \
64 x(LazyKeyedIterableView) \
65 x(Phar) \
66 x(CURLFile) \
67 x(__PHP_Incomplete_Class) \
68 x(__PHP_Unserializable_Class) \
70 class SystemLib {
71 public:
72 static bool s_inited;
73 static bool s_anyNonPersistentBuiltins;
74 static std::string s_source;
75 static HPHP::Unit* s_unit;
76 static HPHP::Unit* s_hhas_unit;
77 static HPHP::Unit* s_nativeFuncUnit;
78 static HPHP::Unit* s_nativeClassUnit;
81 #define DECLARE_SYSTEMLIB_CLASS(cls) \
82 static HPHP::Class* s_ ## cls ## Class;
83 SYSTEMLIB_CLASSES(DECLARE_SYSTEMLIB_CLASS)
84 #undef DECLARE_SYSTEMLIB_CLASS
86 static HPHP::Func* s_nullFunc;
88 static ObjectData* AllocStdClassObject();
89 static ObjectData* AllocPinitSentinel();
90 static ObjectData* AllocExceptionObject(const Variant& message);
91 static ObjectData* AllocBadMethodCallExceptionObject(const Variant& message);
92 static ObjectData* AllocInvalidArgumentExceptionObject(const Variant& message);
93 static ObjectData* AllocRuntimeExceptionObject(const Variant& message);
94 static ObjectData* AllocOutOfBoundsExceptionObject(const Variant& message);
95 static ObjectData* AllocInvalidOperationExceptionObject(const Variant& message);
96 static ObjectData* AllocDOMDocumentObject(const String& version = null_string,
97 const String& encoding = null_string);
98 static ObjectData* AllocDOMExceptionObject(const Variant& message,
99 const Variant& code);
100 static ObjectData* AllocDirectoryObject();
101 static ObjectData* AllocPDOExceptionObject();
102 static ObjectData* AllocSoapFaultObject(const Variant& code,
103 const Variant& message,
104 const Variant& actor = null_variant,
105 const Variant& detail = null_variant,
106 const Variant& name = null_variant,
107 const Variant& header = null_variant);
108 static ObjectData* AllocLazyKVZipIterableObject(const Variant& mp);
110 static ObjectData* AllocLazyIterableViewObject(const Variant& iterable);
111 static ObjectData* AllocLazyKeyedIterableViewObject(const Variant& iterable);
114 ///////////////////////////////////////////////////////////////////////////////
117 #endif