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_TYPE_HXX_
29 : #define _PROPERTY_TYPE_HXX_
30 :
31 : #include <boost/date_time.hpp>
32 : #include <libxml/tree.h>
33 :
34 : #include <string>
35 :
36 : namespace libcmis
37 : {
38 : class PropertyType
39 : {
40 : public:
41 :
42 : enum Type
43 : {
44 : String,
45 : Integer,
46 : Decimal,
47 : Bool,
48 : DateTime
49 : };
50 :
51 : private:
52 :
53 : std::string m_id;
54 : std::string m_localName;
55 : std::string m_localNamespace;
56 : std::string m_displayName;
57 : std::string m_queryName;
58 : Type m_type;
59 : std::string m_xmlType;
60 : bool m_multiValued;
61 : bool m_updatable;
62 : bool m_inherited;
63 : bool m_required;
64 : bool m_queryable;
65 : bool m_orderable;
66 : bool m_openChoice;
67 :
68 : public:
69 :
70 : /// Default constructor, mostly present for testing.
71 : PropertyType( );
72 : PropertyType( xmlNodePtr node );
73 : PropertyType( const PropertyType& copy );
74 0 : virtual ~PropertyType( ) { };
75 :
76 : PropertyType& operator=( const PropertyType& copy );
77 :
78 : std::string getId( ) { return m_id; }
79 : std::string getLocalName( ) { return m_localName; }
80 : std::string getLocalNamespace( ) { return m_localNamespace; }
81 0 : std::string getDisplayName( ) { return m_displayName; }
82 : std::string getQueryName( ) { return m_queryName; }
83 0 : Type getType( ) { return m_type; }
84 : std::string getXmlType( ) { return m_xmlType; }
85 0 : bool isMultiValued( ) { return m_multiValued; }
86 : bool isUpdatable( ) { return m_updatable; }
87 : bool isInherited( ) { return m_inherited; }
88 : bool isRequired( ) { return m_required; }
89 : bool isQueryable( ) { return m_queryable; }
90 : bool isOrderable( ) { return m_orderable; }
91 : bool isOpenChoice( ) { return m_openChoice; }
92 :
93 : void setId( std::string id ) { m_id = id; }
94 : void setLocalName( std::string localName ) { m_localName = localName; }
95 : void setLocalNamespace( std::string localNamespace ) { m_localNamespace = localNamespace; }
96 : void setDisplayName( std::string displayName ) { m_displayName = displayName; }
97 : void setQueryName( std::string queryName ) { m_queryName = queryName; }
98 : void setType( Type type ) { m_type = type; }
99 : void setMultiValued( bool multivalued ) { m_multiValued = multivalued; }
100 : void setUpdatable( bool updatable ) { m_updatable = updatable; }
101 : void setInherited( bool inherited ) { m_inherited = inherited; }
102 : void setRequired( bool required ) { m_required = required; }
103 : void setQueryable( bool queryable ) { m_queryable = queryable; }
104 : void setOrderable( bool orderable ) { m_orderable = orderable; }
105 : void setOpenChoice( bool openChoice ) { m_openChoice = openChoice; }
106 :
107 : void setTypeFromXml( std::string typeStr );
108 : };
109 : typedef ::boost::shared_ptr< PropertyType > PropertyTypePtr;
110 : }
111 :
112 : #endif
|