00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _SUPPORT_FLATTENABLE_H
00014 #define _SUPPORT_FLATTENABLE_H
00015
00022 #include <support/SupportDefs.h>
00023 #include <support/Value.h>
00024
00025 #if _SUPPORTS_NAMESPACE
00026 namespace palmos {
00027 namespace support {
00028 #endif
00029
00034 enum {
00035
00036
00037 B_FLATTEN_FORM_ACTIVE = 0,
00038
00039
00040
00041 B_FLATTEN_FORM_PERSISTENT = 1
00042 };
00043
00044 class SFlattenable
00045 {
00046 public:
00047 virtual ~SFlattenable() { };
00048 virtual ssize_t FlattenedSize() const;
00049 virtual status_t Flatten(void *buffer, ssize_t size) const;
00050 virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
00051
00052
00053 virtual SValue AsValue(int32_t form = B_FLATTEN_FORM_ACTIVE) const = 0;
00054
00055
00056
00057 virtual status_t SetFromValue(const SValue& value) = 0;
00058
00059 virtual ssize_t ParcelSize(int32_t form = B_FLATTEN_FORM_ACTIVE) const;
00060
00061
00062
00063
00064
00065 virtual ssize_t WriteParcel(SParcel& target, int32_t form = B_FLATTEN_FORM_ACTIVE) const;
00066
00067
00068
00069
00070 virtual ssize_t ReadParcel(type_code type, SParcel& source, ssize_t size);
00071
00072
00073 virtual bool IsFixedSize() const = 0;
00074 virtual type_code TypeCode() const = 0;
00075 virtual bool AllowsTypeCode(type_code code) const;
00076 };
00077
00078
00079
00080
00083 #if _SUPPORTS_NAMESPACE
00084 } }
00085 #endif
00086
00087 #endif