DgnTextSnippet.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 #pragma once
11 
12 DGNPLATFORM_TYPEDEFS (DgnTextSnippetPropertyMask);
13 
14 
16 struct DgnTextSnippetCategory;
17 struct DgnTextSnippetCategoryCollection;
22 
23 /*---------------------------------------------------------------------------------**/
29 
31  {
33  {
34  SnippetName = 1,
35  SnippetText = 2,
36  FromActiveFile = 3,
37  SnippetCategory = 4,
38  SnippetDisplayName = 5,
40  };
41 
43 
44  public:
46  DGNPLATFORM_EXPORT DgnFileR GetFile() const;
47 
49  DGNPLATFORM_EXPORT WString GetName() const;
50 
52  DGNPLATFORM_EXPORT ElementId GetID () const;
53 
56 
58  DGNPLATFORM_EXPORT WString GetDisplayName() const;
59 
61  DGNPLATFORM_EXPORT BentleyStatus SetDisplayName (WCharCP name);
62 
64  DGNPLATFORM_EXPORT TextBlockCP GetSnippetText() const;
65 
67  DGNPLATFORM_EXPORT BentleyStatus SetSnippetText(TextBlockCR text);
68 
70  DGNPLATFORM_EXPORT DgnTextSnippetCategoryCP GetCategory() const;
71 
74 
80  DGNPLATFORM_EXPORT static DgnTextSnippetPtr Create (WCharCP name, DgnFileR file);
81 
86 
90  DGNPLATFORM_EXPORT static BentleyStatus Delete (WCharCP name, DgnFileR file);
91 
97  DGNPLATFORM_EXPORT BentleyStatus Replace (WCharCP oldName = NULL, DgnFileP file = NULL);
98 
103  DGNPLATFORM_EXPORT static DgnTextSnippetPtr GetByName (WCharCP name, DgnFileR file);
104 
109  DGNPLATFORM_EXPORT static DgnTextSnippetPtr GetByID (ElementId id, DgnFileR file);
110 
112  DGNPLATFORM_EXPORT void CopyValues (DgnTextSnippetCR snippet);
113 
118 
119  //Test whether this snippet is actually saved in the file.
120  DGNPLATFORM_EXPORT bool IsPersisted () const;
121 
122  //Upgrade schema and instance.
123  DGNPLATFORM_EXPORT static void UpgradeSchemaAndInstance(DgnFileP file);
124  };
125 
126 
127 
128 /*=================================================================================**/
135 {
136 private:
137  virtual void MakeClassAbstract() = 0;
138 public:
139 public:
140 
143  DGNPLATFORM_EXPORT static DgnTextSnippetPropertyMaskPtr CreatePropMask ();
144 
146  DGNPLATFORM_EXPORT bool GetPropertyFlag (DgnTextSnippet::DgnTextSnippetProperty flag) const;
147 
149  DGNPLATFORM_EXPORT void SetPropertyFlag (DgnTextSnippet::DgnTextSnippetProperty flag, bool value);
150 
152  DGNPLATFORM_EXPORT bool AnyBitSet () const;
153 
155  DGNPLATFORM_EXPORT void ResetFlags ();
156 
157 
158 }; // DgnTextSnippetPropertyMask
159 
161 /*=================================================================================**/
167 struct DgnTextSnippetIterator : std::iterator<std::forward_iterator_tag, DgnTextSnippetP const>
168  {
169 
170  private:
173  mutable DgnTextSnippetPtr m_current;
174  DgnTextSnippetCollection const* m_parentCollection;
175  void MoveToNextLabelSnippetElement();
176 
178  DgnTextSnippetIterator (DgnTextSnippetCollection const* parentCollection, bool begin);
179 
180  public:
181 
184 
187 
190 
193  };
194 
195 /*=================================================================================**/
202  {
203  friend struct DgnTextSnippetIterator;
205  PersistentElementRefList* GetElementList () const;
206  public:
210 
213 
216 
219  };
220 
221 /*=================================================================================**/
228  {
229 public:
232  DGNPLATFORM_EXPORT DgnFileR GetFile() const;
233 
238 
241  DGNPLATFORM_EXPORT WString GetName() const;
242 
245  DGNPLATFORM_EXPORT DgnTextSnippetCategoryPtr GetParentCategory() const;
246 
250  DGNPLATFORM_EXPORT bool IsSubCategoryExist (DgnTextSnippetCategoryPtr subCategory);
251 
255  DGNPLATFORM_EXPORT BentleyStatus AddSubCategory (DgnTextSnippetCategoryPtr subCategory);
256 
259  DGNPLATFORM_EXPORT bvector<DgnTextSnippetCategoryPtr>& GetSubCategories ();
260 
264  DGNPLATFORM_EXPORT BentleyStatus RemoveSubCategory (WStringCR name);
265 
270 
274  DGNPLATFORM_EXPORT BentleyStatus Replace (DgnFileP fileIn = NULL);
275 
279  DGNPLATFORM_EXPORT BentleyStatus Delete (DgnFileP fileIn = NULL);
280 
281 
287 
293  DGNPLATFORM_EXPORT static BentleyStatus BuildCategoryTreeFromFile (bvector<DgnTextSnippetCategoryPtr>& categories, DgnFileR file);
294 
300  DGNPLATFORM_EXPORT static BentleyStatus GetTextFavorites (bvector<DgnTextSnippetPtr>& snippets, DgnTextSnippetCategoryP category, DgnFileR file);
301 
304  DGNPLATFORM_EXPORT ECN::IECInstancePtr GetECInstance ();
305 
309 
310  };
311 
312 
314 
An element was added to the file.
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
DgnTextSnippetProperty
Definition: DgnTextSnippet.h:32
struct DgnPlatform::DgnTextSnippetCategory const * DgnTextSnippetCategoryCP
Definition: DgnPlatform.h:231
struct Bentley::WString const & WStringCR
Definition: Bentley.h:239
iterator begin()
Definition: stdcxx/bstdmap.h:178
RefCountedPtr< DgnTextSnippetPropertyMask > DgnTextSnippetPropertyMaskPtr
Definition: DgnTextSnippet.h:19
iterator end()
Definition: stdcxx/bstdmap.h:186
RefCountedPtr< DgnFile > m_dgnFile
Definition: DgnTextSnippet.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
DgnTextSnippetPropertyMaskPtr PropertyMaskPtr
Definition: DgnTextSnippet.h:42
struct DgnPlatform::TextBlock const * TextBlockCP
Definition: DgnPlatform.h:457
!DgnTextSnippet is a named serialized textblock which is stored in the dictionary model...
Definition: DgnTextSnippet.h:30
RefCountedPtr< DgnTextSnippet > DgnTextSnippetPtr
Definition: DgnTextSnippet.h:17
#define NULL
Definition: Bentley.h:157
RefCountedPtr< DgnTextSnippetCategory > DgnTextSnippetCategoryPtr
Definition: DgnTextSnippet.h:20
PersistentElementRefList - a list of Dgn Elements.
Definition: DgnModel.h:102
A collection of textsnippet in a file.
Definition: DgnTextSnippet.h:201
RefCountedPtr< DgnTextSnippetCategoryCollection > DgnTextSnippetCategoryCollectionPtr
Definition: DgnTextSnippet.h:21
A BitMask of all DgnTextSnippet properties.
Definition: DgnTextSnippet.h:134
Iterate over the elements in a PersistentElementRefList.
Definition: DgnModel.h:57
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
DGNPLATFORM_TYPEDEFS(DgnTextSnippetPropertyMask)
BentleyStatus
Definition: Bentley.h:208
struct DgnPlatform::DgnTextSnippet const & DgnTextSnippetCR
Definition: DgnPlatform.h:230
const_iterator iterator
only const iteration is possible
Definition: DgnTextSnippet.h:212
struct DgnPlatform::TextBlock const & TextBlockCR
Definition: DgnPlatform.h:457
Category of textsnippet in a file.
Definition: DgnTextSnippet.h:227
#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
A forward iterator to go through the list of snippets in a file.
Definition: DgnTextSnippet.h:167
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
UInt64 ElementId
Definition: DgnPlatformBaseType.r.h:83
DgnTextSnippetIterator const_iterator
Definition: DgnTextSnippet.h:211
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51
bool operator==(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:146

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