src/include/common/vocl/VProperty.h

00001 
00020 #ifndef INCL_VIRTUAL_PROPERTY
00021 #define INCL_VIRTUAL_PROPERTY
00022 
00024 #include "base/fscapi.h"
00025 #include "base/util/WKeyValuePair.h"
00026 #include "base/util/ArrayList.h"
00027 
00028 
00029 // Quoted-Printable formatted lines should be max 76 chars long.
00030 #define QP_MAX_LINE_LEN             70
00031 #define VCARD_MAX_LINE_LEN          76
00032 
00033 
00034 // These are special chars to escape in vCard/vCal/vTodo (version 2.1 - 3.0)
00035 #define VCARD21_SPECIAL_CHARS       TEXT(";\\")
00036 #define VCARD30_SPECIAL_CHARS       TEXT(";\\,")
00037 #define RFC822_LINE_BREAK           TEXT("\r\n")
00038 
00039 
00040 // ------------ Public functions --------------
00041 WCHAR* escapeSpecialChars(const WCHAR* inputString, WCHAR* version);
00042 char*    convertToQP(const char* input, int start);
00043 bool     encodingIsNeed(const char *in);
00044 WCHAR* folding(const WCHAR* inputString, const int maxLine);
00045 WCHAR* unfolding(const WCHAR* inputString);
00046 
00047 
00048 
00049 // ------------ Class VProperty ---------------
00050 
00051 class VProperty : public ArrayElement {
00052 
00053 private:
00054 
00055     WCHAR* name;
00056     void set(WCHAR** p, const WCHAR* v);
00057 
00058     ArrayList* parameters;
00059     ArrayList* values;
00060 
00061     // This is only used as a buffer for 'getValue()'
00062     WCHAR* valueBuf;
00063 
00064  public:       
00065         
00066     VProperty(const WCHAR* propName , const WCHAR* propValue  = NULL);
00067     ~VProperty();
00068     ArrayElement* clone();
00069     void setName (const WCHAR* name);
00070     WCHAR* getName(WCHAR* buf = NULL, int size = -1);
00071 
00072     void addValue(const WCHAR* value);
00073     bool removeValue(const int index);
00074     WCHAR* getValue(int index);
00075     int valueCount();
00076 
00077     // For back-compatibility (to remove)
00078     WCHAR* getValue(WCHAR* buf = NULL);
00079     void setValue (const WCHAR* value);
00080     WCHAR* getPropComponent(int i);
00081 
00082     void addParameter(const WCHAR* paramName, const WCHAR* paramValue);
00083     void removeParameter(WCHAR* paramName);
00084     bool containsParameter(WCHAR* paramName);
00085     // Warning: the name does not always uniquely identify
00086     // the parameter, some of them may occur multiple times.
00087     // Use getParameterValue(int index) to get the value which
00088     // corresponds to a specific parameter.
00089     WCHAR* getParameterValue(WCHAR* paramName);
00090     WCHAR* getParameterValue(int index);
00091     WCHAR* getParameter(int index);
00092     int parameterCount();
00093     bool equalsEncoding(WCHAR* encoding);
00094     //WCHAR* getPropComponent(int i);
00095     bool isType(WCHAR* type);
00096     WCHAR* toString(WCHAR* version = NULL);
00097 
00098  };
00099 
00101 #endif

Generated on Fri Apr 27 12:29:19 2007 for Funambol C++ Client Library by  doxygen 1.5.2