CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
name_table.h
1
2
3#pragma once
4
5#include <xml/xml_name_table.h>
6#include <system/array.h>
7#include <cstdint>
8
9
10namespace System {
11
12namespace Xml {
13
18class ASPOSECPP_SHARED_CLASS NameTable : public XmlNameTable
19{
20 typedef NameTable ThisType;
21 typedef XmlNameTable BaseType;
22
23 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
24 ASPOSECPP_SHARED_RTTI_INFO_DECL();
25
26public:
27
30
31private:
32
33 class Entry : public System::Object
34 {
35 typedef Entry ThisType;
37
38 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
39 RTTI_INFO_DECL();
40
41 public:
42
44 String str;
45 int32_t hashCode;
47
48 Entry(const String& str, int32_t hashCode, const SharedPtr<NameTable::Entry>& next);
50
51 protected:
52
53 #ifdef ASPOSE_GET_SHARED_MEMBERS
54 void GetSharedMembers(System::Object::shared_members_type& result) const override;
55 #endif
56
57 #ifdef __DBG_FOR_EACH_MEMBER
58 public:
61 ASPOSECPP_SHARED_API void DBG_for_each_member(DBG::for_each_member_visitor& visitor) const override;
64 const char* DBG_class_name() const override { return "Entry"; }
65 #endif
66
67
68 };
69
70
71public:
72
74 ASPOSECPP_SHARED_API NameTable();
75
80 ASPOSECPP_SHARED_API const String& Add(const String& key) override;
94 ASPOSECPP_SHARED_API const String& Add(const ArrayPtr<char16_t>& key, int32_t start, int32_t len) override;
99 ASPOSECPP_SHARED_API const String& Get(const String& value) override;
113 ASPOSECPP_SHARED_API const String& Get(const ArrayPtr<char16_t>& key, int32_t start, int32_t len) override;
114
115protected:
116
118 #ifdef ASPOSE_GET_SHARED_MEMBERS
119 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
120 #endif
121
122 #ifdef __DBG_FOR_EACH_MEMBER
123public:
126 ASPOSECPP_SHARED_API void DBG_for_each_member(DBG::for_each_member_visitor& visitor) const override;
129 const char* DBG_class_name() const override { return "NameTable"; }
130#endif
132
133private:
134
136 int32_t _count;
137 int32_t _mask;
138
139 const String& AddEntry(const String& str, int32_t hashCode);
140 void Grow();
141 static bool TextEquals(const String& str1, const ArrayPtr<char16_t>& str2, int32_t str2Start, int32_t str2Length);
142 static int32_t ComputeHash32(const String& key);
143 static int32_t ComputeHash32(const ArrayPtr<char16_t>& key, int32_t start, int32_t len);
144
145};
146
147} // namespace Xml
148} // namespace System
149
150
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Implements a single-threaded XmlNameTable.
Definition: name_table.h:19
const String & Get(const ArrayPtr< char16_t > &key, int32_t start, int32_t len) override
Returns the atomized string containing the same characters as the specified range of characters in th...
const String & Add(const ArrayPtr< char16_t > &key, int32_t start, int32_t len) override
Atomizes the specified string and adds it to the NameTable.
NameTable()
Initializes a new instance of the NameTable class.
const String & Get(const String &value) override
Returns the atomized string with the specified value.
const String & Add(const String &key) override
Atomizes the specified string and adds it to the NameTable.
Table of atomized string objects.
Definition: xml_name_table.h:15
@ Xml
Serialize according to the XML 1.0 rules.
Definition: db_command.h:9