1 : /******************************************************************************
2 : * $Id: vfkproperty.cpp 18566 2010-01-16 16:36:45Z martinl $
3 : *
4 : * Project: VFK Reader - Property definition
5 : * Purpose: Implements VFKProperty class.
6 : * Author: Martin Landa, landa.martin gmail.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2009-2010, Martin Landa <landa.martin gmail.com>
10 : *
11 : * Permission is hereby granted, free of charge, to any person
12 : * obtaining a copy of this software and associated documentation
13 : * files (the "Software"), to deal in the Software without
14 : * restriction, including without limitation the rights to use, copy,
15 : * modify, merge, publish, distribute, sublicense, and/or sell copies
16 : * of the Software, and to permit persons to whom the Software is
17 : * furnished to do so, subject to the following conditions:
18 : *
19 : * The above copyright notice and this permission notice shall be
20 : * included in all copies or substantial portions of the Software.
21 : *
22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 : * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 : * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 : * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 : * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 : * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 : * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 : * SOFTWARE.
30 : ****************************************************************************/
31 :
32 : #include "vfkreader.h"
33 : #include "vfkreaderp.h"
34 :
35 : #include "cpl_conv.h"
36 : #include "cpl_error.h"
37 :
38 : /*!
39 : \brief Set VFK property (null)
40 : */
41 233 : VFKProperty::VFKProperty()
42 233 : : m_bIsNull(TRUE), m_nValue(0), m_dValue(0.0)
43 : {
44 233 : }
45 :
46 : /*!
47 : \brief Set VFK property (integer)
48 : */
49 139 : VFKProperty::VFKProperty(int iValue)
50 139 : : m_bIsNull(FALSE), m_nValue(iValue), m_dValue(0.0)
51 : {
52 139 : }
53 :
54 : /*!
55 : \brief Set VFK property (double)
56 : */
57 26 : VFKProperty::VFKProperty(double dValue)
58 26 : : m_bIsNull(FALSE), m_nValue(0), m_dValue(dValue)
59 : {
60 26 : }
61 :
62 : /*!
63 : \brief Set VFK property (string)
64 : */
65 307 : VFKProperty::VFKProperty(const char *pszValue)
66 307 : : m_bIsNull(FALSE), m_nValue(0), m_dValue(0.0), m_strValue(0 != pszValue ? pszValue : "")
67 : {
68 307 : }
69 :
70 : /*!
71 : \brief Set VFK property (string)
72 : */
73 0 : VFKProperty::VFKProperty(std::string const& strValue)
74 0 : : m_bIsNull(FALSE), m_nValue(0), m_dValue(0.0), m_strValue(strValue)
75 : {
76 0 : }
77 :
78 : /*!
79 : \brief VFK property destructor
80 : */
81 1357 : VFKProperty::~VFKProperty()
82 : {
83 1357 : }
84 :
85 : /*!
86 : \brief Copy constructor.
87 : */
88 652 : VFKProperty::VFKProperty(VFKProperty const& other)
89 : : m_bIsNull(other.m_bIsNull),
90 652 : m_nValue(other.m_nValue), m_dValue(other.m_dValue), m_strValue(other.m_strValue)
91 : {
92 652 : }
93 :
94 : /*!
95 : \brief Assignment operator.
96 : */
97 652 : VFKProperty& VFKProperty::operator=(VFKProperty const& other)
98 : {
99 652 : if (&other != this) {
100 652 : m_bIsNull = other.m_bIsNull;
101 652 : m_nValue = other.m_nValue;
102 652 : m_dValue = other.m_dValue;
103 652 : m_strValue = other.m_strValue;
104 : }
105 652 : return *this;
106 : }
|