Branch data Line data Source code
1 : : /* libcmis
2 : : * Version: MPL 1.1 / GPLv2+ / LGPLv2+
3 : : *
4 : : * The contents of this file are subject to the Mozilla Public License Version
5 : : * 1.1 (the "License"); you may not use this file except in compliance with
6 : : * the License or as specified alternatively below. You may obtain a copy of
7 : : * the License at http://www.mozilla.org/MPL/
8 : : *
9 : : * Software distributed under the License is distributed on an "AS IS" basis,
10 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : : * for the specific language governing rights and limitations under the
12 : : * License.
13 : : *
14 : : * Major Contributor(s):
15 : : * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
16 : : *
17 : : *
18 : : * All Rights Reserved.
19 : : *
20 : : * For minor contributions see the git repository.
21 : : *
22 : : * Alternatively, the contents of this file may be used under the terms of
23 : : * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24 : : * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25 : : * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26 : : * instead of those above.
27 : : */
28 : : #ifndef _PROPERTY_HXX_
29 : : #define _PROPERTY_HXX_
30 : :
31 : : #include <libxml/tree.h>
32 : : #include <libxml/xmlwriter.h>
33 : :
34 : : #include <boost/date_time.hpp>
35 : : #include <boost/shared_ptr.hpp>
36 : :
37 : : #include <string>
38 : : #include <vector>
39 : :
40 : : #include "property-type.hxx"
41 : : #include "xmlserializable.hxx"
42 : :
43 : : namespace libcmis
44 : : {
45 : : class ObjectType;
46 : :
47 : : class Property : public XmlSerializable
48 : : {
49 : : private:
50 : : PropertyTypePtr m_propertyType;
51 : : std::vector< std::string > m_strValues;
52 : : std::vector< bool > m_boolValues;
53 : : std::vector< long > m_longValues;
54 : : std::vector< double > m_doubleValues;
55 : : std::vector< boost::posix_time::ptime > m_dateTimeValues;
56 : :
57 : : public:
58 : :
59 : : /** Property constructor allowing to use different values for the id and names.
60 : : */
61 : : Property( PropertyTypePtr propertyType, std::vector< std::string > strValues );
62 : :
63 : 0 : ~Property( ){ }
64 : :
65 : : PropertyTypePtr getPropertyType( ) { return m_propertyType; }
66 : :
67 : : std::vector< boost::posix_time::ptime > getDateTimes( ) { return m_dateTimeValues; }
68 : : std::vector< bool > getBools( ) { return m_boolValues; }
69 : 0 : std::vector< std::string > getStrings( ) { return m_strValues; }
70 : : std::vector< long > getLongs( ) { return m_longValues; }
71 : : std::vector< double > getDoubles( ) { return m_doubleValues; }
72 : :
73 : : void setValues( std::vector< std::string > strValues );
74 : :
75 : : void toXml( xmlTextWriterPtr writer );
76 : : };
77 : : typedef ::boost::shared_ptr< Property > PropertyPtr;
78 : :
79 : : PropertyPtr parseProperty( xmlNodePtr node, boost::shared_ptr< ObjectType > objectType );
80 : : }
81 : :
82 : : #endif
|