#include "stdafx.h" #include "TestClass.h" #include #include using namespace std; using namespace cli; using namespace System::Collections::ObjectModel; using namespace System; using namespace Runtime::InteropServices; using namespace System::Runtime::InteropServices; namespace Generic1 = System::Collections::Generic; using namespace System::Runtime::CompilerServices; //using namespace System::att; TestClass::TestClass() { } TestClass::~TestClass() { } /// Namespace Test: [] Mono Project /// T:NoNamespace public ref class NoNamespace {}; namespace System { /// T:System.Action`1 generic [SerializableAttribute] public delegate void Action(T obj); //TODO: Env1 name as not supported /// T:System.Environment public ref class Environment1 abstract sealed { //public: Environment1() {}; public: /// T:System.Environment+SpecialFolder enum class SpecialFolder {}; /// /// A instance. /// /// /// M:System.Environment.GetFolderPath(System.Environment+SpecialFolder) /// public: static SpecialFolder GetFolderPath(SpecialFolder folder) { //throw std::runtime_error("error"); return folder; }; // Testing whether this extension method shows up for System.Array public: generic where T : value class [System::Runtime::CompilerServices::Extension] static bool IsAligned(cli::array^ vect, int index) { return false; }; }; // to test ECMA doc importing... //todo: array1 instad real name public ref class Array1 { // the ECMA docs have a different return type than .NET -- skip. public: //todo: cli::array or std::array generic static ReadOnlyCollection ^ AsReadOnly(cli::array^ array) { throw gcnew NotImplementedException(); } // ECMA docs use instead of --> map them. public: generic static cli::array^ ConvertAll(cli::array^ array, Converter^ converter) { throw gcnew InvalidOperationException(); }; // ECMA docs *incorrectly* document parameter -- skip public: generic static void Resize(cli::array ^ % array, int newSize) { throw gcnew Exception(); } }; // to test ECMA doc importing... //public delegate void AsyncCallback(IAsyncResult^ ar); } //todo: no dot in namespace name namespace Mono_DocTest { //todo: no internal modifier class Internal { class ShouldNotBeDocumented { }; }; //todo: no internal modifier ref class MonoTODOAttribute : public System::Attribute { }; public ref class CustomException : System::Exception { protected: System::ArgumentNullException ArgumentNullExceptionField; }; public delegate void DelegateWithNetSystemType(System::Exception parameter); generic [SerializableAttribute] public delegate void Action22(T obj); /// /// /// cref=T:Mono.DocTest.DocAttribute. /// /// /// /// /// /// /// /// ///
redbluegreen
///
/// ///
[AttributeUsageAttribute(AttributeTargets::All)] public ref class DocAttribute : Attribute { /// C:Mono.DocTest.DocAttribute(System.String) public: DocAttribute(String ^ docs) { if (String::IsNullOrEmpty(docs)) throw gcnew ArgumentNullException(); }; private: Type^ quantity; /// P:Mono.DocTest.DocAttribute.Property public: property Type^ Property { Type^ get() { return quantity; } void set(Type^ value) { quantity = value; }}; /// F:Mono.DocTest.DocAttribute.Field bool Field; /// F:Mono.DocTest.DocAttribute.FlagsEnum ConsoleModifiers FlagsEnum; /// F:Mono.DocTest.DocAttribute.NonFlagsEnum Color NonFlagsEnum; }; /// Possible colors /// /// . /// Namespace Test: [] /// /*[MonoTODO] public enum Color { /// Insert Red summary here ///F:Mono.DocTest.Color.Red. Red, ///Insert Blue summary here ///F:Mono.DocTest.Color.Blue. Blue, ///Insert Green summary here ///F:Mono.DocTest.Color.Green. Green, AnotherGreen = Green, };*/ /// Process interface /// T:Mono.DocTest.IProcess. public interface class IProcess { }; /// Process interface /// T:Mono.DocTest.DocValueType. public value class DocValueType : IProcess { public: /// F:Mono.DocTest.DocValueType.total. int total; public: /// A . /// . void M(int i) { if (((gcnew Random())->Next() % 2) == 0) throw gcnew SystemException(); throw gcnew ApplicationException(); } }; public value class ValueClassSpecificField { public: DocValueType ExceptionField; }; /// T:Mono.DocTest.D public delegate Object ^ D(Func ^ value ); /// T:Mono.DocTest.Widget. /// /// Some extra tag value public ref class Widget : IProcess { //public: virtual double getVolume() { return 0; }; /// T:Mono.DocTest.Widget.NestedClass. public: ref class NestedClass { /// F:Mono.DocTest.Widget.NestedClass.value. public: int value; /// Some . /// M:Mono.DocTest.Widget.NestedClass.M(System.Int32). void M(int i) {}; /// T:Mono.DocTest.Widget.NestedClass.Double. ref class Double { /// T:Mono.DocTest.Widget.NestedClass.Double.Triple. public: ref class Triple { /// T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple. public: ref class Quadruple {};// for good measure }; }; }; public: enum class NestedEnum { Value1, Value2}; /// T:Mono.DocTest.Widget.NestedClass`1. public: //todo: cannot use the same class name here with generic par-r generic ref class NestedClass1 { /// F:Mono.DocTest.Widget.NestedClass`1.value. public: int value; /// Another . /// M:Mono.DocTest.Widget.NestedClass`1.M(System.Int32). public: void M(int i) {}; }; /// F:Mono.DocTest.Widget.classCtorError. public: static initonly cli::array^ classCtorError = CreateArray(); private: static cli::array^ CreateArray() { throw gcnew NotSupportedException(); }; /// F:Mono.DocTest.Widget.message. public: String^ message; /// F:Mono.DocTest.Widget.defaultColor. protected: static Color defaultColor; /// F:Mono.DocTest.Widget.PI. //TODO: no internal protected: const double PI = 3.14159; /// F:Mono.DocTest.Widget.monthlyAverage. protected public: initonly double monthlyAverage; /// F:Mono.DocTest.Widget.array1. public: cli::array^ array1; /// F:Mono.DocTest.Widget.array2. //todo: check if works correctly public: cli::array ^ array2; //TODO: no possibiiti for unsafe /// F:Mono.DocTest.Widget.pCount. public: int *pCount; //TODO: no possibiiti for unsafe /// F:Mono.DocTest.Widget.ppValues. public: float** ppValues; /// T:Mono.DocTest.Widget.IMenuItem. public: interface class IMenuItem { /// M:Mono.DocTest.Widget.IMenuItem.A. void A(); /// P:Mono.DocTest.Widget.IMenuItem.P. property int B { int get(); void set(int value); }; }; /// T:Mono.DocTest.Widget.Del. public: delegate void Del(int i); /// T:Mono.DocTest.Widget.Direction. //todo: no internal protected: [FlagsAttribute] /*internal*/ enum class Direction { /// T:Mono.DocTest.Widget.Direction.North. North, /// T:Mono.DocTest.Widget.Direction.South. South, /// T:Mono.DocTest.Widget.Direction.East. East, /// T:Mono.DocTest.Widget.Direction.West. West, }; /// /// C:Mono.DocTest.Widget. /// M:Mono.DocTest.Widget.#ctor. /// /// /// public: Widget() {}; /// A . /// /// C:Mono.DocTest.Widget(System.String). /// M:Mono.DocTest.Widget.#ctor(System.String). /// public: Widget(String^ s) {}; /// A . /// /// C:Mono.DocTest.Widget(System.Converter{System.String,System.String}). /// public: Widget(Converter^ c) {}; /// M:Mono.DocTest.Widget.M0. public: static void M0() {}; /// A . /// A . /// A . /// M:Mono.DocTest.Widget.M1(System.Char,System.Signle@,Mono.DocTest.DocValueType@). /// //TODO: doc attribute is not working public: [DocAttribute("normal DocAttribute", Field = true)] //[return:Doc("return:DocAttribute", Property = typeof(Widget))] void M1([Doc("c", FlagsEnum = ConsoleModifiers::Alt | ConsoleModifiers::Control)] long c, [Doc("f", NonFlagsEnum = Color::Red)][Runtime::InteropServices::Out] float % f, [DocAttribute("v")] DocValueType % v) { f = 0; }; /// A array. /// A array. /// A array. /// M:Mono.DocTest.Widget.M2(System.Int16[],System.Int32[0:,0:],System.Int64[][]). public: void M2(cli::array^ x1, cli::array^ x2, cli::array^ >^ x3) {}; /// Another array. /// A array. /// M:Mono.DocTest.Widget.M3(System.Int64[][],Mono.DocTest.Widget[0:,0:,0:][]). protected: void M3(cli::array^ >^ x3, cli::array^>^ x4) {}; //TODO: no unsafe /// A pointer. /// A pointer. /// M:Mono.DocTest.Widget.M4(System.Char*,Mono.DocTest.Color**). protected: void M4(char *pc, Color **ppf) {}; //TODO: no unsafe /// A pointer. /// A array. /// M:Mono.DocTest.Widget.M5(System.Void*,System.Double*[0:,0:][]). protected: void M5(void *pv, cli::array^>^*pd) {}; protected: void M55(void *pv, System::String ^ *pd) {}; /// Yet another . /// An array. /// M:Mono.DocTest.Widget.M6(System.Int32,System.Object[]). protected: void M6(int i, ... cli::array^ args) {}; /// M:Mono.DocTest.Widget.M7(Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple). public: void M7(Widget::NestedClass::Double::Triple::Quadruple ^ a) {}; /// A value... /// P:Mono.DocTest.Widget.Width. public: [DocAttribute("Width property")] property int Width { [Doc("Width get accessor")] int get() { return 0; }; protected: [Doc("Width set accessor")] void set(int value) {}; }; /// A value... /// P:Mono.DocTest.Widget.Height. protected: [Doc("Height property")] property long Height { long get() { return 0; }; }; /// A value... /// P:Mono.DocTest.Widget.X. //todo: no internal (protected internal) protected: property short X { void set(short value) {}; }; /// A value... /// P:Mono.DocTest.Widget.Y. //todo: no internal(protected internal) protected: property double Y { double get() { return 0; }; void set(double value) {}; }; /// TODO /// P:Mono.DocTest.Widget.Item(System.Int32). /// A instance. public: [DocAttribute("Item property")] property int default[int]{ int get(int index) { return 0; }; [Doc("Item property set accessor")] void set(int index, int value) {}; }; public: [DocAttribute("Item property")] property long indexedProperty[long]{ long get(long index) { return 0; }; [Doc("Item property set accessor")] void set(long index, long value) {}; }; /// Some . /// I love s. /// P:Mono.DocTest.Widget.Item(System.String,System.Int32). /// A instance. public: property int default[System::String ^, int] { int get(System::String ^ s, int i) { return 0; } void set(System::String ^ s, int i, int value) {}; }; /// E:Mono.DocTest.Widget.AnEvent. public: [Doc("Del event")] event Del^ AnEvent { [Doc("Del add accessor")] void add(Del^ name) {}; [Doc("Del remove accessor")] void remove(Del^ name) {}; void raise(int i) {}; }; /// E:Mono.DocTest.Widget.AnotherEvent. protected: event Del^ AnotherEvent; /// Another . /// M:Mono.DocTest.Widget.op_UnaryPlus(Mono.DocTest.Widget). /// A instance. public: static Widget^ operator + (Widget x) { return nullptr; } /// M:Mono.DocTest.Widget.op_Division. /// A instance. //todo": added 1 to compile public: static Widget^ op_Division1 = nullptr; /// Yet Another . /// Yay, s. /// M:Mono.DocTest.Widget.op_Addition(Mono.DocTest.Widget,Mono.DocTest.Widget). /// A instance (2). public: static Widget^ operator+ (Widget x1, Widget x2) { return nullptr; } /// s are fun!. /// M:Mono.DocTest.Widget.op_Explicit(Mono.DocTest.Widget)~System.Int32. /// A instance. public: static explicit operator int(Widget^ x) { return 0; } /// foo; . /// M:Mono.DocTest.Widget.op_Implicit(Mono.DocTest.Widget)~System.Int64. /// A instance. //todo: no implicit(default behavior) public: static operator long(Widget x) { return 0; } /// M:Mono.DocTest.Widget.Default(System.Int32,System.Int32)c //todo: no default value public: void Default( [System::Runtime::InteropServices::Optional] /*[System::Runtime::InteropServices::DefaultParameterValueAttribute(1)]*/int a, [System::Runtime::InteropServices::Optional] /*[System::Runtime::InteropServices::DefaultParameterValueAttribute(2)]*/int b) {}; /// M:Mono.DocTest.Widget.Default(System.String,System.Char) //todo: no default value public: void Default(/*[System::Runtime::InteropServices::DefaultParameterValueAttribute("a")]*/string a, /*[System::Runtime::InteropServices::DefaultParameterValueAttribute('b')]*/char b) {}; //TODO: no dynamics - use Object instead/ + no + operator /// M:Mono.DocTest.Widget.Dynamic0(System.Object,System.Object) public: Object^ Dynamic0(Object^ a, Object^ b) { return gcnew Object(); } //TODO: no dynamics - use Object instead /// M:Mono.DocTest.Widget.Dynamic1(System.Collections.Generic.Dictionary{System.Object,System.Object}) public: Generic1::Dictionary ^ Dynamic1(Generic1::Dictionary^ value) { return value; }; //TODO: no dynamics - use Object instead /// M:Mono.DocTest.Widget.Dynamic2(System.Func{System.String,System.Object}) public: Func^ Dynamic2(Func^ value) { return value; }; //TODO: no dynamics - use Object instead /// M:Mono.DocTest.Widget.Dynamic3(System.Func{System.Func{System.String,System.Object},System.Func{System.Object,System.String}}) public: Func^, Func< Object^, String^>^>^ Dynamic3( Func^, Func< Object^, String^>^>^ value) { return value; }; //TODO: no dynamics - use Object instead /// P:Mono.DocTest.Widget.DynamicP /*public: property Func^, Func, String^>^> ^DynamicP{ Func^, Func, String^>^> get(){ return nullptr; }; };*/ //TODO: no dynamics - use Object instead /// F:Mono.DocTest.Widget.DynamicF public: Func^, Func^, String^>^> ^DynamicF; //TODO: no dynamics - use Object instead + use delegate as pure Func cannot be used /// E:Mono.DocTest.Widget.DynamicE1 public: [Obsolete("why not")] event Func^ DynamicE1; //TODO: no dynamics - use Object instead /// E:Mono.DocTest.Widget.DynamicE2 public: event Func^ DynamicE2 { [Doc("Del add accessor")] void add(Func^ name) {}; [Doc("Del remove accessor")] void remove(Func^ name) {}; Object^ raise() { return gcnew Object(); }; }; }; /// T:Mono.DocTest.UseLists. public ref class UseLists { /// A . /// M:Mono.DocTest.UseLists.Process(Mono.DocTest.MyList{System.Int32}). public: void Process(Mono_DocTest_Generic::MyList ^ list) {}; /// A T. /// Something /// M:Mono.DocTest.UseLists.GetValues``1(``0). /// A instance. public: generic where T : value class Mono_DocTest_Generic::MyList^ GetValues(T value) { return nullptr; }; /// Another . /// /// M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32}). /// /// /// text! /// text! public: void Process(Generic1::List list) { // Bug: only creation is looked for, so this generates an // node: gcnew Exception(); // Bug? We only look at "static" types, so we can't follow // delegates/interface calls: //todo:uncomment /*Func^ a = x = > {throw gcnew InvalidOperationException(); }; a(1);*/ // Multi-dimensional arrays have "phantom" methods that Cecil can't // resolve, as they're provided by the runtime. These should be // ignored. cli::array^ array = gcnew cli::array(1, 1); array[0, 0] = 42; }; /// A . /// M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}}). public: void Process(Generic1::List^>^ list) { if (list == nullptr) throw gcnew ArgumentNullException("list"); Process(list); }; /// A . /// Something Else /// M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}}). public: generic void Process(Generic1::List^>^ list) { if (list->Contains(nullptr)) throw gcnew ArgumentException("predicate null"); }; /// A . /// T /// U /// V /// M:Mono.DocTest.UseLists.UseHelper``3(Mono.DocTest.Generic.MyList{``0}.Helper{``1,``2}). public: generic void UseHelper(Mono_DocTest_Generic::MyList::Helper^ helper) {}; }; };