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
58 };
59
60
61public:
62
64 ASPOSECPP_SHARED_API NameTable();
65
70 ASPOSECPP_SHARED_API const String& Add(const String& key) override;
84 ASPOSECPP_SHARED_API const String& Add(const ArrayPtr<char16_t>& key, int32_t start, int32_t len) override;
89 ASPOSECPP_SHARED_API const String& Get(const String& value) override;
103 ASPOSECPP_SHARED_API const String& Get(const ArrayPtr<char16_t>& key, int32_t start, int32_t len) override;
104
105protected:
106
108 #ifdef ASPOSE_GET_SHARED_MEMBERS
109 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
110 #endif
112
113private:
114
116 int32_t _count;
117 int32_t _mask;
118
119 const String& AddEntry(const String& str, int32_t hashCode);
120 void Grow();
121 static bool TextEquals(const String& str1, const ArrayPtr<char16_t>& str2, int32_t str2Start, int32_t str2Length);
122 static int32_t ComputeHash32(const String& key);
123 static int32_t ComputeHash32(const ArrayPtr<char16_t>& key, int32_t start, int32_t len);
124
125};
126
127} // namespace Xml
128} // namespace System
129
130
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