2
* File: rawdataitemtype.h
4
* Author: Lukas Zeller (luz@synthesis.ch)
7
* Item type for 1:1 raw items (SyncML payload is exchanged 1:1 with database backend)
9
* Copyright (c) 2010 by Synthesis AG (www.synthesis.ch)
11
* 2010-05-14 : luz : created
15
#ifndef RawDataItemType_H
16
#define RawDataItemType_H
19
#include "syncitemtype.h"
20
#include "multifielditemtype.h"
26
// MIME-dir based datatype
27
class TRawDataTypeConfig : public TMultiFieldTypeConfig
29
typedef TMultiFieldTypeConfig inherited;
31
TRawDataTypeConfig(const char *aElementName, TConfigElement *aParentElementP);
32
virtual ~TRawDataTypeConfig();
35
// - create Sync Item Type of appropriate type from config
36
virtual TSyncItemType *newSyncItemType(TSyncSession *aSessionP, TSyncDataStore *aDatastoreP);
38
#ifdef CONFIGURABLE_TYPE_SUPPORT
39
// check config elements
40
virtual bool localStartElement(const char *aElementName, const char **aAttributes, sInt32 aLine);
42
virtual void localResolve(bool aLastPass);
45
// FIDs of the predefined fields we need to access
46
sInt16 fFidItemData; // BLOB or string field that will contain item <data>
47
// %%% add more FID vars here
48
}; // TRawDataTypeConfig
51
const uInt16 ity_rawdata=90; // must be unique
53
class TRawDataItemType: public TMultiFieldItemType
55
typedef TMultiFieldItemType inherited;
56
friend class TMimeDirProfileHandler;
60
TSyncSession *aSessionP,
61
TDataTypeConfig *aTypeConfigP,
64
TSyncDataStore *aRelatedDatastoreP,
65
TFieldListConfig *aFieldDefinitions // field definitions
68
virtual ~TRawDataItemType();
70
virtual uInt16 getTypeID(void) const { return ity_rawdata; };
71
virtual bool isBasedOn(uInt16 aItemTypeID) const { return aItemTypeID==ity_rawdata ? true : inherited::isBasedOn(aItemTypeID); };
72
// differentiation between implemented and just descriptive TSyncTypeItems
73
virtual bool isImplemented(void) { return true; }; // RawItem is an implementati on
74
// helper to create same-typed instance via base class
75
// MUST BE IMPLEMENTED IN ALL DERIVED CLASSES!
76
virtual TSyncItemType *newCopyForSameType(
77
TSyncSession *aSessionP, // the session
78
TSyncDataStore *aDatastoreP // the datastore
81
// CTCap parsing/generation
82
// - analyze CTCap for specific type
83
virtual bool analyzeCTCap(SmlDevInfCTCapPtr_t aCTCapP);
84
/// @brief copy CTCap derived info from another SyncItemType
85
virtual bool copyCTCapInfoFrom(TSyncItemType &aSourceItemP);
86
// - obtain property list for type, returns NULL if none available
87
virtual SmlDevInfCTDataPropListPtr_t newCTDataPropList(TTypeVariantDescriptor aVariantDescriptor);
88
// Item data management
89
// - create new sync item of proper type and optimization for specified target
90
virtual TSyncItem *internalNewSyncItem(TSyncItemType *aTargetItemTypeP, TLocalEngineDS *aLocalDatastoreP);
91
// - fill in SyncML data (but leaves IDs empty)
92
virtual bool internalFillInData(
93
TSyncItem *aSyncItemP, // SyncItem to be filled with data
94
SmlItemPtr_t aItemP, // SyncML toolkit item Data to be converted into SyncItem (may be NULL if no data, in case of Delete or Map)
95
TLocalEngineDS *aLocalDatastoreP, // local datastore
96
TStatusCommand &aStatusCmd // status command that might be modified in case of error
98
// - sets data and meta from SyncItem data, but leaves source & target untouched
99
virtual bool internalSetItemData(
100
TSyncItem *aSyncItemP, // the syncitem to be represented as SyncML
101
SmlItemPtr_t aItem, // item with NULL meta and NULL data
102
TLocalEngineDS *aLocalDatastoreP // local datastore
105
// convenience casted pointer to my config
106
TRawDataTypeConfig *fCfgP;
107
}; // TRawDataItemType
111
} // namespace sysync
113
#endif // RawDataItemType_H