DgnStoreHandlers.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include <DgnPlatform/Handler.h>
11 
12 
14 
17 
18 /*=================================================================================**/
35 {
38 private:
39  virtual void MakeClassAbstract() = 0;
40 public:
41 public:
42 
43 DGNPLATFORM_EXPORT static bool IsDgnStoreElement (ElementHandleCR in, UInt32 dgnStoreId = 0, UInt32 applicationId = 0);
44 DGNPLATFORM_EXPORT static BentleyStatus GetDgnStoreIds (UInt32* dgnStoreId, UInt32* applicationId, ElementHandleCR in);
45 DGNPLATFORM_EXPORT static BentleyStatus Extract (void** dataPP, UInt32* dataSizeP, UInt32 dgnStoreId, UInt32 applicationId, ElementHandleCR eh);
46 DGNPLATFORM_EXPORT static BentleyStatus ExtractFromCell (void** dataPP, UInt32* dataSizeP, UInt32 dgnStoreId, UInt32 applicationId, ElementHandleCR eh);
47 DGNPLATFORM_EXPORT static void FreeExtractedData (void* dataP);
48 
49 DGNPLATFORM_EXPORT static BentleyStatus Create (EditElementHandleR eeh, void* dataP, UInt32 dataSize, UInt32 dgnStoreId, UInt32 applicationId, DgnModelRefP);
50 DGNPLATFORM_EXPORT static BentleyStatus AppendToCell (EditElementHandleR cellEeh, void* dataP, UInt32 dataSize, UInt32 dgnStoreId, UInt32 applicationId);
51 DGNPLATFORM_EXPORT static BentleyStatus RemoveFromCell (EditElementHandleR cellEeh, UInt32 dgnStoreId, UInt32 applicationId);
52 
53 }; // DgnStoreHdrHandler
54 
55 /*=================================================================================**/
62 {
65 private:
66  virtual void MakeClassAbstract() = 0;
67 public:
68 public:
69 
74 DGNPLATFORM_EXPORT static BentleyStatus GetByID (EditElementHandleR eeh, ElementId uniqueId, DgnFileR dgnFile);
75 
80 DGNPLATFORM_EXPORT static BentleyStatus GetByName (EditElementHandleR eeh, WCharCP setName, DgnFileR dgnFile);
81 
88 DGNPLATFORM_EXPORT static BentleyStatus GetSetName (WCharP name, int bufferSize, ElementHandleCR elm);
89 
96 DGNPLATFORM_EXPORT static BentleyStatus GetReportName (WCharP name, int bufferSize, ElementHandleCR elm);
97 
101 DGNPLATFORM_EXPORT static BentleyStatus SetSetName (EditElementHandleR eeh, WCharCP name);
102 
106 DGNPLATFORM_EXPORT static BentleyStatus SetReportName (EditElementHandleR eeh, WCharCP name);
107 
112 DGNPLATFORM_EXPORT static BentleyStatus ExtractTagDefByID (ElementHandleCR eh, DgnTagDefinition& tagDef, UShort tagDefID);
113 
118 DGNPLATFORM_EXPORT static BentleyStatus ExtractTagDefByName (ElementHandleCR eh, DgnTagDefinition& tagDef, WCharCP name);
119 
124 DGNPLATFORM_EXPORT static BentleyStatus ExtractTagDefs (ElementHandleCR eh, bvector<DgnTagDefinition>& tagDefs);
125 
135 DGNPLATFORM_EXPORT static BentleyStatus Create (EditElementHandleR eeh, DgnTagDefinition* tagDefs, UInt32 numTagDefs, WCharCP setName, WCharCP reportName, bool assignNewIds, DgnFileR file, int ownerID=0);
136 
137 }; // TagSetHandler
138 
140 
141 struct TagSetCollection;
142 
143 /*=================================================================================**/
148 struct TagSetIterator : std::iterator<std::forward_iterator_tag, ElementRefP const>
149 {
150 private:
151 
153 ElementRefP m_elmRef;
154 
155 DGNPLATFORM_EXPORT void ToTagSet ();
156 TagSetIterator (PersistentElementRefList* l) {m_elmRef = NULL; m_it = l->begin(); ToTagSet();}
157 TagSetIterator () {m_elmRef = NULL;}
158 
159 friend struct TagSetCollection;
160 
161 public:
162 
163 TagSetIterator& operator++() {++m_it; ToTagSet(); return *this;}
164 bool operator==(TagSetIterator const& rhs) const {return m_elmRef == rhs.m_elmRef;}
165 bool operator!=(TagSetIterator const& rhs) const {return !(*this == rhs);}
166 
169 ElementRefP const& operator* () const {return m_elmRef;}
170 
171 }; // TagSetIterator
172 
173 /*=================================================================================**/
187 {
188 private:
189 
190 DgnFileR m_file;
191 
192 public:
193 
196 
197 TagSetCollection (DgnFileR dgnFile) : m_file (dgnFile) {;}
198 
199 TagSetIterator begin () const {return TagSetIterator (m_file.GetDictionaryModel().GetControlElementsP());}
200 TagSetIterator end () const {return TagSetIterator ();}
201 
202 }; // TagSetCollection
203 
206 /*=================================================================================**/
212  {
213 private:
214  virtual void MakeClassAbstract() = 0;
215 public:
216  public:
217  struct const_iterator : std::iterator<std::forward_iterator_tag, DgnTagDefinition const>
218  {
219  private:
220  byte* m_currentPos;
221  byte* m_endPos;
222  mutable DgnTagDefinition m_tmpTagDef;
223 
224  friend struct TagDefCollection;
225 
226  const_iterator (byte* pos, byte* endpos);
227  public:
228 
231 
234 
237 
239  DGNPLATFORM_EXPORT const_iterator& operator ++ ();
240 
242  DGNPLATFORM_EXPORT bool operator != (const_iterator const &) const;
243 
245  DGNPLATFORM_EXPORT bool operator == (const_iterator const &) const;
246  };
247 
249 
252 
255 
258 
261  };
262 
263 
265 
266 
The default type handler for the DGNSTORE_HDR type that corresponds to the DgnStoreHdr structure...
Definition: DgnStoreHandlers.h:34
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
TagSetIterator end() const
Definition: DgnStoreHandlers.h:200
wchar_t * WCharP
Definition: Bentley.h:225
iterator begin()
Definition: stdcxx/bstdmap.h:178
#define ELEMENTHANDLER_DECLARE_MEMBERS(__classname__, __exporter__)
Definition: Handler.h:86
const_iterator begin() const
Returns an iterator to the first element in the collection.
The collection of all tag definitions associated with an element.
Definition: DgnStoreHandlers.h:211
iterator end()
Definition: stdcxx/bstdmap.h:186
A sub-class of DgnStoreHdrHandler used to store the definition of a tag set.
Definition: DgnStoreHandlers.h:61
A writeable "handle" to an MSElement.
Definition: ElementHandle.h:470
bool operator==(TagSetIterator const &rhs) const
Definition: DgnStoreHandlers.h:164
RefCountedPtr< TagDefCollection > TagDefCollectionPtr
Definition: DgnStoreHandlers.h:204
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
A DgnFile is an in-memory representation of a physical file, regardless of its format.
Definition: DgnFile.h:308
wchar_t const * WCharCP
Definition: Bentley.h:224
uint32_t UInt32
Definition: Bentley.r.h:128
#define NULL
Definition: Bentley.h:157
PersistentElementRefList - a list of Dgn Elements.
Definition: DgnModel.h:102
TagSetIterator begin() const
Definition: DgnStoreHandlers.h:199
TagSetIterator const_iterator
Definition: DgnStoreHandlers.h:194
Iterate over the elements in a PersistentElementRefList.
Definition: DgnModel.h:57
BentleyStatus
Definition: Bentley.h:208
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
unsigned short UShort
Definition: Bentley.r.h:133
const_iterator iterator
only const iteration is possible
Definition: DgnStoreHandlers.h:248
Interface that provides direct and efficient access to element data.
Definition: ElementRefBase.h:120
unsigned char byte
Definition: Bentley.r.h:144
#define DEFINE_T_SUPER(B)
Definition: Bentley.h:167
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
DVec3d operator*(Transform const &transform, DVec3d const &vector)
operator overload for multiplication of a transform and a vector li>The vector appears on the left as...
bool operator!=(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:152
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
UInt64 ElementId
Definition: DgnPlatformBaseType.r.h:83
Handler defines the standard queries and operations available on all elements, whether graphical or n...
Definition: Handler.h:159
struct DgnPlatform::ElementHandle const & ElementHandleCR
Definition: DgnPlatform.h:260
Iterator over tag sets in a file.
Definition: DgnStoreHandlers.h:148
const_iterator iterator
only const iteration is possible
Definition: DgnStoreHandlers.h:195
The collection of all tag sets in a file.
Definition: DgnStoreHandlers.h:186
bool operator!=(TagSetIterator const &rhs) const
Definition: DgnStoreHandlers.h:165
TagSetCollection(DgnFileR dgnFile)
Definition: DgnStoreHandlers.h:197
TagSetIterator & operator++()
Definition: DgnStoreHandlers.h:163
Definition: DgnPlatform.r.h:1845
bool operator==(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:146

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.