CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
assembly.h
1
2#ifndef _system_reflection_assembly_h_
3#define _system_reflection_assembly_h_
4
5#include <system/object.h>
6#include <system/string.h>
7#include <system/array.h>
8#include <system/reflection/assembly_name.h>
9
10#include <map>
11#include <vector>
12
13namespace System{ namespace Reflection{
14
20class ASPOSECPP_SHARED_CLASS Assembly: public System::Object
21{
22public:
24 ASPOSECPP_SHARED_API Assembly();
25
31 static ASPOSECPP_SHARED_API System::SharedPtr<Assembly> GetEntryAssembly();
34 static ASPOSECPP_SHARED_API System::SharedPtr<Assembly> GetCallingAssembly();
38 static ASPOSECPP_SHARED_API System::SharedPtr<Assembly> GetAssembly(const TypeInfo& type);
39
46 virtual ASPOSECPP_SHARED_API ArrayPtr<String> GetManifestResourceNames() const;
49 virtual ASPOSECPP_SHARED_API ArrayPtr<System::TypeInfo> GetTypes() const;
50
53 virtual ASPOSECPP_SHARED_API SharedPtr<AssemblyName> GetName() const;
56 virtual ASPOSECPP_SHARED_API String get_FullName() const;
59 virtual ASPOSECPP_SHARED_API String get_CodeBase() const;
61 virtual ASPOSECPP_SHARED_API String get_Location() const;
62
63protected:
65 ASPOSECPP_SHARED_API ~Assembly() override;
67 typedef std::map<String, std::pair<const uint8_t*, uint32_t>> RawResources;
68
74 ASPOSECPP_SHARED_API Assembly(const String& name, const String& full_name,
75 const ArrayPtr<String>& resource_names,
76 const RawResources& raw_resources);
77
84 static ASPOSECPP_SHARED_API void Setup(const SharedPtr<Assembly>& assembly,
85 const String& name, const String& full_name,
86 const ArrayPtr<String>& resource_names,
87 const RawResources& raw_resources);
88
97
102 void ASPOSECPP_SHARED_API RegisterType(const System::TypeInfo& type);
103};
104
105}} // namespace System{ namespace Reflection{
106
107#endif //_system_reflection_assembly_h_
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Reflection class describing assembly. Support is limited as the rules are quite different between C# ...
Definition: assembly.h:21
static System::SharedPtr< Assembly > GetCallingAssembly()
Gets calling assembly.
virtual ArrayPtr< String > GetManifestResourceNames() const
Gets names of manifest resources.
static void Setup(const SharedPtr< Assembly > &assembly, const String &name, const String &full_name, const ArrayPtr< String > &resource_names, const RawResources &raw_resources)
Sets assembly object parameters.
virtual String get_FullName() const
Gets assembly full name.
void RegisterType(const System::TypeInfo &type)
Registers specific type in assembly.
RawResources m_resources_raw
Resource data.
Definition: assembly.h:96
System::ArrayPtr< String > m_manifest_resource_names
Resource names.
Definition: assembly.h:94
virtual ArrayPtr< System::TypeInfo > GetTypes() const
Gets types declared by assembly.
virtual String get_Location() const
Gets assembly location. Not implemented.
static System::SharedPtr< Assembly > GetExecutingAssembly()
Gets executing assembly.
Assembly(const String &name, const String &full_name, const ArrayPtr< String > &resource_names, const RawResources &raw_resources)
Constructor.
~Assembly() override
Destructor.
std::map< String, std::pair< const uint8_t *, uint32_t > > RawResources
Map of raw resources (name => {data, size}).
Definition: assembly.h:67
virtual String get_CodeBase() const
Gets directory of current assembly. Support is limited.
String m_full_name
Assembly full name.
Definition: assembly.h:92
String m_name
Assembly name.
Definition: assembly.h:90
virtual SharedPtr< AssemblyName > GetName() const
Gets assembly name.
static System::SharedPtr< Assembly > GetAssembly(const TypeInfo &type)
Gets assembly defining specific type.
virtual System::SharedPtr< System::IO::Stream > GetManifestResourceStream(String name) const
Gets stream connected to manifest resource.
static System::SharedPtr< Assembly > GetEntryAssembly()
Gets entry assembly.
Base type for singletons to register type in executing assembly.
Definition: assembly_type_registration.h:13
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
Represents a particular type and provides information about it.
Definition: type_info.h:109
Definition: db_command.h:9