fintp_ws
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WSSerializable.h
Go to the documentation of this file.
1 /*
2 * FinTP - Financial Transactions Processing Application
3 * Copyright (C) 2013 Business Information Systems (Allevo) S.R.L.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>
17 * or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania,
18 * phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro.
19 */
20 
21 #ifndef WSSERIALIZABLE_H
22 #define WSSERIALIZABLE_H
23 
24 #include "DllMainWs.h"
25 
26 #include "xercesc/dom/DOM.hpp"
27 
28 #include <string>
29 #include <stdexcept>
30 
31 #ifdef WIN32
32  #define __MSXML_LIBRARY_DEFINED__
33 #endif
34 
35 #include "XmlStringUtil.h"
36 
37 XERCES_CPP_NAMESPACE_USE
38 using namespace std;
39 
41 {
42  public:
43 
44  WSSerializable( const string& elementName = "name", const string& namespaceId = "ns", const string& namespaceUri = "uri" );
45  virtual ~WSSerializable();
46 
47  string Serialize() const;
48  DOMNode* Serialize( DOMNode* root ) const;
49  WSSerializable* Deserialize( const DOMNode* data ) const;
50 
51  string getElementName() const { return m_ElementName; }
52  string getNamespaceId() const { return m_NamespaceId; }
53  string getNamespaceUri() const { return m_NamespaceUri; }
54 
55  protected :
56 
57  virtual string internalSerialize() const = 0;
58  virtual DOMNode* internalSerialize( DOMNode* root ) const { return root;}
59  virtual WSSerializable* internalDeserialize( const DOMNode* data ) = 0;
60 
61  string m_ElementName;
62  string m_NamespaceId;
64 };
65 
66 #endif // WSSERIALIZABLE_H