0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / StdLPersistent / StdLPersistent_Value.hxx
1 // Copyright (c) 2015 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #ifndef _StdLPersistent_Value_HeaderFile
16 #define _StdLPersistent_Value_HeaderFile
17
18 #include <StdObjMgt_Attribute.hxx>
19 #include <StdLPersistent_HString.hxx>
20
21 #include <TDataStd_Integer.hxx>
22 #include <TDF_TagSource.hxx>
23 #include <TDF_Reference.hxx>
24 #include <TDataStd_UAttribute.hxx>
25 #include <TDataStd_Name.hxx>
26 #include <TDataStd_Comment.hxx>
27 #include <TDataStd_AsciiString.hxx>
28
29
30 class StdLPersistent_Value
31 {
32   template <class AttribClass>
33   class integer : public StdObjMgt_Attribute<AttribClass>::SingleInt
34   {
35   public:
36     //! Import transient attribuite from the persistent data.
37     Standard_EXPORT virtual void ImportAttribute();
38   };
39
40   template <class AttribClass,
41             class HStringClass = StdLPersistent_HString::Extended>
42   class string : public StdObjMgt_Attribute<AttribClass>::SingleRef
43   {
44   public:
45     //! Import transient attribuite from the persistent data.
46     Standard_EXPORT virtual void ImportAttribute();
47   };
48
49 public:
50
51   class TagSource : public integer <TDF_TagSource> {
52   public:
53     Standard_CString PName() const { return "PDF_TagSource"; }
54   };
55
56   class Reference : public string <TDF_Reference> {
57   public:
58     Standard_CString PName() const { return "PDF_Reference"; }
59   };
60
61   class Comment : public string <TDataStd_Comment> {
62   public:
63     Standard_CString PName() const { return "PDF_Comment"; }
64   };
65
66   class UAttribute : public string <TDataStd_UAttribute>
67   {
68   public:
69     //! Create an empty transient attribuite
70     Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
71     Standard_CString PName() const { return "PDataStd_UAttribute"; }
72   };
73
74   class Integer : public integer <TDataStd_Integer>
75   {
76   public:
77     //! Create an empty transient attribuite
78     Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
79     Standard_CString PName() const { return "PDataStd_Integer"; }
80   };
81
82   class Name : public string <TDataStd_Name>
83   {
84   public:
85     //! Create an empty transient attribuite
86     Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
87     Standard_CString PName() const { return "PDataStd_Name"; }
88   };
89
90   class AsciiString : public string <TDataStd_AsciiString, StdLPersistent_HString::Ascii>
91   {
92   public:
93     //! Create an empty transient attribuite
94     Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
95     Standard_CString PName() const { return "PDataStd_AsciiString"; }
96   };
97 };
98
99 template<>
100 template<>
101 inline Standard_CString StdObjMgt_Attribute<TDF_TagSource>::Simple<Standard_Integer>::PName() const
102   { return "PDF_TagSource"; }
103
104 template<>
105 template<>
106 inline Standard_CString StdObjMgt_Attribute<TDF_Reference>::Simple<Handle(StdObjMgt_Persistent)>::PName() const
107   { return "PDF_Reference"; }
108
109 template<>
110 template<>
111 inline Standard_CString StdObjMgt_Attribute<TDataStd_Comment>::Simple<Handle(StdObjMgt_Persistent)>::PName() const
112   { return "PDataStd_Comment"; }
113
114 #endif