Changeset 577
- Timestamp:
- 07/01/08 08:07:30 (2 months ago)
- Files:
-
- trunk/rphp/runtime/rphp_pvar.h (modified) (1 diff)
- trunk/rphp/runtime/var-test.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rphp/runtime/rphp_pvar.h
r576 r577 48 48 49 49 // string types: binary and unicode flavor 50 51 // STL basic string. 52 // GNU stdc++ provides implicit sharing but this isn't part of the standard 50 53 typedef std::string bstring; 54 55 // UnicodeString uses 2 byte characters. Storage of base class is 32 bytes on 32bit, 40 on 64bit 56 // implicitly shared 51 57 typedef UnicodeString ustring; 52 58 53 // avariant that represents a php variable59 // base variant that represents a php variable 54 60 typedef boost::variant< p3state/*int*/, pint/*long*/, pfloat/*double*/, bstring, ustring, phash, pobject> pvarBase; 55 61 56 // reference to a pvar_base 62 // reference to a pvarBase, i.e. a container for pvar variables 63 // shared_ptr maintains a reference count and guarantees proper destruction 57 64 typedef boost::shared_ptr<pvarBase> pvarRef; 58 65 59 // full pvar definition: a variant that can hold a base type or reference66 // full pvar definition: a variant that can hold a base type or a reference 60 67 typedef boost::variant< p3state/*int*/, pint/*long*/, pfloat/*double*/, bstring, ustring, phash, pobject, pvarRef> pvar; 61 68 trunk/rphp/runtime/var-test.cpp
r576 r577 80 80 rphp::pvar u,t,r; 81 81 82 // sizes 83 std::cout << "p3state: " << sizeof(rphp::p3state) << std::endl; 84 std::cout << "pint: " << sizeof(rphp::pint) << std::endl; 85 std::cout << "pfloat: " << sizeof(rphp::pfloat) << std::endl; 86 std::cout << "bstring: " << sizeof(rphp::bstring) << std::endl; 87 std::cout << "ustring: " << sizeof(rphp::ustring) << std::endl; 88 std::cout << "phash: " << sizeof(rphp::phash) << std::endl; 89 std::cout << "pobj: " << sizeof(rphp::pobject) << std::endl; 90 std::cout << "pvarBase: " << sizeof(rphp::pvarBase) << std::endl; 91 std::cout << "pvarRef: " << sizeof(rphp::pvarRef) << std::endl; 92 std::cout << "pvar: " << sizeof(rphp::pvar) << std::endl; 93 82 94 // binary string 83 95 u = rphp::bstring("hello world there"); … … 91 103 std::cout << u << std::endl; 92 104 result = boost::apply_visitor( my_visitor(), u ); 93 94 105 95 106 // long … … 166 177 // references 167 178 168 // create a new reference. can only be comprise of pvarBase items (i.e., can't be a ref to a ref)179 // create a new reference. can only be comprised of pvarBase items (i.e., can't be a ref to a ref) 169 180 std::cout << "references----" << std::endl; 170 181 rphp::pvarRef r1(new rphp::pvarBase);
