00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INCL_FORMATTER
00021 #define INCL_FORMATTER
00022
00024 #include "base/fscapi.h"
00025 #include "base/util/utils.h"
00026 #include "base/util/StringBuffer.h"
00027 #include "base/util/XMLProcessor.h"
00028 #include "base/util/ArrayList.h"
00029
00030 #include "syncml/core/TagNames.h"
00031 #include "syncml/core/ObjectDel.h"
00032
00033
00034
00035 class Formatter {
00036
00037
00038 public:
00039
00040 static StringBuffer* getValue (const char* tagName, const char* value, const char *params = NULL);
00041 static StringBuffer* getValue (const char* tagName, StringBuffer* value, const char *params = NULL);
00042 static StringBuffer* getValue (const char* tagName, long value, const char *params = NULL);
00043 static StringBuffer* getValue (const char* tagName, BOOL value, const char *params = NULL);
00044 static StringBuffer* getValueNotEmpty (const char* tagName, const char* value, const char *params = NULL);
00045
00046 static StringBuffer* getSyncML (SyncML* syncML);
00047 static StringBuffer* getSyncHdr (SyncHdr* syncHdr);
00048 static StringBuffer* getSyncBody (SyncBody* syncBody);
00049 static StringBuffer* getSessionID (SessionID* sessionID);
00050 static StringBuffer* getVerDTD (VerDTD* verDTD);
00051 static StringBuffer* getVerProto (VerProto* verProto);
00052 static StringBuffer* getTarget (Target* target);
00053 static StringBuffer* getSource (Source* source);
00054 static StringBuffer* getCred (Cred* cred);
00055 static StringBuffer* getMeta (Meta* meta);
00056 static StringBuffer* getMsgID (const char* value);
00057 static StringBuffer* getRespURI (const char* value);
00058 static StringBuffer* getAuthentication (Authentication* auth);
00059 static StringBuffer* getAnchor (Anchor* anchor);
00060 static StringBuffer* getMetInf (MetInf* metInf);
00061 static StringBuffer* getNextNonce (NextNonce* nextNonce);
00062 static StringBuffer* getMem (Mem* mem);
00063 static StringBuffer* getCmdID (CmdID* cmdID);
00064
00065 static StringBuffer* getAlerts (ArrayList* alerts);
00066 static StringBuffer* getAlert (Alert* alert);
00067 static StringBuffer* getItems (ArrayList* items);
00068 static StringBuffer* getItem (Item* item);
00069
00070 static StringBuffer* getDevInf (DevInf* devInf);
00071 static StringBuffer* getData (ComplexData* data);
00072 static StringBuffer* getData (Data* data);
00073 static StringBuffer* getDataStores (ArrayList* dataStores);
00074 static StringBuffer* getDataStore (DataStore* dataStore);
00075 static StringBuffer* getSourceRef (SourceRef* sourceRef);
00076 static StringBuffer* getTargetRef (TargetRef* targetRef);
00077 static StringBuffer* getSourceRefs (ArrayList* sourceRefs);
00078 static StringBuffer* getTargetRefs (ArrayList* targetRefs);
00079 static StringBuffer* getDSMem (DSMem* dsMem);
00080 static StringBuffer* getContentTypeInfos (ArrayList* contentTypeInfos, const char* TAG);
00081 static StringBuffer* getContentTypeInfo (ContentTypeInfo* contentTypeInfo, const char* TAG);
00082 static StringBuffer* getSyncCap (SyncCap* syncCap);
00083 static StringBuffer* getSyncTypes (ArrayList* syncTypes);
00084 static StringBuffer* getSyncType (SyncType* syncType);
00085 static StringBuffer* getCTCaps (ArrayList* ctCaps);
00086 static StringBuffer* getCTCap (CTCap* ctCap);
00087
00088 static StringBuffer* getExts (ArrayList* exts);
00089 static StringBuffer* getExt (Ext* ext);
00090 static StringBuffer* getXVals (ArrayList* xvals);
00091 static StringBuffer* getXVal (StringElement* xval);
00092 static StringBuffer* getStatusArray (ArrayList* statusArray);
00093 static StringBuffer* getStatus (Status* status);
00094 static StringBuffer* getChal (Chal* chal);
00095 static StringBuffer* getAdds (ArrayList* adds);
00096 static StringBuffer* getAdd (Add* add);
00097 static StringBuffer* getDels (ArrayList* adds);
00098 static StringBuffer* getDelete (Delete* add);
00099 static StringBuffer* getReplaces (ArrayList* replaces);
00100 static StringBuffer* getReplace (Replace* replace);
00101 static StringBuffer* getCopies (ArrayList* copies);
00102 static StringBuffer* getCopy (Copy* copy);
00103 static StringBuffer* getCommonCommandList(ArrayList* commands);
00104 static StringBuffer* getSync (Sync* sync);
00105 static StringBuffer* getMapItem (MapItem* mapItem);
00106 static StringBuffer* getMapItems (ArrayList* mapItems);
00107 static StringBuffer* getMap (Map* map);
00108 static StringBuffer* getExec (Exec* exec);
00109 static StringBuffer* getGet (Get* get);
00110 static StringBuffer* getPut (Put* put);
00111 static StringBuffer* getResults (Results* results);
00112 static StringBuffer* getSearch (Search* search);
00113 static StringBuffer* getSources (ArrayList* sources);
00114 static StringBuffer* getSourceArray (SourceArray* sourceArray);
00115 static StringBuffer* getExtraCommandList (ArrayList* commands);
00116 static StringBuffer* getSequence (Sequence* sequence);
00117 static StringBuffer* getSpecificCommand (ArrayList* commands, const char* commandName);
00118 static StringBuffer* getAtomic (Atomic* atomic);
00119 static StringBuffer* getFilter (Filter* filter);
00120 static StringBuffer* getProperty (Property* property);
00121 static StringBuffer* getPropParam (PropParam* param);
00122
00123 };
00124
00126 #endif
00127
00128
00129
00130
00131