DgnPlatform/XMLFragment.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 
12 
14 struct XmlFragment;
15 
16 typedef RefCountedPtr<XmlFragment> XmlFragmentPtr;
18 
19 /*=================================================================================**/
82 /*=================================================================================**/
87 struct XmlFragment : public RefCountedBase
88 {
89 public:
94  DGNPLATFORM_EXPORT static XmlFragmentPtr Construct (UShort appID, UShort appType);
95 
103  DGNPLATFORM_EXPORT static XmlFragmentPtr Construct (UShort appID, UShort appType, bool isCompressed, WCharCP pSchemaURN, WCharCP pText);
104 
111  DGNPLATFORM_EXPORT static XmlFragmentPtr Construct (UShort appID, UShort appType, WCharCP pText);
112 
118  DGNPLATFORM_EXPORT static bool IsFragmentElement (ElementHandleCR eh, UInt16* pAppID=NULL, UInt16* pAppType=NULL);
119 
124  // UInt32 compression flag, 1=uncompressed, 2=compressed
125  // UInt32 uncompressed XML Fragment data size + the size in bytes of these first two values (8 bytes)
126  // --- start of compressable data ----------------------------------
127  // UInt32 total size, in bytes, of uncompressed XML Fragment data
128  // UInt32 # of bytes to hold schema including trailing 0
129  // byte* Schema URN text
130  // UInt32 # of bytes to hold XML fragment text including trailing 0
131  // byte* XML fragment text
132  // --- end of compressable data -------------------------------------
138  DGNPLATFORM_EXPORT static XmlFragmentPtr ConstructFromBuffer (byte* pBuffer, UInt32 ulBufferSize, UInt16 appId, UInt16 appType);
139 
142  DGNPLATFORM_EXPORT static XmlFragmentPtr ConstructFromXmlFragmentElement (ElementHandleCR eh);
143 
148  DGNPLATFORM_EXPORT static StatusInt StripFromElementByAppIDAndType (EditElementHandleR eeh, UShort* pAppID, UShort* pAppType);
149 
152  DGNPLATFORM_EXPORT static StatusInt StripAllFromElement (EditElementHandleR eeh);
153 
158  DGNPLATFORM_EXPORT static bool ElementHasXmlFragmentLinkage (ElementHandleCR eh, const UShort* pAppID, const UShort* pAppType);
159 
162  DGNPLATFORM_EXPORT UShort GetAppID ();
163 
168  DGNPLATFORM_EXPORT void SetAppID (UShort appID);
169 
174  DGNPLATFORM_EXPORT UShort GetAppType ();
175 
181  DGNPLATFORM_EXPORT void SetAppType (UShort appType);
182 
186  DGNPLATFORM_EXPORT WCharCP GetSchemaURN ();
187 
191  DGNPLATFORM_EXPORT void SetSchemaURN (WCharCP pSchemaURN);
192 
196  DGNPLATFORM_EXPORT WCharCP GetText ();
197 
202  DGNPLATFORM_EXPORT void SetText (WCharCP pText);
203 
209  DGNPLATFORM_EXPORT bool IsCompressed ();
210 
217  DGNPLATFORM_EXPORT void SetIsCompressed (bool isCompressed);
218 
224  DGNPLATFORM_EXPORT StatusInt GetStreamData (byte** ppBuffer, UInt32* pulBufferSize);
225 
228  DGNPLATFORM_EXPORT void FreeStreamData ();
229 
233  DGNPLATFORM_EXPORT StatusInt AttachToElement (EditElementHandleR eeh);
234 
240  DGNPLATFORM_EXPORT StatusInt CreateXmlElement (EditElementHandleR eeh, DgnModelRefP model, bool setNonModelFlag);
241 };
242 
244 
245 
247 struct XmlFragmentList;
248 
249 typedef RefCountedPtr<XmlFragmentList> XmlFragmentListPtr;
251 
252 /*=================================================================================**/
278 /*=================================================================================**/
285 {
286 
289 
292 
295 
299  DGNPLATFORM_EXPORT static XmlFragmentListPtr ConstructFromFragment (XmlFragment const* xmlFragment);
300 
311  DGNPLATFORM_EXPORT static XmlFragmentListPtr Construct (WChar* pText, WChar* pSchemaURN, UShort appID, UShort appType);
312 
318  DGNPLATFORM_EXPORT static XmlFragmentListPtr ConstructFromBuffer (byte* pBuffer, UInt32 ulBufferSize, UShort appId=0, UShort appType=0);
319 
323  DGNPLATFORM_EXPORT StatusInt Append (XmlFragment const* xmlFragment);
324 
328  DGNPLATFORM_EXPORT StatusInt Prepend (XmlFragment const* xmlFragment);
329 
333  DGNPLATFORM_EXPORT StatusInt Remove (size_t index);
334 
336  DGNPLATFORM_EXPORT size_t GetCount();
337 
341  DGNPLATFORM_EXPORT XmlFragmentPtr GetFragmentAtIndex (size_t index);
342 
347  DGNPLATFORM_EXPORT static XmlFragmentListPtr ExtractFromElement (ElementHandleCR eh, const UShort* pAppID=NULL, const UShort* pAppType=NULL);
348 
352  DGNPLATFORM_EXPORT StatusInt AttachToElement (EditElementHandleR eeh);
353 };
354 
356 
358 
359 
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
Open for both read and write.
wchar_t WChar
Definition: Bentley.h:223
iterator begin()
Definition: stdcxx/bstdmap.h:178
uint16_t UInt16
Definition: Bentley.r.h:118
iterator end()
Definition: stdcxx/bstdmap.h:186
A writeable "handle" to an MSElement.
Definition: ElementHandle.h:470
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
wchar_t const * WCharCP
Definition: Bentley.h:224
bvector< XmlFragmentPtr >::const_iterator const_iterator
Definition: DgnPlatform/XMLFragment.h:287
uint32_t UInt32
Definition: Bentley.r.h:128
#define NULL
Definition: Bentley.h:157
BC__RW::__rw_debug_iter< bvector, const_pointer, pointer > const_iterator
Definition: stdcxx/bvector.h:115
BC__RW::__rw_debug_iter< bvector, pointer, pointer > iterator
Definition: stdcxx/bvector.h:112
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
Class used to process list of XML Fragments.
Definition: DgnPlatform/XMLFragment.h:284
unsigned char byte
Definition: Bentley.r.h:144
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
int StatusInt
Definition: Bentley.h:222
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
const_iterator iterator
only const iteration is possible
Definition: DgnPlatform/XMLFragment.h:288
struct DgnPlatform::ElementHandle const & ElementHandleCR
Definition: DgnPlatform.h:260
Class used to define XML Fragments that can be stored in the design file.
Definition: DgnPlatform/XMLFragment.h:87

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