- Timestamp:
- 08/15/08 13:23:09 (3 months ago)
- Files:
-
- trunk/rphp/runtime/CMakeLists.txt (modified) (1 diff)
- trunk/rphp/runtime/include/pResource.h (added)
- trunk/rphp/runtime/include/pTypes.h (modified) (4 diffs)
- trunk/rphp/runtime/include/pVar.h (modified) (3 diffs)
- trunk/rphp/runtime/pHash.cpp (modified) (1 diff)
- trunk/rphp/runtime/pResource.cpp (added)
- trunk/rphp/runtime/test/pvarTestCase.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rphp/runtime/CMakeLists.txt
r618 r631 6 6 7 7 set(RUNTIME_SRC_FILES 8 pResource.cpp 8 9 pHash.cpp 9 10 pObject.cpp trunk/rphp/runtime/include/pTypes.h
r619 r631 26 26 #include "pHash.h" 27 27 #include "pObject.h" 28 #include "pResource.h" 28 29 29 30 U_NAMESPACE_BEGIN … … 76 77 pVarType operator()(const pObjectP &h) const { 77 78 return pVarObjectType; 79 } 80 81 pVarType operator()(const pResourceP &h) const { 82 return pVarResourceType; 78 83 } 79 84 … … 128 133 } 129 134 135 void operator()(pResourceP &h) const { 136 // TODO: return static resource count 137 var = 0l; 138 } 139 130 140 void operator()(pVarRef &r) const { 131 141 // unbox … … 172 182 // TODO: toString 173 183 var = pBString("object"); 184 } 185 186 void operator()(pResourceP &h) const { 187 var = pBString("resource"); 174 188 } 175 189 trunk/rphp/runtime/include/pVar.h
r629 r631 25 25 #include <boost/shared_ptr.hpp> 26 26 #include <unicode/unistr.h> 27 #include <unicode/ustream.h>28 27 #include <iostream> 29 28 … … 62 61 typedef boost::shared_ptr<pObject> pObjectP; 63 62 63 // php resources 64 class pResource; 65 typedef boost::shared_ptr<pResource> pResourceP; 66 64 67 // base variant that represents a php variable 65 typedef boost::variant< pTriState, pInt, pFloat, pBString, pUStringP, pHashP, pObjectP > pVarBase;68 typedef boost::variant< pTriState, pInt, pFloat, pBString, pUStringP, pHashP, pObjectP, pResourceP > pVarBase; 66 69 67 70 // reference to a pvarBase, i.e. a container for pvar variables 68 // shared_ptr maintains a reference count and guarantees proper destruction69 71 typedef boost::shared_ptr<pVarBase> pVarRef; 70 72 71 73 // full pvar definition: a variant that can hold a base type or a reference 72 typedef boost::variant< pTriState, pInt, pFloat, pBString, pUStringP, pHashP, pObjectP, p VarRef > pVar;74 typedef boost::variant< pTriState, pInt, pFloat, pBString, pUStringP, pHashP, pObjectP, pResourceP, pVarRef > pVar; 73 75 typedef boost::shared_ptr<pVar> pVarP; 74 76 … … 83 85 pVarHashType, 84 86 pVarObjectType, 87 pVarResourceType, 85 88 pVarRefType 86 89 } pVarType; trunk/rphp/runtime/pHash.cpp
r617 r631 18 18 19 19 #include <iostream> 20 #include <unicode/ustream.h> 20 21 #include "pHash.h" 21 22 trunk/rphp/runtime/test/pvarTestCase.cpp
r600 r631 57 57 int operator()(const rphp::pObjectP &h) const { 58 58 std::cout << "i see a pObject" << std::endl; 59 return 0; 60 } 61 62 int operator()(const rphp::pResourceP &h) const { 63 std::cout << "i see a resource" << std::endl; 59 64 return 0; 60 65 } … … 95 100 std::cout << "pObject: " << sizeof(rphp::pObject) << std::endl; 96 101 std::cout << "pObjectP: " << sizeof(rphp::pObjectP) << std::endl; 102 std::cout << "pResource: " << sizeof(rphp::pResource) << std::endl; 103 std::cout << "pResourceP: " << sizeof(rphp::pResourceP) << std::endl; 97 104 std::cout << "pVarBase: " << sizeof(rphp::pVarBase) << std::endl; 98 105 std::cout << "pVarRef: " << sizeof(rphp::pVarRef) << std::endl; … … 135 142 std::cout << "the bool was false" << std::endl; 136 143 } 137 144 138 145 u = rphp::pFalse; 139 146
