Debian Codegraph @

DatabaseExplorer/column.cpp

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : column.cpp
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #include "column.h"
27
28 XS_IMPLEMENT_CLONABLE_CLASS(Column,xsSerializable);
29
30 Column::Column()
31 {
32 m_pType = NULL;
33 initSerializable();
34 }
35
36 Column::~Column()
37 {
38 delete m_pType;
39 }
40
41 Column::Column(const Column& obj):xsSerializable(obj)
42 {
43 m_pType = (IDbType*) obj.m_pType->Clone();
44 m_name = obj.m_name;
45 m_parentName = obj.m_parentName;
46 initSerializable();
47 }
48
49 Column::Column(const wxString& name,
50 const wxString& parentName,
51 IDbType* type)
52 {
53 this->m_name = name;
54 this->m_parentName = parentName;
55 this->m_pType = type;
56 initSerializable();
57 }
58
59 void Column::Edit(wxString& name,
60 wxString& parentName,
61 IDbType* type)
62 {
63 this->m_pType = NULL;
64 this->m_name = name;
65 this->m_parentName = parentName;
66 if (this->m_pType) delete this->m_pType;
67 this->m_pType = type;
68
69 }
70
71 void Column::initSerializable()
72 {
73 XS_SERIALIZE(m_name,wxT("m_name"));
74 XS_SERIALIZE(m_parentName,wxT("m_parentName"));
75 XS_SERIALIZE_DYNAMIC_OBJECT(m_pType, wxT("type"));
76 }