CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
match.h
1
2#ifndef _aspose_system_text_match_h_
3#define _aspose_system_text_match_h_
4
5#include "system/text/regularexpressions/group_collection.h"
6#include "system/text/regularexpressions/regex_options.h"
7#include "system/timespan.h"
8#include "system/array.h"
9
10// Wrappers for types from 3rd party libraries
11#ifdef ASPOSECPPLIB_BEING_BUILT
12#include <regex_holders.h>
13#endif
14
15namespace System { namespace Text { namespace RegularExpressions {
16
17namespace Detail
18{
20 ASPOSECPP_3RD_PARTY_CLASS(MatchHolder);
21
23 class RegexHolder;
24
26 class DummyMatchHolder
27 {
28 std::unique_ptr<void, void(*)()> p1;
29 std::unique_ptr<void, void(*)()> p2;
30 bool b1;
31 std::shared_ptr<int> s1;
32
33 // Explicitly deleting constructor to avoid warnings.
34 DummyMatchHolder() = delete;
35 };
36}
37
39ASPOSECPP_3RD_PARTY_UNCOPYBALE_TYPE_HOLDER(Detail::MatchHolder, MatchHolder, sizeof(Detail::DummyMatchHolder),
40 Detail::DummyMatchHolder, MatchHolderAlias);
41
42class Regex;
45
46
47class Match;
50
55class ASPOSECPP_SHARED_CLASS Match : public Group
56{
57 friend GroupCollection;
58 friend class Regex;
59public:
64 ASPOSECPP_SHARED_API Match(const UStringPtr& source, int index, int length);
65
68 static ASPOSECPP_SHARED_API MatchPtr get_Empty();
71 ASPOSECPP_SHARED_API GroupCollectionPtr get_Groups();
74 ASPOSECPP_SHARED_API MatchPtr NextMatch();
78 virtual ASPOSECPP_SHARED_API String Result(const String& replacement);
79
80 ASPOSECPP_SHARED_API void SetMappedIndexes(const std::vector<int>& mapped_indexes);
81
84 ASPOSECPP_SHARED_API void AddGroup(const GroupPtr &item);
87 ASPOSECPP_SHARED_API void AddCapture(const CapturePtr& item);
88
89private:
93 int GetGroupIndexFromName(const String& name);
94
96 GroupCollectionPtr groups;
98 std::vector<int> m_mapped_indexes;
100 MatchHolderAlias what;
102 RegexPtr regex;
104 static MatchPtr emptyMatch;
105
106protected:
107#ifdef ASPOSE_GET_SHARED_MEMBERS
109 virtual ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
110#endif
111
112#ifdef __DBG_FOR_EACH_MEMBER
113public:
116 void DBG_for_each_member(DBG::for_each_member_visitor &visitor) const override
117 {
118 Group::DBG_for_each_member(visitor);
119 visitor.add_self(this);
120 visitor.add_member(this, groups.get_shared(), "groups");
121 }
122
125 const char* DBG_class_name() const override { return "Match"; }
126#endif
127};
128
129}}} // namespace System::Text::RegularExpressions
130
131#endif // _aspose_system_text_match_h_
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Pointee_ * get_shared() const
Gets pointed object, but asserts that pointer is in shared mode.
Definition: smart_ptr.h:524
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
List of capture groups in a single match. Objects of this class should only be allocated using System...
Definition: group_collection.h:21
Group collection pointer. This type is a pointer to manage other object's deletion....
Definition: group_collection.h:104
Result of matching done by single capturing group. Objects of this class should only be allocated usi...
Definition: group.h:20
Single match of regexp over string. Objects of this class should only be allocated using System::Make...
Definition: match.h:56
virtual String Result(const String &replacement)
Formats string by replacing submatch references with their values.
void SetMappedIndexes(const std::vector< int > &mapped_indexes)
GroupCollectionPtr get_Groups()
Gets group list.
static MatchPtr get_Empty()
Empty match accessor.
Match(const UStringPtr &source, int index, int length)
Constructor.
MatchPtr NextMatch()
Iteration over matches.
void AddCapture(const CapturePtr &item)
Adds capture into match.
void AddGroup(const GroupPtr &item)
Adds group into match.
Regular expression that follows C#-like syntax. Objects of this class should only be allocated using ...
Definition: regex.h:30
@ Text
Defines color adjustment information for text.
System::SharedPtr< Regex > RegexPtr
Regex pointer.
Definition: match.h:44
std::shared_ptr< const UnicodeString > UStringPtr
Shared UnicodeString to avoid copying.
Definition: capture.h:15
SharedPtr< Match > MatchPtr
Match pointer.
Definition: match.h:49
ASPOSECPP_3RD_PARTY_UNCOPYBALE_TYPE_HOLDER(Detail::MatchHolder, MatchHolder, sizeof(Detail::DummyMatchHolder), Detail::DummyMatchHolder, MatchHolderAlias)
Wrapper to hold MatchHolder class without its including as well as PCRE2.
Definition: db_command.h:9