GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_rep.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
22 
23 #include "glc_rep.h"
24 #include "QtDebug"
25 
26 // Default constructor
28 : m_pIsLoaded(new bool(false))
29 , m_pNumberOfRepresentation(new int(1))
30 , m_pFileName(new QString())
31 , m_pName(new QString())
32 , m_pDateTime(new QDateTime)
33 {
34 
35 }
36 
37 // Copy Constructor
39 : m_pIsLoaded(rep.m_pIsLoaded)
40 , m_pNumberOfRepresentation(rep.m_pNumberOfRepresentation)
41 , m_pFileName(rep.m_pFileName)
42 , m_pName(rep.m_pName)
43 , m_pDateTime(rep.m_pDateTime)
44 {
45  ++(*m_pNumberOfRepresentation);
46 }
47 
48 // Assignement operator
50 {
51  if (this != &rep)
52  {
53  // Clear this representation
54  clear();
57  ++(*m_pNumberOfRepresentation);
59  m_pName= rep.m_pName;
61  }
62 
63  return *this;
64 }
65 
66 // Destructor
68 {
69  // Clear this representation
70  clear();
71 }
72 
73 
75 // private services functions
77 // Clear current representation
79 {
80  Q_ASSERT(NULL != m_pNumberOfRepresentation);
81  if ((--(*m_pNumberOfRepresentation)) == 0)
82  {
83  delete m_pIsLoaded;
84  m_pIsLoaded= NULL;
87  delete m_pFileName;
88  m_pFileName= NULL;
89  delete m_pName;
90  m_pName= NULL;
91  delete m_pDateTime;
92  m_pDateTime= NULL;
93  }
94 }

©2005-2013 Laurent Ribon