00001 /* 00002 * Copyright (c) 2005 Palmsource, Inc. 00003 * 00004 * This software is licensed as described in the file LICENSE, which 00005 * you should have received as part of this distribution. The terms 00006 * are also available at http://www.openbinder.org/license.html. 00007 * 00008 * This software consists of voluntary contributions made by many 00009 * individuals. For the exact contribution history, see the revision 00010 * history and logs, available at http://www.openbinder.org 00011 */ 00012 00013 #ifndef _SUPPORT_DATUM_H 00014 #define _SUPPORT_DATUM_H 00015 00021 #include <support/IDatum.h> 00022 #include <support/IByteStream.h> 00023 00024 #if _SUPPORTS_NAMESPACE 00025 namespace palmos { 00026 namespace support { 00027 #endif 00028 00033 00034 00041 class SDatum 00042 { 00043 public: 00044 // -------------------------------------------------------------- 00048 00049 SDatum(); 00051 00055 SDatum(const SValue& value); 00057 SDatum(const sptr<IBinder>& binder); 00059 SDatum(const sptr<IDatum>& datum); 00061 SDatum(const SDatum& datum); 00063 ~SDatum(); 00064 00066 SDatum& operator=(const SDatum& o); 00067 00068 bool operator<(const SDatum& o) const; 00069 bool operator<=(const SDatum& o) const; 00070 bool operator==(const SDatum& o) const; 00071 bool operator!=(const SDatum& o) const; 00072 bool operator>=(const SDatum& o) const; 00073 bool operator>(const SDatum& o) const; 00074 00076 status_t StatusCheck() const; 00077 00079 sptr<IDatum> Datum() const; 00080 00082 00083 00084 // -------------------------------------------------------------- 00088 00090 00110 SValue FetchValue(size_t maxSize, status_t* outError = NULL) const; 00111 00113 00130 SValue FetchTruncatedValue(size_t maxSize, status_t* outError = NULL) const; 00131 00133 00145 sptr<IByteInput> OpenInput( uint32_t mode = IDatum::READ_ONLY, 00146 status_t* outError = NULL) const; 00147 00149 00161 sptr<IByteOutput> OpenOutput( uint32_t mode = IDatum::READ_WRITE | IDatum::ERASE_DATUM, 00162 status_t* outError = NULL); 00163 00165 00181 sptr<IByteOutput> OpenOutput( uint32_t mode, 00182 const sptr<IBinder>& editor, 00183 uint32_t newType, 00184 status_t* outError = NULL); 00185 00187 00188 private: 00189 SValue do_fetch_value(size_t maxSize, status_t* outError, bool truncate) const; 00190 00191 SValue m_value; 00192 sptr<IDatum> m_datum; 00193 }; 00194 00197 #if _SUPPORTS_NAMESPACE 00198 } } // namespace palmos::support 00199 #endif 00200 00201 #endif // _SUPPORT_DATUM_H