Add sub-controls for Hack array compat runtime checks
[hiphop-php.git] / hphp / runtime / base / tv-comparisons.h
blob86531ce7a36fb4bd045da349d61cac3c393536c8
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present 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 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_TV_COMPARISONS_H_
17 #define incl_HPHP_TV_COMPARISONS_H_
19 #include "hphp/runtime/base/typed-value.h"
21 namespace HPHP {
23 struct ResourceData;
25 //////////////////////////////////////////////////////////////////////
26 // Php's operator ===
29 * Returns whether two Cells have the same value, in the sense of
30 * php's === operator.
32 bool cellSame(Cell, Cell);
35 * Returns whether two TypedValues have the same value, in sense of
36 * php's === operator.
38 bool tvSame(TypedValue, TypedValue);
40 //////////////////////////////////////////////////////////////////////
41 // Php's operator ==
44 * Returns whether a Cell has the same value as an unpackaged type, in
45 * the sense of php's == operator.
47 bool cellEqual(Cell, bool);
48 bool cellEqual(Cell, int);
49 bool cellEqual(Cell, int64_t);
50 bool cellEqual(Cell, double);
51 bool cellEqual(Cell, const StringData*);
52 bool cellEqual(Cell, const ArrayData*);
53 bool cellEqual(Cell, const ObjectData*);
54 bool cellEqual(Cell, const ResourceData*);
57 * Returns whether two Cells have the same value, in the same of php's
58 * == operator.
60 bool cellEqual(Cell, Cell);
63 * Returns whether two TypedValues have the same value, in the sense
64 * of php's == operator.
66 bool tvEqual(TypedValue, TypedValue);
68 //////////////////////////////////////////////////////////////////////
69 // Php's operator <
72 * Returns whether a Cell is less than an unpackaged type, in the
73 * sense of php's < operator.
75 bool cellLess(Cell, bool);
76 bool cellLess(Cell, int);
77 bool cellLess(Cell, int64_t);
78 bool cellLess(Cell, double);
79 bool cellLess(Cell, const StringData*);
80 bool cellLess(Cell, const ArrayData*);
81 bool cellLess(Cell, const ObjectData*);
82 bool cellLess(Cell, const ResourceData*);
85 * Returns whether a Cell is greater than another Cell, in the sense
86 * of php's < operator.
88 bool cellLess(Cell, Cell);
91 * Returns whether tv1 is less than tv2, as in php's < operator.
93 bool tvLess(TypedValue, TypedValue);
95 //////////////////////////////////////////////////////////////////////
96 // Php's operator >
99 * Returns whether a Cell is greater than an unpackaged type, in the
100 * sense of php's > operator.
102 bool cellGreater(Cell, bool);
103 bool cellGreater(Cell, int);
104 bool cellGreater(Cell, int64_t);
105 bool cellGreater(Cell, double);
106 bool cellGreater(Cell, const StringData*);
107 bool cellGreater(Cell, const ArrayData*);
108 bool cellGreater(Cell, const ObjectData*);
109 bool cellGreater(Cell, const ResourceData*);
112 * Returns whether a Cell is greater than another Cell, in the sense
113 * of php's > operator.
115 bool cellGreater(Cell, Cell);
118 * Returns whether tv1 is greather than tv2, as in php's > operator.
120 bool tvGreater(TypedValue, TypedValue);
122 //////////////////////////////////////////////////////////////////////
125 * Php operator >= and <=
127 * Note that in php $x <= $y is not equivalent to !($x > $y) for
128 * objects and arrays.
130 * These functions are necessary to handle those cases specially.
132 bool cellLessOrEqual(Cell, Cell);
133 bool cellGreaterOrEqual(Cell, Cell);
135 //////////////////////////////////////////////////////////////////////
137 //////////////////////////////////////////////////////////////////////
138 // Php's operator <=>
141 * Returns a Cell's comparison against an unpackaged type, in the sense of php's
142 * <=> operator.
144 int64_t cellCompare(Cell, bool);
145 int64_t cellCompare(Cell, int);
146 int64_t cellCompare(Cell, int64_t);
147 int64_t cellCompare(Cell, double);
148 int64_t cellCompare(Cell, const StringData*);
149 int64_t cellCompare(Cell, const ArrayData*);
150 int64_t cellCompare(Cell, const ObjectData*);
151 int64_t cellCompare(Cell, const ResourceData*);
154 * Returns the result of a Cell's comparison against another Cell, in the sense
155 * of php's <=> operator.
157 int64_t cellCompare(Cell, Cell);
160 * Returns the result of tv1's comparison against tv2, as in php's <=> operator.
162 int64_t tvCompare(TypedValue, TypedValue);
164 //////////////////////////////////////////////////////////////////////
168 #include "hphp/runtime/base/tv-comparisons-inl.h"
170 #endif