~ubuntu-branches/ubuntu/vivid/libsynthesis/vivid-201501071725

« back to all changes in this revision

Viewing changes to src/sysync/rawdataitemtype.h

  • Committer: Bazaar Package Importer
  • Author(s): David Bremner
  • Date: 2010-11-20 19:50:44 UTC
  • mfrom: (3.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20101120195044-8s6wxqb2d0nmqdv3
Tags: 3.4.0.6+ds5-2
* Upload to unstable.
* Add missing commit from upstream 3.4.0.6+ds5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  File:         rawdataitemtype.h
 
3
 *
 
4
 *  Author:       Lukas Zeller (luz@synthesis.ch)
 
5
 *
 
6
 *  TRawDataItemType
 
7
 *    Item type for 1:1 raw items (SyncML payload is exchanged 1:1 with database backend) 
 
8
 *
 
9
 *  Copyright (c) 2010 by Synthesis AG (www.synthesis.ch)
 
10
 *
 
11
 *  2010-05-14 : luz : created
 
12
 *
 
13
 */
 
14
 
 
15
#ifndef RawDataItemType_H
 
16
#define RawDataItemType_H
 
17
 
 
18
// includes
 
19
#include "syncitemtype.h"
 
20
#include "multifielditemtype.h"
 
21
 
 
22
 
 
23
namespace sysync {
 
24
 
 
25
 
 
26
// MIME-dir based datatype
 
27
class TRawDataTypeConfig : public TMultiFieldTypeConfig
 
28
{
 
29
  typedef TMultiFieldTypeConfig inherited;
 
30
public:
 
31
  TRawDataTypeConfig(const char *aElementName, TConfigElement *aParentElementP);
 
32
  virtual ~TRawDataTypeConfig();
 
33
  // properties
 
34
  // public functions
 
35
  // - create Sync Item Type of appropriate type from config
 
36
  virtual TSyncItemType *newSyncItemType(TSyncSession *aSessionP, TSyncDataStore *aDatastoreP);
 
37
protected:
 
38
  #ifdef CONFIGURABLE_TYPE_SUPPORT
 
39
  // check config elements
 
40
  virtual bool localStartElement(const char *aElementName, const char **aAttributes, sInt32 aLine);
 
41
  #endif
 
42
  virtual void localResolve(bool aLastPass);
 
43
  virtual void clear();
 
44
public:
 
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
 
49
 
 
50
 
 
51
const uInt16 ity_rawdata=90; // must be unique
 
52
 
 
53
class TRawDataItemType: public TMultiFieldItemType
 
54
{
 
55
  typedef TMultiFieldItemType inherited;
 
56
  friend class TMimeDirProfileHandler;
 
57
public:
 
58
  // constructor
 
59
  TRawDataItemType(
 
60
    TSyncSession *aSessionP,
 
61
    TDataTypeConfig *aTypeConfigP,
 
62
    const char *aCTType,
 
63
    const char *aVerCT,
 
64
    TSyncDataStore *aRelatedDatastoreP,
 
65
    TFieldListConfig *aFieldDefinitions // field definitions
 
66
  );
 
67
  // destructor
 
68
  virtual ~TRawDataItemType();
 
69
  // access to type
 
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
 
79
  );
 
80
protected:
 
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
 
97
  );
 
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
 
103
  );
 
104
private:
 
105
        // convenience casted pointer to my config
 
106
        TRawDataTypeConfig *fCfgP;
 
107
}; // TRawDataItemType
 
108
 
 
109
 
 
110
 
 
111
}       // namespace sysync
 
112
 
 
113
#endif  // RawDataItemType_H
 
114
 
 
115
// eof
 
116