OSDN Git Service

#36897 [DTXC] MIDIインポート機能の呼び出し口を、ファイルメニュー内にも配置。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / Utilities.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy\r
5 * of this software and associated documentation files (the "Software"), to deal\r
6 * in the Software without restriction, including without limitation the rights\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
8 * copies of the Software, and to permit persons to whom the Software is\r
9 * furnished to do so, subject to the following conditions:\r
10\r
11 * The above copyright notice and this permission notice shall be included in\r
12 * all copies or substantial portions of the Software.\r
13\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include <windows.h>\r
25 #include <d3dx9.h>\r
26 #include <dxgi.h>\r
27 \r
28 #include "Result.h"\r
29 \r
30 #ifdef XMLDOCS\r
31 using System::InvalidOperationException;\r
32 using System::ArgumentException;\r
33 using System::ArgumentNullException;\r
34 using System::ArgumentOutOfRangeException;\r
35 using System::NotSupportedException;\r
36 using System::IO::EndOfStreamException;\r
37 #endif\r
38 \r
39 namespace SlimDX\r
40 {\r
41         ref class ComObject;\r
42         ref class DataStream;\r
43 \r
44         ref class Utilities sealed\r
45         {\r
46         private:\r
47                 Utilities();\r
48                 \r
49         public:\r
50                 static GUID GetNativeGuidForType( System::Type^ type );\r
51 \r
52                 static System::Guid ConvertNativeGuid( const GUID &guid );\r
53                 static GUID ConvertManagedGuid( System::Guid guid );\r
54                 \r
55                 static int SizeOfFormatElement( DXGI_FORMAT format );\r
56                 \r
57                 static System::Drawing::Rectangle ConvertRect(RECT rect);\r
58                 static void ConvertRect(System::Drawing::Rectangle& source, RECT& dest);\r
59 \r
60                 static System::String^ BlobToString( ID3D10Blob *blob );\r
61                 static System::String^ BufferToString( ID3DXBuffer *buffer );\r
62 \r
63                 static array<System::Byte>^ ReadStream( System::IO::Stream^ stream, DataStream^* dataStream );\r
64                 static array<System::Byte>^ ReadStream( System::IO::Stream^ stream, int% readLength, DataStream^* dataStream );\r
65 \r
66                 generic<typename T> where T : value class\r
67                 static array<T>^ ReadRange( ID3DXBuffer *buffer, int count );\r
68 \r
69                 //These doc comments are mostly intended to copy to other places.\r
70 \r
71                 /// <summary>\r
72                 /// Checks that a range to be read are within the boundaries of a source.\r
73                 /// </summary>\r
74                 /// <param name="lowerBound">The minimum bound that can be read from the source, and fills in the number of elements to read if necessary.</param>\r
75                 /// <param name="size">The total size of the source.</param>\r
76                 /// <param name="offset">The index at which the caller intends to begin reading from the source.</param>\r
77                 /// <param name="count">The number of elements intended to be read from the source. If 0 is passed, count will be adjusted to be size - offset.</param>\r
78                 /// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> is less than <paramref name="lowerBound" />.</exception>\r
79                 /// <exception cref="ArgumentOutOfRangeException"><paramref name="count" /> is negative.</exception>\r
80                 /// <exception cref="ArgumentException">The sum of <paramref name="offset" /> and <paramref name="count" /> is greater than the buffer length.</exception>\r
81                 static void CheckBounds( int lowerBound, int size, int offset, int% count );\r
82 \r
83                 /// <summary>\r
84                 /// Checks that a range to be read is within the boundaries of a source array, and fills in the number of elements to read if necessary.\r
85                 /// </summary>\r
86                 /// <param name="data">The source array to be read from.</param>\r
87                 /// <param name="offset">The index at which the caller intends to begin reading from the source.</param>\r
88                 /// <param name="count">The number of elements intended to be read from the source. If 0 is passed, count will be adjusted to be size - offset.</param>\r
89                 /// <exception cref="ArgumentNullException"><paramref name="data" /> is a null reference.</exception>\r
90                 /// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> or <paramref name="count" /> is negative.</exception>\r
91                 /// <exception cref="ArgumentException">The sum of <paramref name="offset" /> and <paramref name="count" /> is greater than the buffer length.</exception>\r
92                 static void CheckArrayBounds( System::Array^ data, int offset, int% count );\r
93                 \r
94                 generic<typename T>\r
95                 static bool CheckElementEquality( array<T>^ left, array<T>^ right );\r
96                 generic<typename T>\r
97                 static bool CheckElementEquality( System::Collections::Generic::IList<T>^ left, System::Collections::Generic::IList<T>^ right );\r
98                 \r
99                 [System::Security::Permissions::SecurityPermission( System::Security::Permissions::SecurityAction::LinkDemand, Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode )]\r
100                 static void FreeNativeString( LPCSTR string );\r
101 \r
102                 [System::Security::Permissions::SecurityPermission( System::Security::Permissions::SecurityAction::LinkDemand, Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode )]\r
103                 static void FreeNativeString( LPSTR string );\r
104 \r
105                 [System::Security::Permissions::SecurityPermission( System::Security::Permissions::SecurityAction::LinkDemand, Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode )]\r
106                 static LPSTR AllocateNativeString( System::String^ string );\r
107 \r
108                 generic<typename T> where T : value class\r
109                 static T FromIntToT( int value );\r
110         };\r
111 }\r